This document outlines the data structures and sonic parameters required for AI agents to generate valid song files for the Hyphon engine.
A Hyphon song is a JSON object matching the SavedSongData interface. It contains patterns, synthesis parameters, and track data.
interface SavedSongData {
version: number; // version: 1
tempo: number; // BPM (e.g., 120)
pattern: Pattern; // The core musical data
params: { // Synthesis parameters
synthA: SynthParams; // Lead/Bass Synth 1
synthB: SynthParams; // Lead/Bass Synth 2
kick: KickParams; // Kick Drum
snare: SnareParams; // Snare Drum
closedHat: HatParams; // Closed Hi-Hat
openHat: HatParams; // Open Hi-Hat
sampler: SamplerParams; // Sampler Banks (Array of 8)
};
trackStorage: Record<string, unknown>; // (Internal)
activeTrackSlots: Record<string, number>; // (Internal)
songStructure: SongStep[]; // Arrangement
embeddedSamples?: { [bankIndex: number]: string }; // Base64 WAVs
ttsPhrases?: string[]; // Text-to-Speech phrases
}To "intuit" how a sound will be perceived, use the following parameter mappings.
| Parameter | Type | Range | Sonic Characteristic | Intuition Guide |
|---|---|---|---|---|
waveform |
string | 'sawtooth', 'square', '303-saw', '303-sqr' | Timbre | Saw: Bright, buzzy, aggressive. Square: Hollow, woody, clarinet-like. 303-Saw: Acidic, biting. 303-Sqr: Resonant, hollow acid. |
filterCutoff |
number | 0 - 20000 (Hz) | Brightness | Low (<500): Deep, muffled, sub-bass. Mid (500-2000): Warm, punchy. High (>2000): Bright, sizzling, harsh. |
filterResonance |
number | 0 - 20 (Q) | Squelch / "Wow" | Low (<1): Clean, flat. Mid (1-5): Musical, vocal. High (>10): Screaming, self-oscillating, "acidic squelch". |
attack |
number | 0 - 2.0 (s) | Impact | Short (<0.01): Plucky, percussive, immediate. Long (>0.5): Swelling, pad-like, slow. |
decay |
number | 0 - 2.0 (s) | Duration / Tail | Short (<0.2): Staccato, tight. Long (>1.0): Ringing, sustained. |
sustain |
number | 0 - 1.0 | Body | Low (0): Percussive (piano/pluck). High (1): Organ/Drone (continuous). |
release |
number | 0 - 5.0 (s) | Fade Out | Short: Abrupt stop. Long: Ambient tail. |
drive |
number | 0 - 1.0 | Distortion | 0: Clean. 0.5: Warm saturation. 1.0: Aggressive fuzz/distortion. |
- Punchy/Tight:
decay: 0.3,tone: 0.8,pitch: 50 - Boomy/808:
decay: 0.8,tone: 0.2,pitch: 40 - Distorted/Gabber:
decay: 0.5,tone: 1.0(high tone acts as drive)
- Tight/Funk:
decay: 0.2,tone: 0.8,noise: 0.4 - Splashy/80s:
decay: 0.6,tone: 0.5,noise: 0.8
- Ticking/Digital:
decay: 0.05,pitch: 8000 - Open/Washy:
decay: 0.5,pitch: 6000
| Parameter | Type | Range | Sonic Characteristic | Intuition Guide |
|---|---|---|---|---|
playbackSpeed |
number | 0.1 - 4.0 | Pitch/Time | 1.0: Normal. 0.5: Half-speed/octave down (sludgy). 2.0: Chipmunk/octave up. |
mode |
string | 'loop', 'stretch', 'wavetable' | Texture | Loop: Traditional sampler. Stretch: Time-stretching (preserving pitch). Wavetable: Granular/scanned textures. |
grainSize |
number | 0.01 - 0.5 (s) | Granularity | Small (<0.05): Glitchy, robotic. Large (>0.2): Smooth, dreamy. |
bitCrush |
number | 0 - 16 | Lo-Fi | 0: Clean. 8: Vintage sampler. 16: Heavy digital destruction. |
The sequencing data is stored in the pattern object.
interface Pattern {
partA: PartSequence; // Synth A
partB: PartSequence; // Synth B
kick: PartSequence;
snare: PartSequence;
closedHat: PartSequence;
openHat: PartSequence;
sampler: PartSequence[]; // Array of 8 sequences
}
interface PartSequence {
steps: (Note | null)[]; // Array of 16 steps (usually)
automation?: { [param: string]: (number | null)[] };
}
interface Note {
note: string; // e.g., "C4", "F#3"
velocity: number; // 0.0 - 1.0 (Volume/Accent)
length?: number; // Duration in steps (default 1)
slide?: boolean; // Portamento to next note
probability?: number; // 0.0 - 1.0 (Chance to play)
microtiming?: number; // -0.5 to 0.5 (Swing/Offset)
reverse?: boolean; // Reverse playback (Sampler only)
}- Acid Bassline: Use
slide: trueon overlapping notes. Varyvelocity> 0.8 for Accents. - Human Feel: Use
microtiming(e.g.,closedHatslightly late +0.02,snareslightly early -0.01). - Ghost Notes: Use low
velocity(0.2 - 0.4) on snare/kicks between main beats.
To generate an Acid Techno track, an agent should output JSON with these characteristics:
- Tempo: 135 - 145 BPM.
- Kick:
decay: 0.6,tone: 0.4(Solid 909-style). Pattern: 4-on-the-floor (Steps 0, 4, 8, 12). - Synth A (Bass):
waveform: "303-sqr"filterCutoff: 400 (base)filterResonance: 8.5 (High!)envMod: 0.8- Pattern: 16th notes with gaps. High probability of
slide: true.
- Hi-Hats: Open hat on off-beats (2, 6, 10, 14). Closed hats 16ths with varying velocity.
This guide serves as the protocol for AI-driven composition within the Hyphon engine.