Javax.sound

Hi There..
i think i'm the only person in the world with this problem...
i have dowloaded the latest version of Java for windows (j2sdk-1_4_1_02-windows-i586) but i can't find the javax.sound library...
heaps of other javax libraries are there (security, accessability,swing etc..), i don't understand what i am doing wrong... i thought it was supposed to be included after vers 3.
please help!!
Keith

Have a look in the j2sdkblahdiblah/jre/lib directory
There should be a large jar file called rt.jar
all the runtime classes including javax.sound are in there.

Similar Messages

  • Javax.sound missing with Fedora Core 3 linux's java compiler?

    I'm running Fedora core 3, and I did a complete install(selected all the packeges). I have the java compiler that FC3 installed. I can compile most things, but I seem to be missing the sound package/folder.
    This leads to an error when I try to import the sound libraries.
    //start code
    //simple non-working example
    import javax.sound.*;
    class sounds
    //end code
    results in the error "The import javax.sound cannot be resolved"
    I am trying to run a code snippet from javaAlmanac, and of course it won't work. Today, a friend of mine had the exact same problem on a windows machine using JDK 1.5.
    I'm going to test this code out on a windows machine also.
    Are there issues with the FC3 java compiler?
    Has anyone else run into and solved this issue?
    I'm considering copying the sound folder from some other Java installation, anyone try this?
    Thanks,

    I'm pretty new at this myself. I've also installed Fedora Core 3 on an AMD 64. When I do the same uname - a I get:
    Linux localhost.localdomain 2.6.9-1.667 #1 Tue Nov 2 14:50:10 EST 2004 x86_64 x8 6_64 x86_64 GNU/Linux
    Maybe you didn't install as 64 bit ?
    I've also successfully installed Jave Runtime Environment. java -version gets me:
    java version "1.4.2_08"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode)
    I'd suggest installing 32 bit. I can't tell the difference when I run programmes that use 64 or 32 bits - it will be just as good.
    Eurostar

  • Where is the javax sound package for download?

    Where is the javax sound package for download? (URL) I got the latest JDK yesterday and tried to compile some audio applet but it looks like all of the Javax stuff is missing from the latest JDK.
    Where do I download the javax sound package ?
    Dan

    This is an audio player that another posted here. I tried to compile and run it but here were the results.
    javac SimplePlayerApplet.javaSimplePlayerApplet.java:9: package javax.media does not exist
    import javax.media.*;
    ^
    SimplePlayerApplet.java:11: cannot find symbol
    symbol: class ControllerListener
    public class SimplePlayerApplet extends Applet implements ControllerListener {
    ^
    SimplePlayerApplet.java:14: cannot find symbol
    symbol : class Player
    location: class SimplePlayerApplet
    Player player = null;
    ^
    SimplePlayerApplet.java:122: cannot find symbol
    symbol : class ControllerEvent
    location: class SimplePlayerApplet
    public synchronized void controllerUpdate(ControllerEvent event) {
    ^
    SimplePlayerApplet.java:44: cannot find symbol
    symbol : class MediaLocator
    location: class SimplePlayerApplet
              MediaLocator mrl = null;
              ^
    SimplePlayerApplet.java:63: cannot find symbol
    symbol : class MediaLocator
    location: class SimplePlayerApplet
              if ((mrl = new MediaLocator(mediaFile)) == null)
              ^
    SimplePlayerApplet.java:68: cannot find symbol
    symbol : variable Manager
    location: class SimplePlayerApplet
                        player = Manager.createPlayer(mrl);
                        ^
    SimplePlayerApplet.java:69: cannot find symbol
    symbol : class NoPlayerException
    location: class SimplePlayerApplet
              } catch (NoPlayerException e) {
              ^
    SimplePlayerApplet.java:130: cannot find symbol
    symbol : class RealizeCompleteEvent
    location: class SimplePlayerApplet
         if (event instanceof RealizeCompleteEvent) {
         ^
    SimplePlayerApplet.java:165: cannot find symbol
    symbol : class CachingControlEvent
    location: class SimplePlayerApplet
         } else if (event instanceof CachingControlEvent) {
         ^
    SimplePlayerApplet.java:166: cannot find symbol
    symbol : variable Controller
    location: class SimplePlayerApplet
         if (player.getState() > Controller.Realizing)
         ^
    SimplePlayerApplet.java:170: cannot find symbol
    symbol : class CachingControlEvent
    location: class SimplePlayerApplet
         CachingControlEvent e = (CachingControlEvent) event;
         ^
    SimplePlayerApplet.java:170: cannot find symbol
    symbol : class CachingControlEvent
    location: class SimplePlayerApplet
         CachingControlEvent e = (CachingControlEvent) event;
         ^
    SimplePlayerApplet.java:171: cannot find symbol
    symbol : class CachingControl
    location: class SimplePlayerApplet
         CachingControl cc = e.getCachingControl();
         ^
    SimplePlayerApplet.java:181: cannot find symbol
    symbol : class EndOfMediaEvent
    location: class SimplePlayerApplet
         } else if (event instanceof EndOfMediaEvent) {
         ^
    SimplePlayerApplet.java:184: cannot find symbol
    symbol : class Time
    location: class SimplePlayerApplet
         player.setMediaTime(new Time(0));
         ^
    SimplePlayerApplet.java:186: cannot find symbol
    symbol : class ControllerErrorEvent
    location: class SimplePlayerApplet
         } else if (event instanceof ControllerErrorEvent) {
         ^
    SimplePlayerApplet.java:189: cannot find symbol
    symbol : class ControllerErrorEvent
    location: class SimplePlayerApplet
         Fatal(((ControllerErrorEvent)event).getMessage());
         ^
    SimplePlayerApplet.java:190: cannot find symbol
    symbol : class ControllerClosedEvent
    location: class SimplePlayerApplet
    } else if (event instanceof ControllerClosedEvent) {
    ^
    19 errors
    So what am I missing ...and where do I get it ??
    Dan

  • Author       "javax.sound.midi.InvalidMidiDataException: cannot get soundbank from stream" after java update

    Not sure where to post this issue.
    I am noticing this error since I did the Mac update. The Mac update included the java update. Right now the java version is 1.6.0_31. My Mac OS X version is 10.7.3. I am seeing the problem for all the soundfont files that I am trying to load. The error i get is.
    javax.sound.midi.InvalidMidiDataException: cannot get soundbank from stream
         at javax.sound.midi.MidiSystem.getSoundbank(MidiSystem.java:565)
         at myPackage.MyMusicApp.main(MyMusicApp.java:14)
    Below is a small program I built that shows the code.
    package myPackage;
    import java.io.File;
    import javax.sound.midi.*;
    public class MyMusicApp {
        public static void main(String[] args) {
            try {
                Synthesizer synth = MidiSystem.getSynthesizer(); synth.open();
                File f =  new File("/Users/poorav/eclipseGIT/myApp/soundbanks/1247_KitDRY.sf2");
                Soundbank soundbank = MidiSystem.getSoundbank( f);
                synth.loadAllInstruments(soundbank);
            } catch (Exception e)
                e.printStackTrace();
    I am not sure what the previous build of java I was on, but i know that it was a 1.6 version. Any ideas of what could have caused this?
    thanks

    No satisfactory progress!
    I submitted a bug for this using the Apple bug reporter on 9th April (#11208868) and despite asking for an update, it has been completely ignored (even now). I'm not impressed.
    I then issued a (paid for) Developer Technical Support issue which was credited back to my account a few days later with no explanation. When I asked why, I eventually got: "At this time DTS does not provide code-level support for Java"!
    So, Apple are assuming to responsibility for this problem. I realise that Oracle is mostly responsible for Java but Apple took this crippled version (how much testing did they do?) and updated our customers' machines with it. This has effectively disabled a key feature of our product and has cost us damage to our company's reputation. Still Apple don't care and they rely on the fact that we are too small to sue them. You can see I'm not happy! I naively thought Apple would make some attempt to assist their developers.

  • How to play a wav file to LINE_OUT with javax.sound.sampled

    Hello all,
    I need to play a wav file to LINE_OUT port, but not to the SPEAKER. I am trying to do this under window NT. For some reason I get false for isLineSupported(Port.Info.LINE_OUT). I am new to javax.sound so I might be doing something wrong. Here is the code that I am using to iterate through all availible mixers and check if LINE_OUT is supported by any of them:
    Mixer.Info[] mixers = AudioSystem.getMixerInfo();
    for(int i = 0; i < mixers.length; i++){
    Mixer mixer = AudioSystem.getMixer(mixers);
    if (mixer.isLineSupported(Port.Info.LINE_OUT)) {
    System.out.println("the port is supported");
    try {
    Port line = (Port) AudioSystem.getLine(
    Port.Info.LINE_OUT);
    catch(Exception ex){
    ex.printStackTrace();
    else{
    System.out.println("the port is not supported");
    Please help

    The new bugID of the request to implement Ports is: 4558938.
    (If you voted for the old bug id: 4504642, be sure to change your votes to this new bug report since the old one was closed as a duplicate of the new one.)

  • Javax.sound.midi and external synths?

    Since I don't have a USB-to-MIDI adapter (and I lost my MIDI cables long ago), I gotta just ask: if I had an external MIDI device connected to my computer, would javax.sound.midi.getMidiDeviceInfo() theoretically return a MidiDevice object describing it? Or is javax.sound.midi really just for the computer's own music synthesizer?
    --Chris (invalidname)

    see bug 4356787. MIDI for external devices is broken.
    Add it to your bug parade votes. Let's get Sun to
    address this.will do... not like they're going to fix my other favorite bug (4119391 - RMI in real-world networks)
    Thanks.
    --Chris

  • Record my voice using JAVAX.sound

    I want to record my voice using the javax.sound.
    Can you please give if there shortest path..
    I see javax.sound.sampled.AudioSystem
    But the sampled is confusing me.. is it a beta version and need to be developed further?
    After recording, I am interested to parse the voice.

    Hmm interesting ones, I've never programmed sound using Java myself, but have you looked at http://docs.oracle.com/javase/6/docs/technotes/guides/sound/programmer_guide/contents.html ? It seems like a good doco to get started

  • Best practices for using javax.sound.sampled.Clip?

    I've got a very simple Swing-based puzzle game. When the user performs certain actions, I want to play a trivial little sound. So far, I'm using the Java Sound API (javax.sound.sampled). When the actionPerformed method is called, my model is updated, which triggers an event in the same thread, and one of the listeners, plays a sound like this:
    this.clip.setFramePosition(0);
    this.clip.start()The clip had been previously initialized like this:
              InputStream in = null;
              AudioInputStream ain = null;
              Clip tempClip = null;
              try {
                   in = BubblePopSound.class.getResourceAsStream("pop2.wav");
                   ain = AudioSystem.getAudioInputStream(in);
                   try {
                        DataLine.Info info = new DataLine.Info(Clip.class, ain
                                  .getFormat());
                        tempClip = (Clip) AudioSystem.getLine(info);
                        tempClip.open(ain);
                   finally {
                        ain.close();
              catch(UnsupportedAudioFileException uafe) {
                   // TODO Log that sound own't be played
              catch(LineUnavailableException lue) {
                   // TODO Log that sound own't be played
              catch(IOException ioe) {
                   throw new RuntimeException("IOException reading sound clip", ioe);
              finally {
                   if(ain != null) try {
                        ain.close();
                   catch(IOException ioe) {}
                   if(in != null) try {
                        in.close();
                   catch(IOException ioe) {}
              this.clip = tempClip;So my goal was to load the clip once, and be able to trigger the playing of it repeatedly. Hoever, it only works intermittently. Reading through the http://www.jsresources.org site, the Java Sound homepage, forums, etc. I feel like I don't truly understand the best way to play simple audio clips like this. These questions are still lingering:
    - When I call clip.start(), does it play in the current thread, or am I triggering something to start the playing independent of the thread?
    - Do I need to call stop explicitly?
    - What if the user triggers the sound again before it has finished playing?
    - Do I need to close the clip with the playing has stopped, or is it ok to keep it "open" so its ready to play again and again?
    - If I can keep it open, do I need to worry about cleaning it up later?

    If your sound file is < 1 second long and you are using the JDK/JRE 1.5.0 (pre _02 update I think) then the sound code is bugged and is likely the cause of the sound problem. Try updating your JRE/JDK to 1.5.0_03 and try the sound again. If that's not it I can't help.
    - When I call clip.start(), does it play in the current thread, or am I triggering something to start the playing independent of the thread?Not quite sure, but it doesn't seem to be interrupted when I start playing a sound and sleep the thread. It might buffer the sound data in the sound card or it might use a different thread. (Interesting to know if someone has that knowledge...)
    - Do I need to call stop explicitly?No.
    - What if the user triggers the sound again before it has finished playing?It should play the new sound as well (but when many are going some might be cut off. It functions adequately for my game (check out Javoids on sourceforge -- need latest JRE or JDK).
    - Do I need to close the clip with the playing has stopped, or is it ok to keep it "open" so its ready to play again and again?Don't bother. Use this instead "clip.setFramePosition(0);"
    - If I can keep it open, do I need to worry about cleaning it up later?Java is garbage collected so you rarely have to be worried about that. No.

  • Where's javax.sound

    Hi
    i've downloaded j2se 1.4.1 but when i try to import javax.sound.* it says it can't find it. Do i need to import anything else eg java.lang or what? I'm pretty sure its not an optional package.
    Please help me

    You aren't easily distracted from a set opinion, huh?
    You got the same answer from me in that thread:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=32
    334
    You'd have to return to your thread to notice,
    though,
    instead of posting a new one...
    I really appreciate your help docjekill, but even when i specify
    javax.sound.midi
    javax.sound.midi.spi
    javax.sound.sampled
    javax.sound.sampled.spi
    all of these i still get the same error.
    I've looked in scr.zip and found other packages, eg javax.swing etc, but no sound packages. Is the download incomplete or did it just stuff up?

  • Where is javax.sound?

    Compiler tells me it doesn't exist, even when setting classpath as follows:
    C:\JDK\bin\javac -classpath C:\JDK\JRC\lib\rt.jar soundApp.java ...
    I have version 1.4.1.

    How old is this application you are trying to use, or how old is the code if you are getting it from another source?
    1.3 through 1.4.1 use javax.sound.midi, javax.sound.midi.spi, javax.sound.sampled, and javax.sound.sampled.spi.
    They dont try to import javax.sound in and of themselves. This may be an old program written back when javax.sound stuff wasnt included in the API and was a part of the Java Media Framework.
    Of course, I could be totally wrong here (as I havent done anything with sound stuff in Java in quite a while.)
    Just a thought.

  • Javax.sound compare to javax.media in term of GUI

    I messed around with javax.sound these few days and my emotions have been running up and down. I was happy that i could play mp3 on my software but after i decided to move on, i found out its impossible for me to obtain the length if i'm going to stream, and mp3 files are just too huge for clips to handle. this costs me a problem in doing the GUI for my software (one like winamp, windows media player, etc, etc)
    I thinking of dropping javax.sound and moving into javax.media in hope for a much better version of sound handling. Anyone have any suggestion? or fix for my problem? I need help.
    Thanks in advance,
    KhinBoon

    You may feel disappointed if you do so, I'm afraid.
    I first tried the newly published mp3 codec for JMF.
    It seems that it doesn't work on my RedHat Linux Advance Server3 update2.
    On the other hand, I can play mpeg1 file over Internet using http protocol.
    And I can also play mp3 file on another Wndows XP.
    But the player can't realize when playing an mp3 file over the Internet.
    I think that there's still a long way to go for JMF.

  • Playing big AudioInputStream whit javax.sound.sampled

    Hello!.
    I've a problem, I've a big AudioInputStream (retrieved from DataBase), and when I try play It with Clip throws this Exception:
    javax.sound.sampled.LineUnavailableException: Failed to allocate clip data: Requested buffer too large.
         at com.sun.media.sound.MixerClip.implOpen(MixerClip.java:536)
         at com.sun.media.sound.MixerClip.open(MixerClip.java:161)
         at com.sun.media.sound.MixerClip.open(MixerClip.java:249)
         at ClipPlayer.<init>(ClipPlayer.java:138)
         at ClipPlayer.main(ClipPlayer.java:192)
    Help Me please, friends.
    Thank's.

    Is funny, but I now know what's the problem.
    For play big AudioInputStream exists a interface in sampled package for play this files. This interface is SourceDataLine. The next code solve the problem:
    AudioInputStream audio=DataBase.retrieveAudioInputStream();
    AudioFormat af=DataBase.retrieveAudioFormat(); // This need's for
    // reconstruct the audiofile
    DataLine.Info datalineinfo=new DataLine.Info(SourceDataLine.class,af);
    try
    if (AudioSystem.ifLineSupported(datalineinfo))
    SourceDataLine source=(SourceDataLine) AudioSystem.getLine (datalineinfo);
    int total=audio.available();
    source.open(af);
    int buffersize=source.getBufferSize();
    byte [] data=new byte[buffersize];
    source.start();
    int read=buffersize;
    //Well, now play!!!
    while (read<total)
    read=audio.read(data,0,data.length);
    if (read==-1) break; //End of audiostream.
    source.write(data,0,read);
    else
    System.err.println("DataLine not supported");
    catch (.....)
    Handle exceptions....
    That's all rigth.!!

  • Capturing the output of a javax.sound.midi.Synthesizer

    Hallo,
    since i can�t convert a MIDI-Sequence to a WAV-File directly, i want to play back the Sequence and capture the sound somewhere "between" the sound-generating synthesizer and the speakers. As far as i understand, i have to obtain a TargetDataLine from an output mixer, so i can read the sound data, since ports aren�t implemented yet. My problem is: How can i obtain such a TargetDataLine?
    With something like
    info = new DataLine.Info(TargetDataLine.class, format);
    line = (TargetDataLine)AudioSystem.getLine(info);
    i get a line to capture microphone input.
    i managed to get a mixer that is opened and started, when the synthesizer is opened, but that mixer only provides com.sun.media.sound.MixerSourceLines.
    Any help will be greatly appreciated.

    Not a reply, I'm afraid.
    I want to combine Midi output with audio output, which is exactly the same question as this thread. The whole thrust of Java sound is to 'unify' Midi and Audio, and yet I've fallen at the first hurdle.
    This thread was opened in Nov last year, yet is still unanswered. Is this right?

  • Erratic sound playback using Clip (javax.sound.samled)

    Hi,
    I have recently delved into writing an application with sound using Scala. Sound does play but seems rather unreliable across systems. For instance, only the long sounds are audible on my Ubuntu 9.04 system (OpenJDK 6b14-1.4.1-0ubuntu11). Interestingly on my windows PC running Vista Home with Sun JRE (build 6.1.0_15-b3) only the short sounds are audible and the longer sounds are cut off.
    Before reporting bugs at OpenJDK and Sun respectively I would like to know if there is anything that I need to pay extra attention to. My programs "play" method is as follows:
    Tuple2 sound = audioResources(name)
    Clip clip = AudioSystem.getLine(sound.getInfo()).asInstanceOf[Clip]
    AudioInputStream stream = AudioSystem.getAudioInputStream(new ByteArrayInputStream(sound sound.getByteArray()))
    clip.open(stream)
    clip.start()Have adapted my code from Scala to Java somewhat. I am assuming that clip.start() works asynchronously. Hope can give me some pointers on how to get this to work correctly.
    Best,
    Dirk Louwers

    Well, that's kind of a weird way of doing that... I would have done...
    Clip c = AudioSystem.getClip();
    AudioInputStream stream = AudioSystem.getAudioInputStream(new ByteArrayInputStream(sound sound.getByteArray()));
    clip.open(stream);
    clip.start();Anyway, clip.start() does work asyncronously, so you'll want to make sure your program isn't terminating before the clip has time to play.

  • Javax.sound.sampled - Writie PCM audio samples to an AIFF file?

    Greetings,
    I've been going at this for awhile and seem to be stuck.
    I'm importing data from an old system that stored audio recordings in raw PCM. I can easily use a Clip object to convert that PCM into a DataLine (Clip) object and play it.
    Now I need to write out that audio data as an AIFF file (actually I need to capture it and store it in a database, but the AIFF file format seems like a good, portable, format).
    To write a file using AudioSystem.write() you need an AudioInputStream. To create an AudioInputStream you need a TargetDataLine. However, I can see no direct way of creating a TargetDataLine that can be populated with raw data.
    Reading the documention (I know, it's a bad habit), it seems like what I needed to do is get a mixer, create a SourceDataLine with my data, then pump the SourceDataLine with the audio samples. The mixer would do nothing but pass the data on to the TargetDataLine where it would be captured and written to disk. Here's my code:
    public void writeAIFF( OutputStream out ) throws IOException
    try
    // First, find a mixer (we assume it will be a software mixer) that can provide us with
    // both source and target datalines that can handle the desired format.
    AudioFormat format = getAudioFormat(); // This is the format of our data
    DataLine.Info sourceInfoRequest = new DataLine.Info(SourceDataLine.class,format);
    DataLine.Info targetInfoRequest = new DataLine.Info(TargetDataLine.class,format);
    Mixer ourMixer = null;
    // Get all of the available mixers
    Mixer.Info[] info = AudioSystem.getMixerInfo();
    for (int i=0; i<info.length; i++)
    Mixer mixer = AudioSystem.getMixer(info);
    if (mixer.isLineSupported(sourceInfoRequest) && mixer.isLineSupported(targetInfoRequest))
    ourMixer = mixer;
    break;
    if (ourMixer==null)
    throw (new IOException("can't obtain audio components"));
    // Get the source and target lines from the mixer
    SourceDataLine sourceLine = (SourceDataLine)ourMixer.getLine(sourceInfoRequest);
    TargetDataLine targetLine = (TargetDataLine)ourMixer.getLine(targetInfoRequest);
    AudioInputStream targetStream = new AudioInputStream(targetLine);
    // Load up the source line with the data
    sourceLine.open(format);
    sourceLine.write(samples,0,samples.length);
    // Write our data out as an AIFF file
    AudioSystem.write(targetStream,AudioFileFormat.Type.AIFF,out);
    // So what happens to all of these lines and mixers when we're done?
    catch ( LineUnavailableException noline )
    throw (new IOException("audio line unavailable: "+noline.getMessage()));
    My problem is that the code never finds a mixer. The statement (mixer.isLineSupported(sourceInfoRequest) && mixer.isLineSupported(targetInfoRequest)) is always false.
    So here's my question (finally): Am I going about this the right way? My other thought is just to create my own TargetDataLine object and populate it with the data myself.
    Any thoughts or suggestions?
    P.S. I hope this is the right place for this question -- this is the first time I've used this forum
    P.P.S. Java 1.3.1 (MacOS X and Windows 2000)

    Solved -
    This was way over engineered! Overlooked in my reading was a constructor for an AudioInputStream that can use any input stream as it's source.
    This was all I needed:
         AudioFormat format = getOurAudioFormat();               // Get the format of our audio data
         AudioInputStream targetStream = new AudioInputStream(new ByteArrayInputStream(samples),format,samples.length);
         AudioSystem.write(targetStream,AudioFileFormat.Type.AIFF,out);

Maybe you are looking for

  • If I buy an unlocked iphone 5 in the United States I will have warranty in Brazil?

    i want to know if ibuy an unlocked iphone 5 in the united states i will have warranty in brazil?

  • PIR with account assignment

    I added a MTO account assignment E and the sales order line for the planned independent requirements in the additional data of MD61. But I could not find the requirements in MD04. Can anyone tell me how to maintain a PIR for MTO? I expect the PIR can

  • HELP! *URGENT* something wrong, can't see mail or preferences.....

    I launch mail and can see the menu bar (top) but no inbox, outbox, anything. Same thing with preferences - can see menu but no options. Have trashed plist of preferences and mail and still does not work. Can't try creating a new user as when I use th

  • C# load xml to datagridview by attribute

    Hi guys, i have the following XML file. <?xml version="1.0" encoding="utf-8" ?> <DEALS> <DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones"> <ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">

  • X200 CPU reaches 100 celsius degrees. is this normal?

    I'm using LenovoThinkVantage Toolbox to do a CPU stress test and and the same time I'm running TPFanControl to monitor the speed of the fan and the temperature of the CPU. When I run the CPU stress test the temperature of the CPU reaches 100 degrees