我打算用Java来创建我自己的节拍器(木版乐器),它可以设置它的bpm,音量等等。我已经尝试了从getChannels()
获得的超过16个通道(MIDI 1.0规范),但是根本没有听到任何木版块。在Java上播放单个midi woodblock note?
/*
* 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);
任何人采取的代码有这事?谢谢。
可能的重复:http://stackoverflow.com/questions/380103/simple-java-midi-example-not-producing-any-sound – 2009-10-25 14:48:12