Howard Amos

Greenhorn
+ Follow
since Aug 16, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

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.
12 years ago