java / pulseaudio question
I'm trying to run a jar file (an audio player) but get the following errors:
Exception in thread "Thread-1" java.lang.IllegalArgumentException: Master Gain not supported at org.classpath.icedtea.pulseaudio.PulseAudioLine.ge tControl(PulseAudioLine.java:89) at DSPAudio.run(DSPAudio.java:281) at java.lang.Thread.run(Thread.java:679) Is this issue likely to be a bug in the jar file, a problem with PulseAudio, or might it be solved by installing the Sun/Oracle version of java rather than open java? I seem to have:- java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) - Richard -- Richard Kimber Political Science Resources http://www.PoliticsResources.net/ -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
What command are you using to run the jar file?
On Wed, Sep 19, 2012 at 12:38 PM, R Kimber <richardkimber@btinternet.com> wrote: I'm trying to run a jar file (an audio player) but get the following errors: Exception in thread "Thread-1" java.lang.IllegalArgumentException: Master Gain not supported at org.classpath.icedtea.pulseaudio.PulseAudioLine.ge tControl(PulseAudioLine.java:89) at DSPAudio.run(DSPAudio.java:281) at java.lang.Thread.run(Thread.java:679) Is this issue likely to be a bug in the jar file, a problem with PulseAudio, or might it be solved by installing the Sun/Oracle version of java rather than open java? I seem to have:- java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) - Richard -- Richard Kimber Political Science Resources http://www.PoliticsResources.net/ -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On Wed, 19 Sep 2012 13:09:23 +0100
Kurtis Brown wrote: > What command are you using to run the jar file? java -jar AmbiophonicAudioPlayer.jar It looks OK on the screen, but it doesn't produce any sound, and you get the errors on the command line when you click on 'play', having selected a file to play. - Richard. -- Richard Kimber Political Science Resources http://www.PoliticsResources.net/ -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On 9/19/2012 4:38 AM, R Kimber wrote:
I'm trying to run a jar file (an audio player) but get the following errors: Exception in thread "Thread-1" java.lang.IllegalArgumentException: Master Gain not supported at org.classpath.icedtea.pulseaudio.PulseAudioLine.ge tControl(PulseAudioLine.java:89) at DSPAudio.run(DSPAudio.java:281) at java.lang.Thread.run(Thread.java:679) Is this issue likely to be a bug in the jar file, a problem with PulseAudio, or might it be solved by installing the Sun/Oracle version of java rather than open java? I seem to have:- java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) - Richard I think it is a bug in the code not a Java related problem. The Master Gain is a control that may not exist in PulseAudio and the program was hard coded for a control with that name. If the player isn't huge and you can send it to me I'll try it on a Sun JDK installation for you. -- Knute Johnson -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On Wed, 19 Sep 2012 20:04:09 -0700
Knute Johnson wrote: > > I think it is a bug in the code not a Java related problem. The Master > Gain is a control that may not exist in PulseAudio and the program was > hard coded for a control with that name. If the player isn't huge and > you can send it to me I'll try it on a Sun JDK installation for you. Thanks. I have a zip file that is 13999 bytes. I'll send it to you. - Richard. -- Richard Kimber Political Science Resources http://www.PoliticsResources.net/ -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
Richard:
It works fine on my Oracle (used to be Sun) JDK 7 installations under XP and Linux and on JDK 6 under XP (didn't have a 6 on Linux to try) So maybe it will work if you put a Sun JDK on your system. When I look at my Linux installation I have ALSA and that's what Java is using I think. So it could still be something to do with PulseAudio but I would certainly try loading a Sun JDK to test it. I'm including some Java code that I use to look at audio files to see if they will play under Java. import java.io.*; import javax.sound.sampled.*; public class Play { public static void main(String[] args) { class MyLineListener implements LineListener { public void update(LineEvent le) { LineEvent.Type type = le.getType(); System.out.println(type); } }; try { System.out.println("Audio File Format: " + AudioSystem.getAudioFileFormat(new File(args[0]))); AudioInputStream fis = AudioSystem.getAudioInputStream(new File(args[0])); System.out.println("Input AudioFormat: " + fis.getFormat()); AudioInputStream ais = AudioSystem.getAudioInputStream( AudioFormat.Encoding.PCM_SIGNED,fis); AudioFormat af = ais.getFormat(); System.out.println("Converted AudioFormat: " + af.toString()); int frameRate = (int)af.getFrameRate(); System.out.println("Frame Rate: " + frameRate); int frameSize = af.getFrameSize(); System.out.println("Frame Size: " + frameSize); SourceDataLine line = AudioSystem.getSourceDataLine(af); line.addLineListener(new MyLineListener()); line.open(af); int bufSize = line.getBufferSize(); System.out.println("Buffer Size: " + bufSize); line.start(); byte[] data = new byte[bufSize]; int bytesRead; while ((bytesRead = ais.read(data,0,data.length)) != -1) line.write(data,0,bytesRead); line.drain(); line.stop(); line.close(); } catch (Exception e) { System.out.println(e); } } } And this Sun program will list the audio lines, ports and controls. Sorry about the formatting, Sun's fault. /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, * modify and redistribute this software in source and binary code form, * provided that i) this copyright notice and license appear on all copies of * the software; and ii) Licensee does not utilize the software in a manner * which is disparaging to Sun. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * This software is not designed or intended for use in on-line control of * aircraft, air traffic, aircraft navigation or aircraft communications; or in * the design, construction, operation or maintenance of any nuclear * facility. Licensee represents and warrants that it will not use or * redistribute the Software for such purposes. */ import javax.sound.sampled.*; public class ListPorts { public static void main(String[] args) { Mixer.Info[] aInfos = AudioSystem.getMixerInfo(); for (int i = 0; i < aInfos.length; i++) { try { Mixer mixer = AudioSystem.getMixer(aInfos[i]); mixer.open(); try { System.out.println(aInfos[i]); printPorts(mixer, mixer.getSourceLineInfo()); printPorts(mixer, mixer.getTargetLineInfo()); } finally { mixer.close(); } } catch (Exception e) { e.printStackTrace(); } } if (aInfos.length == 0) { System.out.println("[No mixers available]"); } System.exit(0); } public static void printPorts(Mixer mixer, Line.Info[] infos) { for (int i = 0; i<infos.length; i++) { try { if (infos[i] instanceof Port.Info) { Port.Info info = (Port.Info) infos[i]; System.out.println(" Port "+info); Port port = (Port) mixer.getLine(info); port.open(); try { printControls(port.getControls()); } finally { port.close(); } } } catch (Exception e) { e.printStackTrace(); } } } public static void printControls(Control[] controls) { for (int i = 0; i<controls.length; i++) { printControl(" ", "Controls["+i+"]: ", controls[i]); } if (controls.length == 0) { System.out.println(" [no controls]"); } } static boolean balanceTested = false; public static void printControl(String indent, String id, Control control) { if (control instanceof BooleanControl) { BooleanControl ctrl = (BooleanControl) control; System.out.println(indent+id+"BooleanControl: "+ctrl); //try { // Thread.sleep(500); // ctrl.setValue(!ctrl.getValue()); // Thread.sleep(500); // ctrl.setValue(!ctrl.getValue()); //} catch (Exception e) {} } else if (control instanceof CompoundControl) { CompoundControl ctrl = (CompoundControl) control; Control[] ctrls = ctrl.getMemberControls(); System.out.println(indent+id+"CompoundControl: "+control); for (int i=0; i<ctrls.length; i++) { printControl(indent+" ", "MemberControls["+i+"]: ", ctrls[i]); } } else if (control instanceof EnumControl) { EnumControl ctrl = (EnumControl) control; Object[] values = ctrl.getValues(); Object value = ctrl.getValue(); System.out.println(indent+id+"EnumControl: "+control); for (int i=0; i<values.length; i++) { if (values[i] instanceof Control) { printControl(indent+" ", "Values["+i+"]:"+ ((values[i]==value)?"*":""), (Control) values[i]); } else { System.out.println(indent+" Values["+i+"]:"+ ((values[i]==value)?"*":"")+values[i]); } } } else if (control instanceof FloatControl) { FloatControl ctrl = (FloatControl) control; System.out.println(indent+id+"FloatControl: "+ctrl); //try { // Thread.sleep(500); // float x = ctrl.getValue(); // ctrl.setValue((float) (Math.random()*(ctrl.getMaximum() - // ctrl.getMinimum()) + ctrl.getMinimum())); // Thread.sleep(1000); // ctrl.setValue(x); //} catch (Exception e) {} //if (ctrl.getType() == // FloatControl.Type.BALANCE && !balanceTested) { // balanceTested = true; // for (float y = -1.0f; y<=1.0f; y+=0.02) { // ctrl.setValue(y); // System.out.println(" Set to "+y); // System.out.println(" res"+ctrl.getValue()); // } //} } else { System.out.println(indent+id+"Control: "+control); } } } -- Knute Johnson -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On 09/19/2012 07:38 AM, R Kimber wrote:
I'm trying to run a jar file (an audio player) but get the following errors: Exception in thread "Thread-1" java.lang.IllegalArgumentException: Master Gain not supported at org.classpath.icedtea.pulseaudio.PulseAudioLine.ge tControl(PulseAudioLine.java:89) at DSPAudio.run(DSPAudio.java:281) at java.lang.Thread.run(Thread.java:679) Is this issue likely to be a bug in the jar file, a problem with PulseAudio, or might it be solved by installing the Sun/Oracle version of java rather than open java? I seem to have:- java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) Try running this with your present java install http://www.oracle.com/technetwork/java/javasounddemo-140014.html If it doesn't work you might try either Openjdk version 7 or Oracle java. That's what I use and have no problems running sound files. Installing Oracle Java 7 with this works a charm, as getting all of the alternatives set is a beast of a chore. http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html Ric -- My father, Victor Moore (Vic) used to say: "There are two Great Sins in the world... ..the Sin of Ignorance, and the Sin of Stupidity. Only the former may be overcome." R.I.P. Dad. http://linuxcounter.net/user/44256.html -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On 09/19/2012 08:46 AM, R Kimber wrote:
On Wed, 19 Sep 2012 13:09:23 +0100 Kurtis Brown wrote: What command are you using to run the jar file? java -jar AmbiophonicAudioPlayer.jar It looks OK on the screen, but it doesn't produce any sound, and you get the errors on the command line when you click on 'play', having selected a file to play. You might open pavucontrol to see what audio device is in use at the time you issue your command. Just have the play tab open. Running that sound demo will also set your java preferences up correctly when you first run it. It's worked for me when I was having problems with audio and Java. Ric -- My father, Victor Moore (Vic) used to say: "There are two Great Sins in the world... ..the Sin of Ignorance, and the Sin of Stupidity. Only the former may be overcome." R.I.P. Dad. http://linuxcounter.net/user/44256.html -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On 09/19/2012 11:04 PM, Knute Johnson wrote:
On 9/19/2012 4:38 AM, R Kimber wrote: I'm trying to run a jar file (an audio player) but get the following errors: Exception in thread "Thread-1" java.lang.IllegalArgumentException: Master Gain not supported at org.classpath.icedtea.pulseaudio.PulseAudioLine.ge tControl(PulseAudioLine.java:89) at DSPAudio.run(DSPAudio.java:281) at java.lang.Thread.run(Thread.java:679) Is this issue likely to be a bug in the jar file, a problem with PulseAudio, or might it be solved by installing the Sun/Oracle version of java rather than open java? I seem to have:- java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) - Richard I think it is a bug in the code not a Java related problem. The Master Gain is a control that may not exist in PulseAudio and the program was hard coded for a control with that name. If the player isn't huge and you can send it to me I'll try it on a Sun JDK installation for you. I'd like to try it too! Ric -- My father, Victor Moore (Vic) used to say: "There are two Great Sins in the world... ..the Sin of Ignorance, and the Sin of Stupidity. Only the former may be overcome." R.I.P. Dad. http://linuxcounter.net/user/44256.html -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
java / pulseaudio question
On Thu, 20 Sep 2012 18:15:13 -0700
Knute Johnson wrote: > Richard: > > It works fine on my Oracle (used to be Sun) JDK 7 installations under XP > and Linux and on JDK 6 under XP (didn't have a 6 on Linux to try) So > maybe it will work if you put a Sun JDK on your system. When I look at > my Linux installation I have ALSA and that's what Java is using I think. > So it could still be something to do with PulseAudio but I would > certainly try loading a Sun JDK to test it. I'm including some Java > code that I use to look at audio files to see if they will play under > Java. Knute: Many thanks for your help on this. I removed the openjdk and installed the Sun/Oracle JDK 7 and it is now working fine. It's a pity that Ubuntu doesn't use this version. I've also discovered something else that doesn't work with openjdk but is fine with Sun/Oracle. - Richard. -- Richard Kimber Political Science Resources http://www.PoliticsResources.net/ -- ubuntu-users mailing list ubuntu-users@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users |
| All times are GMT. The time now is 07:43 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.