Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Midi Volume Control Does Not Work

843802Nov 15 2007 — edited Aug 22 2010
I hate to bring this topic up again, but i simply cannot control the volume of midi playback and there seems to be no real solution on the web.

I have tried this, but i guess this doesnt work for Midi files that already have control change 7 events in them.
MidiChannel[] channels = this.synthesizer.getChannels();
for (int i = 0; i < channels.length; i++) {
channels.controlChange(0x07, (int) (127.0 * (volume / MAX_VOLUME)));
}
Is there any other way besides changing the volume on the actual file?

This is how i set up my sequencer and synthesizer:
sequencer = MidiSystem.getSequencer();
synthesizer = MidiSystem.getSynthesizer();
sequencer.open();
synthesizer.open();
sequencer.getTransmitter().setReceiver(synthesizer.getReceiver());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2010
Added on Nov 15 2007
8 comments
883 views