Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2002 01:13:14 +0200
From:      Kees Jan Koster <kjkoster@kjkoster.org>
To:        freebsd-java@freebsd.org
Subject:   Java Audio findings
Message-ID:  <3CCC820A.25C75098@kjkoster.org>

next in thread | raw e-mail | index | archive | help
Dear All,

I've been playing around with the Java sound API and I figured I'd give
the sound demo a swing. Much to my delight, the demo worked pretty much
completely in FreeBSD's linuxulated JDK 1.3.1_03 and some of it even
worked in FreeBSD's native 1.3.1p6_4. This is all on FreeBSD 4.5-stable
as of yesterday. The sound card came with my motherboard and is a VIA
all-in-one thingy.

To summarise:

* In Windows, the pan control on the Juke box has left and right
reversed. On FreeBSD and the linuxulator this control works as intended.
Hahaa!! Take that, billy! :-)

* The Juke Box works as advertised in the linuxulator, except for .aiff
files.

* The Juke Box works for the native JDK only for .wav and .au files, not
for .aiff, .rmf and .mid files. If I may take a blind, uneducated swing
at the problem: perhaps an endian-problem reading these files?

* Capture/Playback seems to work in the Linux version on FreeBSD,
although I haven't actually tried to capture nor play back anything.

* Capture/Playback generates the following exception on FreeBSD's native
JDK:
java.lang.IllegalStateException: Sequencer not open
        at
com.sun.media.sound.MixerSequencer.stop(MixerSequencer.java:440)
        at Juke.playSound(Juke.java:309)
        at Juke.run(Juke.java:410)
        at java.lang.Thread.run(Thread.java:484)

This makes me wonder what device it tries to open to speak to the midi
sequencer. If it hadn't been 1:00am I might have looked at the sources.
|-)

* Midi Synthesizer works in the Linux version. In fact, it shows the
instrument names in the boxes, where the Windows version shows only
instrument numbers. (*POW* Linux 2, Windows 0)

It becomes painfully obvious that I have a cheap-ass sound card with
awful midi samples. The only reason I recognise the sound "applause" is
because it says so on the screen. If that's applause I'm curious what
static sounds like on my audio card.

* Midi Synthesizer does not work in the native JDK and generates the
following exception:
javax.sound.midi.MidiUnavailableException: Audio Device Unavailable
        at
com.sun.media.sound.HeadspaceMixer.open(HeadspaceMixer.java:628)
        at
com.sun.media.sound.AbstractPlayer.open(AbstractPlayer.java:138)
        at MidiSynth.open(MidiSynth.java:108)
        at JavaSound.open(JavaSound.java:109)
        at JavaSound.stateChanged(JavaSound.java:99)
        at
javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:234)
        at
javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:179)
        at
javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:99)
        at
javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:51)
        at
javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:349)
        at
javax.swing.plaf.basic.BasicTabbedPaneUI$MouseHandler.mousePressed(BasicTabbedPaneUI.java:1822)
        at java.awt.Component.processMouseEvent(Component.java:3712)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1164)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1213)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2210)
        at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
        at java.awt.Container.dispatchEventImpl(Container.java:1200)
        at java.awt.Window.dispatchEventImpl(Window.java:914)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

Again: what device is it trying to use?

* Groove Box works in the linuxulator the same as in Windows. The timing
is dreadful when you click "loop", but at least it's equally dreadful on
all platforms. Write once, cringe anywhere. :-)

* Groove Box does not work in the native JDK. It silently pretends to
work, and even reenables the start button after the sequence was played.
No sound, nor any exception is generated.

Pretty good, overall. I'm going to be working with audio files in Java
for a bit and I was worried I'd have to resort to using Windows. Luckily
I can use the Linux JDK and write my program. :-)

 Yours,
   Kees Jan

-----------------------------------------------------------------
 Kees Jan Koster             e-mail: kjkoster "at" kjkoster.org
                             www:       http://www.kjkoster.org/
-----------------------------------------------------------------
 you're only young once, but you can stay immature all your life

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CCC820A.25C75098>