Using h/w synth via MIDI?

Can JavaSound use the h/w MIDI synth on a soundcard?
I can use the Java Software Synthesizer no problem, because it’s the default, but any attempt to redirect sequences to another synth fail miserably.

I can list all synths via a call to MidiSystem.getMidiDeviceInfo() but for the life of me I can’t work out how to use the results to redirect MIDI sound to the h/w synth instead of the Java software synth. I don’t even know if it’s possible. There is no setSynth() method :-/

On a side note, does anyone even bother with MIDI synths these days (outside of professional musicians)?

Depending on java version, midi results are different…

I used midi for Zoltar’s return last year, because it requires much less space than any other format (15K is a big file). but you have to keep in mind the java sound bank is far for professional quality…

To have access to your soundcard, you can have a look at WireProvider (from memory) and hook the sequencer to its midi out ports (java 1.4 doesn’t send midi event to the soundcard).

Don’t know about java 5 issues (haven’t tried it for a year).

have a look here : it’s full of intersting informations : http://www.jsresources.org/

Lilian

There is no WireProvider…

I think I need to use Transmitters and Receivers but when I query my devices for these I get 0 for the number of transmitters and receivers, which means I can’t connect anything up. I checked out jresources.org, they even have a sample midiplayer app that lets you select the synth on the command line, but it doesn’t work (class cast exception when they try to cast a MidiDevice to a Sequencer).

I’m beginning to think it’s not possible!

WireProvider is an external package : http://www.geocities.com/ggehnen/

And yes, it’s possible (but not easy : look at the faq in jsresources.org on using sequencer and sending midi IO event ).

Lilian

Thanks for the link I’ll check it out.

JavaSound is a great API but it’s quite low level, it’s taking me longer than I’d like to get my head around it.
BTW I also found http://www.jsynthlib.org/ which might have some useful stuff.

Yay, got it working!

Turns out you need to get the Sequencer with a call to MidiSystem.getSequencer(false), where “false” means the Sequencer is not connected to the default Java s/w synth. Then you connect the Transmitter of the Sequencer to the Receiver of the h/w MidiDevice.

Slight problemo is that MidiSystem.getSequencer(boolean) is only available since Java 1.5.

On 1.4, you can also use a third party software sequencer (the one from tritonus). It should work on any system with accurate System.currentTimeMillis. Or may be it can be hacked to use another timer - I haven’t checked if the sources were available.

note : I haven’t tested it, just know it exists.

note 2 : the savasound mailing list is full of interesting stuff, and not too active. you should consider registering (the author of the 1.5 java sound is there and replies fast, many other skilled people are also on the list).

Lilian