Howard Amos

+ Follow
since Aug 16, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Howard Amos

I had the same problems.

Upon investigation I concluded that for me (on Mac OS X, java 1.6.0_33-b03-424-10M3720) MidiSystem.getSynthesizer did *NOT* return the same synthesizer that the sequencer was by default connected to.

The sequencer is already connected to *A* synthesizer. If you do a getSynthesizer and connect it up then your sequencer will drive *TWO* synthesizers. You can test this by calling sequencer.getTransmitters and looping through the list (of transmitters open and in use).

I suggest that this is why setting volume to zero reduces the volume but doesn't shut it off completely!

Of course different java environments might behave differently.

Possible solutiona:

1 (the one I used)

Don't use the synthesizer object because you can't get to it (but see solution 2). Don't use Channels. To control volume use:

receiver = seq.getTransmitters ().iterator ().next ().getReceiver ();
receiver.send (volumeMessage, -1);

This is of course suitable for both software and hardware synth so should simplify the code.

2 (not tested)

Use getSynthesizer and connect transmitter and receiver as lots of sample code tells you, BUT
do something like: seq.getTransmitters ().iterator ().next ().close ()
to shut down the default synthesizer started for you.

Then with any luck you can get the channels and the sample code might work.
6 years ago