MIDI Song with CC

[亡魂溺海] 提交于 2019-12-12 03:16:37

问题


Following this Midi player and wanted to add a Custom Control (CC) to reduce Channel 0 and 1 volume to 10% using ShortMessage: http://www.jsresources.org/examples/MidiPlayer.html

I find it didn't reduce the volume right after the midi song start playing.

ShortMessage volMessage = new ShortMessage();
  for(int i=0;i<2;i++) {
    try{
      volMessage.setMessage(ShortMessage.CONTROL_CHANGE,i, 7, 10);
    } catch(InvalidMidiDataException e) {}
      midiReceiver.send(volMessage,-1); 
    }

Has anyone done using ShortMessage to control MIDI channels?


回答1:


You're attempting to end the message in the catch block - it should be immediately after the .setMessage() call in the try block!




回答2:


MIDI CC 7 will only act as a volume control if the instrument conforms to the GM (General MIDI) standard. If you want to control the volume, you should do it in the mixer with the rendered audio output.

Also, if I'm not mistaken, the 2nd data byte is a value between 0-127, not 0-100. So if you want 10% volume, that would be a value of 12 or 13. ;)



来源:https://stackoverflow.com/questions/9108996/midi-song-with-cc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!