Have you been able to solve this problem? I am in the same situation. Thank
you. This is what I am seeing:
Exception in thread "main" java.lang.IllegalArgumentException: No line
matching interface Clip supporting format PCM_SIGNED unknown sample rate,
16 bit, stereo, 4 bytes/frame, big-endian is supported. at
javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:476) at
javax.sound.sampled.AudioSystem.getClip(AudioSystem.java:520) at
org.mdpnp.helloice.Audio.play(Audio.java:46) at
org.mdpnp.helloice.HelloICE_Numeric.main(HelloICE_Numeric.java:208)
I am not sure if it has to do with Clip, AudioSystem, Mixer... Do we need
to setup anything special due to JAVA being run on BBB? Do we need to
modify */java/ejre1.7.0_45/lib/sound.properties file? If I do 'arecord -l'
at command line I see my USB audio dongle:
Exception in thread "main" java.lang.IllegalArgumentException: No line
matching interface Clip supporting format PCM_SIGNED unknown sample rate,
16 bit, stereo, 4 bytes/frame, big-endian is supported. at
javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:476) at
javax.sound.sampled.AudioSystem.getClip(AudioSystem.java:520) at
org.mdpnp.helloice.Audio.play(Audio.java:46) at
org.mdpnp.helloice.HelloICE_Numeric.main(HelloICE_Numeric.java:208)
Thank you.
On Wednesday, February 12, 2014 4:29:07 PM UTC-5, caleb frost wrote:
>
> ugh sorry. its also a beaglebone. not beaglebone black
>
> On Wednesday, February 12, 2014 3:46:22 PM UTC-5, caleb frost wrote:
>
> Hello! I have a problem thats been stumping me for a while. I'm quite new
> at developing Java and I may be in over my head with this one. Please
> forgive me if I haven't posted in the correct format of something.
>
> I am running Ubuntu 12.04 with 'lightweight x11 desktop environment' off
> of a BeagleBone Black. The Java code below is supposed to play a .wav file
> (Ive also tried switching to .mp3 with no luck) when a notification occurs.
> This all works fine on OSX but Errors out on the BeagleBone.
>
> This is my troubleshooting so far:
> I have successfully gotten the BeagleBone to make white noise through the
> terminal command
>
> speaker-test -D default:CARD=Headset
>
> I could NOT play anything using the following terminal command:
>
> mplayer -ao alsa:device=default=Headset XXX.mp3
>
> Also, I could not play anything using the built in audio player including
> the supplied .mp3. This may be irrelevant but I have also successfully
> commented out relevant java lines to avoid making any sound just so the
> program can run.
>
> Heres the code:
>
> package com.XXXXXX.ibis.notification;
> import java.io.BufferedInputStream;import java.io.IOException;import
> java.io.InputStream;import java.net.MalformedURLException;import
> java.net.URI;import java.net.URISyntaxException;import java.net.URL;import
> java.util.Timer;import java.util.TimerTask;import
> java.util.logging.Level;import javax.sound.sampled.*;import
> org.slf4j.Logger;import org.slf4j.LoggerFactory;
>
> public class AudioNotification implements INotification {
>
> /**
> *
> * @param audioURL
> * @param intervalMS
> */
> public AudioNotification(URL audioURL, int intervalMS) {
>
> m_intervalMS = intervalMS;
> m_audioURL = audioURL;
>
> }
>
> /**
> *
> * @param filename
> * @param intervalMS
> */
> public AudioNotification(String filename, int intervalMS) {
>
> m_intervalMS = intervalMS;
>
> try {
> m_audioURL = new URI(filename).toURL();
> } catch (URISyntaxException ex) {
> LOG.error("Unable to convert filename(" + filename + ") to URI",
> ex);
> } catch (MalformedURLException ex) {
> LOG.error("Unable to convert filename(" + filename + ") to URL",
> ex);
> }
>
> }
>
>
> //**************************************************************************
> //** INotification interface
> ***********************************************
>
> //**************************************************************************
> /**
> *
> * @param bActivate
> */
> @Override
> public void activate(boolean bActivate) {
> if (bActivate != isActive()) {
> if (isActive()) {
> stop();
> } else {
> try {
> start();
> } catch (InterruptedException ex) {
>
> java.util.logging.Logger.getLogger(AudioNotification.class.getName()).log(Level.SEVERE,
> null, ex);
> }
> }
> }
> } // activate
>
> /**
> *
> * @return
> */
> @Override
> public boolean isActive() {
> return (m_playTask != null);
> } // isActive
>
> /**
> *
> */
> @Override
> public void signal() {
> LOG.debug("signal()");
> } // signal
>
>
> //**************************************************************************
> //** PRIVATE METHODS
> *******************************************************
>
> //**************************************************************************
> /**
> *
> */
> private void start() throws InterruptedException {
> LOG.debug("start()");
> // start audio playback timer
> if (m_playTask == null) {
> try {
> // TODO: only play 5 times?
> m_playTask = new PlayClipTask(m_audioURL.openStream());
> long timerIntervalMS = (m_intervalMS +
> m_playTask.clipLengthMS());
> //m_timer.schedule(m_playTask, timerIntervalMS,
> timerIntervalMS);
> for (int i = 0; i < REPEAT; i++) {
> m_timer.schedule(m_playTask, timerIntervalMS);
> Thread.sleep(timerIntervalMS * SLEEP_TIME);
> m_playTask = new PlayClipTask(m_audioURL.openStream());
> }
> } catch (IOException ex) {
> LOG.warn("start(): Error creating play task", ex);
> }
> } else {
> LOG.warn("start(): Playback already in progress");
> }
> } // start
>
> /**
> *
> */
> private void stop() {
> LOG.debug("stop()");
> // cancel audio playback timer
> if (m_playTask != null) {
> m_playTask.stopPlayback();
> m_playTask.cancel();
> m_playTask = null;
> }
> } // stop
>
>
> //**************************************************************************
> //** PRIVATE CLASSES
> *******************************************************
>
> //**************************************************************************
> private class PlayClipTask extends <span style="background-colo
>
> ...
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.