Skip to content

Instantly share code, notes, and snippets.

@ThinaticSystem
Last active July 31, 2023 20:33
Show Gist options
  • Save ThinaticSystem/d7219d6928545b3ef38ccb96ca3ee29e to your computer and use it in GitHub Desktop.
Save ThinaticSystem/d7219d6928545b3ef38ccb96ca3ee29e to your computer and use it in GitHub Desktop.
Functonal
@Play
@Functonal
fun Player() {
  Song(
    bpm = 132,
    groove = Grooves.Latin1,
  )
}


@Functonal
fun Song(bpm: Int, groove: Groove) {
  At(measure = 2) {
    repeat(8) {
      MainMotif(
        key = Keys.C,
        groove = groove,
        instrument = Instruments.Piano,
      )
    }
  }
}

@Functonal
fun MainMotif(key: Key, groove: Groove, instrument: Instrument) {
  Sequence(*(
    [
      C3(),
      Chord(Bb2(), C3()),
      G3(), // 
      E3(),
    ].map { (it in Keys.C) trans key }
  ))
}

class Chord(varargs tones: Tone) : Sound {}

interface Sound {
  val frequency: Double
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment