I am using MIDI.js in my project, here is my code for playing sequence of MIDI notes
for (var repeat = 0; repeat < melodyrepititions; repeat++)
{
for (var i = 0; i < composition.length; i++)
{
for (var j = 0; j < composition[i].length; j++)
{
if (composition[i][j] != 0)
{
MIDI.noteOn(0, composition[i][j] + scale, velocity,delay );
MIDI.noteOff(0, composition[i][j] + scale, delay+onlynotationsofeachbeatbracketdelay[i][j]);
}
else if (composition[i][j] == 0)
{
MIDI.noteOff(0, composition[i][j] + scale, delay);
}
delay = delay + onlynotationsofeachbeatbracketdelay[i][j];
}
}
}
I want to implement MIDI.js player for this sequence to start,pause,stop the melody while playing. I am not able to figure out how can I use MIDI.js player functions for such sequence. Please guide.