MUSE loads song descriptions from JSON and turns them into MIDI compositions. The core flow looks like this:
SongLoader deserializes JSON into a Song object (name, duration, tempo, scales, chord progressions, tracks, seed, etc.).Program builds a GenerativeEngine, passing the song and timing information (ticks per second derived from tempo and time division).GenerativeEngine creates one TrackChunk per configured track. It walks the song timeline in seconds, derives active chords from the progression list, and uses a deterministic pseudo-random generator seeded with Song.Seed so that runs are repeatable.MidiExtensions.InsertNote helper. This converts seconds to MIDI ticks and writes Note On/Off events with channel, velocity, and duration.SetTempoEvent) and key signature events are written to a meta track so downstream DAWs understand the musical context.song_f_minor.json){
"Name": "Nocturne of Shadows",
"BaseNote": 41,
"KeySignature": "F Minor",
"Tempo": 68,
"Duration": 420,
"ChordProgressions": [
{
"name": "Gathering Gloom",
"sequence": [ "i", "iv", "i", "VI", "iv", "ii°", "v", "i" ]
},
{
"name": "Midnight Climax",
"sequence": [ "i", "ii°", "v", "VI", "iv", "ii°", "v", "i" ]
},
{
"name": "Dawn Release",
"sequence": [ "iv", "VI", "iii", "VII", "i", "iv", "V", "i" ]
}
],
"Scales": [
{ "name": "F Natural Minor", "intervals": [ 0, 2, 3, 5, 7, 8, 10 ] },
{ "name": "F Harmonic Minor", "intervals": [ 0, 2, 3, 5, 7, 8, 11 ] },
{ "name": "F Phrygian", "intervals": [ 0, 1, 3, 5, 7, 8, 10 ] }
],
"Tracks": [
{
"name": "Fog Drone",
"octave": -1,
"offset": -3,
"period": 30,
"inPosition": 0,
"outPosition": 240,
"affluence": 2,
"chord": [ 0, 2, 5 ]
},
{
"name": "Pulse Undercurrent",
"octave": 0,
"offset": -1,
"period": 12,
"inPosition": 60,
"outPosition": 300,
"affluence": 4,
"chord": [ 0, 3, 6 ]
},
{
"name": "Embers Fade",
"octave": 1,
"offset": 0,
"period": 20,
"inPosition": 300,
"outPosition": 420,
"affluence": 3,
"chord": [ 0, 2, 5 ]
}
],
"Seed": [ 6, 1, 4, 9, 2, 7, 3, 5 ],
"Algorithm": "D"
}
octave, offset, and period define the register, melodic movement frequency, and rhythmic spacing. inPosition/outPosition (seconds) gate when the track plays, and affluence affects density and velocity. Optional chord arrays bias the track toward specific chord tones when the progression calls for them.D tells the engine to use its chord-aware generative routine.