我计划使用可以设置其 bpm、音量等的 Java 创建自己的节拍器(木版乐器)。我已经尝试了超过 16 个通道(MIDI 1.0 规范),getChannels()
但根本听不到木版。
这是取自http://www.jsresources.org的代码
/*
* Turn the note on on MIDI channel 1.
* (Index zero means MIDI channel 1)
*/
MidiChannel[] channels = synth.getChannels();
channels[0].noteOn(nNoteNumber, nVelocity);
/*
* Wait for the specified amount of time
* (the duration of the note).
*/
try
{
Thread.sleep(nDuration);
}
catch (InterruptedException e)
{
}
/*
* Turn the note off.
*/
channels[0].noteOff(nNoteNumber);
有人对此有所了解吗?谢谢。