TuneLM

Music, written
as code.

Describe the music you want to hear. TuneLM generates editable Strudel code, and your browser runs it to create the audio. You can change the notes, rhythms, and instruments directly in the code.

Try TuneLM
UK garage
setcpm(136 / 4)

// Two-step drums with a swung kick and hats
const kick = s(`<[sbd ~ ~ sbd ~ ~ sbd ~]
                [sbd ~ ~ sbd ~ sbd ~ ~]>`)
  .swingBy(0.24, 4).freq(53).penv(26)
  .pdecay(0.065).decay(0.17).gain(0.52)

const snare = s("~ ~ pink ~ ~ ~ pink ~")
  .hpf(950).lpf(7300).decay(0.09).sustain(0)
  .gain(0.84)

const hats = s("~ white ~ [white white] ~ white ~ white")
  .swingBy(0.26, 4).hpf(7500).decay(0.035)
  .sustain(0).gain(0.29)

const drums = stack(kick, snare, hats)

// Syncopated bass follows four chords
const bass = note(`<[f2 ~ ~ c3 ~ f2 f3 eb2]
                   [db2 ~ ~ ab2 ~ db2 f2 ~]
                   [ab1 ~ ~ eb2 ~ ab2 c3 ~]
                   [eb2 ~ bb2 ~ ~ eb2 g2 c3]>`)
  .swingBy(0.24, 4).s("square").lpf(460)
  .lpenv(1.4).lpdecay(0.12).decay(0.14)
  .sustain(0.22).release(0.07).gain(0.56)

const harmony = note(`<[ab3,c4,eb4,g4]
                      [ab3,c4,db4,f4]
                      [ab3,bb3,c4,eb4]
                      [g3,bb3,c4,eb4]>`)

const chords = harmony.struct("~ x ~ ~ x ~ ~ x")
  .s("triangle").fm(0.55).fmh(2).decay(0.14)
  .sustain(0.04).release(0.09).gain(0.28)

// A bright four-bar hook with a quiet stereo echo
const hook = note(`<[~ c5 eb5 ~ g5 ~ f5 eb5]
                   [~ c5 eb5 ~ ab5 ~ f5 c5]
                   [~ c5 eb5 ~ g5 ~ c6 bb5]
                   [~ bb4 c5 ~ eb5 ~ g5 ~]>`)
  .s("triangle").fm(1.25).fmh(2).decay(0.11)
  .sustain(0.12).release(0.08).gain(0.36)
  .pan(0.42).off(3 / 16, p => p.gain(0.09).pan(0.76))

const pad = harmony.s("sawtooth").lpf(950)
  .attack(0.18).release(0.22).gain(0.10)

// Full groove, a four-bar break, then back in
arrange(
  [8, stack(drums, bass, chords, hook)],
  [4, stack(snare, hats, pad, hook)],
  [4, stack(drums, bass, chords, hook, pad)]
)

How is TuneLM trained?

  1. Dataset creation

    Use Gemini 4 Argon and Carbon to create synthetic pairs of music descriptions and Strudel programs.

  2. Supervised fine-tuning (SFT)

    Fine-tune LiquidAI's LFM3-1.7B model with LoRA on those pairs so it learns to write Strudel code from music descriptions.

  3. Reinforcement learning (GRPO)

    Train with GRPO using a reward function that scores how well runnable Strudel programs meet the prompt’s musical constraints.

Download audio

16-bit PCM WAV