Skip to content

Instantly share code, notes, and snippets.

@fayimora
Forked from lihaoyi/IfWeHoldOnTogether.scala
Last active September 15, 2015 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fayimora/a7c3e2c28a0948a06218 to your computer and use it in GitHub Desktop.
Save fayimora/a7c3e2c28a0948a06218 to your computer and use it in GitHub Desktop.
{
import javax.sound.midi._
val synth = MidiSystem.getSynthesizer()
synth.open()
def note(i: Int) = {
val channels = synth.getChannels()
channels(0).noteOn(i, 100)
Thread.sleep(250)
channels(0).noteOff(i)
}
val s1 = Seq(67, 72, 76, 79, 0, 78, 78, 77, 81, 84, 76, 0, 74, 0)
val first = Seq(60) ++ s1 ++ Seq(0) ++ s1
val s2 = Seq(62, 0, 62, 64, 60, 0)
val s3 = s2 ++ Seq(55)
val second = s3 ++ Seq(55) ++ s3 ++ Seq(0) ++ s2 ++ Seq(57, 67, 67, 0, 0, 65, 62, 0, 0)
val s4 = Seq(69, 0, 64, 0, 67, 0, 64, 0) ++ Seq(64, 72, 71, 69, 67, 0, 64, 0)
val s6 = Seq(69, 0, 67, 65, 64, 0)
val s5 = s6 ++ Seq(65, 67, 0, 62, 0, 0, 62, 67, 74)
val s7 = Seq(62, 60, 0, 62)
(first ++ second ++ s4 ++ s5 ++ s4 ++ s6 ++ s7).foreach(note)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment