What's the method to control volume in an MIDI sequencer?

前端 未结 1 2035
无人共我
无人共我 2021-01-14 16:22

Can someone show me how to control the volume of an MIDI sequencer without using a sound bank or synthesizer?

I want to make the MIDI fade out befor

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-14 16:40

    1. Call getSequence to get the Sequence;
    2. call getTracks to get the list of tracks;
    3. in each track, for each channel used in the track, call add to add multiple events at the appropriate time positions:

      track.add(new MidiEvent(
          new ShortMessage(ShortMessage.CONTROL_CHANGE, channel, 7, volume),
          tick));
      
    4. maybe remove other volume change events (that would interfere with your fadeout) from the track;
    5. wait a little time for the fadeout to happen.

    0 讨论(0)
提交回复
热议问题