1
$\begingroup$

If I run:

Sound`EmitMIDI[Sound`MIDISequence[{Sound`MIDITrack[{                     
  Sound`MIDIEvent[0, "SetTempo", "Tempo" -> 1000000], 
  Sound`MIDIEvent[0, "ProgramCommand", "Channel" -> 0, "Value" -> 0], 
  Sound`MIDIEvent[0, "NoteOn", "Note" -> 65, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[0, "NoteOn", "Note" -> 72, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[96, "NoteOff", "Note" -> 65, "Channel" -> 0, "Velocity" -> 0], Sound`MIDIEvent[96, "NoteOff", "Note" -> 72, "Channel" -> 0, "Velocity" -> 0], Sound`MIDIEvent[120, "NoteOn", "Note" -> 67, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[168, "NoteOff", "Note" -> 67, "Channel" -> 0, "Velocity" -> 0], Sound`MIDIEvent[168, "NoteOn", "Note" -> 60, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[216, "NoteOff", "Note" -> 60, "Channel" -> 0, "Velocity" -> 0], 
Sound`MIDIEvent[216, "NoteOn", "Note" -> 64, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[408, "NoteOff", "Note" -> 64, "Channel" -> 0, "Velocity" -> 0], Sound`MIDIEvent[408, "NoteOn", "Note" -> 65, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[456, "NoteOff", "Note" -> 65, "Channel" -> 0, "Velocity" -> 0], Sound`MIDIEvent[456, "NoteOn", "Note" -> 64, "Channel" -> 0, "Velocity" -> 127], Sound`MIDIEvent[504, "NoteOff", "Note" -> 64, "Channel" -> 0, "Velocity" -> 0]}]}, "DivisionType" -> "PPQ", "Resolution" -> 48]]

and then run this:

Sound`StopMIDI[]

There is clearly a time lag that you can hear between code execution and the playing or stopping of the music. Is there any way to make it immediately stop or play?

If anyone can point me toward good documentation of MIDI* functions I would be much obliged, I still don't know that the first argument in MIDIEvent is!

$\endgroup$
  • $\begingroup$ The first element of MIDIEvent is the starting time of the specified event. This in your sequence, three notes start at time 0, two at time 96 and etc. $\endgroup$ – bill s Sep 6 '15 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.