     midifile = MidiFile(array)
 
     console.log buffer, midifile
+
+    midifile.tracks.forEach (track, i) ->
+      return unless i is 1
+
+      timeInTicks = 0
+      console.log track
+      time = context.currentTime
+
+      track.forEach (event) ->
+        
+        {deltaTime, noteNumber, subtype, velocity} = event
+
+        timeInTicks += deltaTime
+        atTime = time + (micrcosecondsPerBeat / 1000000) * (timeInTicks / 196)
+
+        if subtype is "noteOn"
+          playNote noteNumber, velocity, noteNumber, atTime
+        
+        if subtype is "noteOff"
+          releaseNote noteNumber, atTime
+
+      console.log timeInTicks

  noteFrequencies[note]

notes = {}
playNote = (note, velocity, id) ->
  # TODO: Why do these notes cut out suddenly and for no reason?
  console.log "play!"
  freq = noteToFreq(note - 12)

  osco = context.createOscillator()

  osco.frequency.value = freq

  osco = Gainer(osco)
  osco.gain.linearRampToValueAtTime(velocity / 128, time)
  osco.connect(masterGain)

  osco.start(time)

  notes[id] = [osco, osco.gain]

releaseNote = (id, time=context.currentTime) ->
  [osco, gain] = notes[id]
  # Wow this is nutz!
  # Need to set the value to the current value because the
  # linearRampToValueAtTime uses the previous time to create the ramp, yolo!
  gain.setValueAtTime(osco.gain.value, time)
  gain.linearRampToValueAtTime(0.0, time + 0.125)
  delete notes[id]

do ->
  # Midi loading
  MidiFile = require "./lib/midifile"

  micrcosecondsPerBeat = 500000

  Ajax = require "./lib/ajax"
  Ajax.getBuffer("https://s3.amazonaws.com/whimsyspace-databucket-1g3p6d9lcl6x1/danielx/data/qxIFNrVVEqhwmwUO5wWyZKk1IwGgQIxqvLQ9WX0X20E")
