Playing a .wav file loaded from filesystem

I am trying to play a local file and getting:
Have not been able to load: MediaError: media unsupported:com.sun.media.jmc.MediaUnsupportedException: Unsupported media: file:///product-name/lib/buzzer.wav
I get a different exception if the file does not exist, so the message seems to be saying it has a problem with .wav files, or this .wav file in particular??
I am using 1.3, but this page is for 1.2:
http://download.oracle.com/javafx/1.2/tutorials/media/format.html
There doesn't seem to be an equivalent page for 1.3. If 1.2 rules still applied then for Audio on Vista the resolution under 'Supported Media Codecs' is "All the audio formats supported by Windows Media Player". And [this file|http://www.strandz.org/javafxstreaming/buzzer.wav] certainly works on Windows Media Player.
package def alarmSoundPlayer = MediaPlayer
    media: makeFilesystemMedia( "file:///product-name/lib/buzzer.wav");
    autoPlay: false;
    repeatCount: 1;   
public function makeFilesystemMedia( fileName: String): Media
    var music = Media
        source: fileName
        onError: function( mediaError: MediaError)
            println( "Have not been able to load: {mediaError}");
    return music;
}

It might not be the issue, but the file:///product-name/lib/buzzer.wav is strange. Aren't you missing a drive specification? (might not be necessary if on the same disk, but still unusual). Is the "product-name" at the root of the disk? When in doubt of URL syntax, you can still use a path to initialize a File object, then get toURI().toURL() to have a normalized URL.
HTH.

Similar Messages

  • Subsequent play of WAV files from HTTP

    Hi,
    I have to subsequently play many WAV files from HTTP in a nokia series 60 emulator.
    Everything is ok for the first two files, but at the third I catch an exception:
    "java.io.IOException: exceeded the configured maximum number of connections"
    I tried two ways to load the files from HTTP:
    Manager.CreatePlayer(InputStream...)
    Manager.CreatePlayer("http:\\...")
    Below there is the code of the two methods I use. Please note that I try in every way to close the connection before open a new one!!!
    public void Method_1(String src, String type){
    int iLen=0;
    is = null;
    httpCon = null;
    byte[] bBuf;
    try {
    if (p != null) {
    if (p.getState() == Player.STARTED) {
    p.stop();
    p.removePlayerListener(this);
    p.deallocate();
    p.close();
    p=null;
    if (is!=null){
    is.close();
    is=null;
    if (httpCon!=null){
    httpCon.close();
    httpCon=null;
    httpCon = (HttpConnection) Connector.open(src);
    if (httpCon.getResponseCode() != HttpConnection.HTTP_OK) {
    System.out.println("Bad response code");
    return;
    System.out.println("Connection OK! (audio)");
    iLen = (int) httpCon.getLength();
    System.out.println("audio file length : " + iLen);
    is = httpCon.openInputStream();
    p = Manager.createPlayer(is, type);
    p.addPlayerListener(this);
    p.setLoopCount(1);
    p.prefetch();
    p.start();
    vc = (VolumeControl)p.getControl("VolumeControl");
    catch (MediaException ex) {
    ex.printStackTrace();
    catch (IOException ex) {
    ex.printStackTrace();
    public void Method_2(String src){
    try {
    if (p!=null){
    if (p.getState() == Player.STARTED)
    p.stop();
    p.deallocate();
    p.close();
    p=null;
    p = Manager.createPlayer(src);
    p.addPlayerListener(this);
    p.setLoopCount(1);
    p.start();
    vc = (VolumeControl)p.getControl("VolumeControl");
    catch (java.io.IOException e) {
    e.printStackTrace();
    catch (MediaException e) {
    e.printStackTrace();

    My question is:
    how can I load (from a HTTP server) and play more than two WAV files without crashing?
    Do I have to close the connection in a better way in order to re-open it without problems (and more than two times)?
    It is simply an emulator bug?
    Thanks.

  • Playing a .wav file from email attachment

    I am trying to play a .wav file that is attached to an email, and i get "The document conversion failed". Am I missing something? What do I need to do to be able to play .wav files that are sent to me via email?

    I have the same request.
    We have a new Panasonic phone system that sends out .wav voicemail files.
    Our company's Curve's play the wav fine.
    Our company's BOLDs ... DO NOT.

  • Playing a wav file (byte array) using JMF

    Hi,
    I want to play a wav file in form of a byte array using JMF. I have 2 classes, MyDataSource and MyPullBufferStream. MyDataSource class is inherited from PullStreamDataSource, and MyPullBufferStream is derived from PullBufferStream. When I run the following piece of code, I got an error saying "EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9108b2, pid=3800, tid=1111". Any idea what might be the problem? Thanks.
    File file = new File(filename);
    byte[] data = FileUtils.readFileToByteArray(file);
    MyDataSource ds = new MyDataSource(data);
    ds.connect();
    try
        player = Manager.createPlayer(ds);
    catch (NoPlayerException e)
        e.printStackTrace();
    if (player != null)
         this.filename = filename;
         JMFrame jmframe = new JMFrame(player, filename);
        desktop.add(jmframe);
    import java.io.IOException;
    import javax.media.Time;
    import javax.media.protocol.PullBufferDataSource;
    import javax.media.protocol.PullBufferStream;
    public class MyDataSource extends PullBufferDataSource
        protected Object[] controls = new Object[0];
        protected boolean started = false;
        protected String contentType = "raw";
        protected boolean connected = false;
        protected Time duration = DURATION_UNKNOWN;
        protected PullBufferStream[] streams = null;
        protected PullBufferStream stream = null;
        protected final byte[] data;
        public MyDataSource(final byte[] data)
            this.data = data;
        public String getContentType()
            if (!connected)
                System.err.println("Error: DataSource not connected");
                return null;
            return contentType;
        public void connect() throws IOException
            if (connected)
                return;
            stream = new MyPullBufferStream(data);
            streams = new MyPullBufferStream[1];
            streams[0] = this.stream;
            connected = true;
        public void disconnect()
            try
                if (started)
                    stop();
            catch (IOException e)
            connected = false;
        public void start() throws IOException
            // we need to throw error if connect() has not been called
            if (!connected)
                throw new java.lang.Error(
                        "DataSource must be connected before it can be started");
            if (started)
                return;
            started = true;
        public void stop() throws IOException
            if (!connected || !started)
                return;
            started = false;
        public Object[] getControls()
            return controls;
        public Object getControl(String controlType)
            try
                Class cls = Class.forName(controlType);
                Object cs[] = getControls();
                for (int i = 0; i < cs.length; i++)
                    if (cls.isInstance(cs))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Time getDuration()
    return duration;
    public PullBufferStream[] getStreams()
    if (streams == null)
    streams = new MyPullBufferStream[1];
    stream = streams[0] = new MyPullBufferStream(data);
    return streams;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.media.Buffer;
    import javax.media.Control;
    import javax.media.Format;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.PullBufferStream;
    public class MyPullBufferStream implements PullBufferStream
    private static final int BLOCK_SIZE = 500;
    protected final ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW);
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM_MS, 8000.0, 8, 1,
    Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
    Format.byteArray);
    private int seqNo = 0;
    private final byte[] data;
    private final ByteArrayInputStream bais;
    protected Control[] controls = new Control[0];
    public MyPullBufferStream(final byte[] data)
    this.data = data;
    bais = new ByteArrayInputStream(data);
    public Format getFormat()
    return audioFormat;
    public void read(Buffer buffer) throws IOException
    synchronized (this)
    Object outdata = buffer.getData();
    if (outdata == null || !(outdata.getClass() == Format.byteArray)
    || ((byte[]) outdata).length < BLOCK_SIZE)
    outdata = new byte[BLOCK_SIZE];
    buffer.setData(outdata);
    byte[] data = (byte[])buffer.getData();
    int bytes = bais.read(data);
    buffer.setData(data);
    buffer.setFormat(audioFormat);
    buffer.setTimeStamp(System.currentTimeMillis());
    buffer.setSequenceNumber(seqNo);
    buffer.setLength(BLOCK_SIZE);
    buffer.setFlags(0);
    buffer.setHeader(null);
    seqNo++;
    public boolean willReadBlock()
    return bais.available() > 0;
    public boolean endOfStream()
    return willReadBlock();
    public ContentDescriptor getContentDescriptor()
    return cd;
    public long getContentLength()
    return (long)data.length;
    public Object getControl(String controlType)
    try
    Class cls = Class.forName(controlType);
    Object cs[] = getControls();
    for (int i = 0; i < cs.length; i++)
    if (cls.isInstance(cs[i]))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Object[] getControls()
    return controls;

    Here's some additional information. After making the following changes to MyPullBufferStream class, I can play a wav file with gsm-ms encoding with one issue: the wav file is played many times faster.
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM, 8000.0, 8, 1,
                Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
                Format.byteArray);
    // put the entire byte array into the buffer in one shot instead of
    // giving a portion of it multiple times
    public void read(Buffer buffer) throws IOException
            synchronized (this)
                Object outdata = buffer.getData();
                if (outdata == null || !(outdata.getClass() == Format.byteArray)
                        || ((byte[]) outdata).length < BLOCK_SIZE)
                    outdata = new byte[BLOCK_SIZE];
                    buffer.setData(outdata);
                buffer.setLength(this.data.length);
                buffer.setOffset(0);
                buffer.setFormat(audioFormat);
                buffer.setData(this.data);
                seqNo++;
        }

  • Need Help playing a wav file on PDA

    Does anyone have a SIMPLE example of playing a wav file on a PDA using LabView PDA. The only working example I can find from NI "Advance Sound Example for LabVIEW PDA for Pocket PC" is a jumbled of confusing functionality. I'm mainly looking for a simple "play" example, but a simple "record" example would be helpful also.
    Thanks - Bruce

    Hello,
    Well, I looked through the example code I tried to break it down to the point where you could create a simple Play VI. Unfortunately, I don't have the PDA target, so I'm uncertain if the little example that I have attached will run or not. If not, I also took a screen shot so you can see what VIs I used. I'm pretty sure I only used VI's that I found on the example itself.
    Good luck.
    Attachments:
    Play_Wav_PDA.vi ‏55 KB
    Play_Wav_PDA.bmp ‏1029 KB

  • How to play a wave file through the DAQ board?

    Hi there,
    we want to play a wave file that is saved on the harddrive via the DAQ board. Means we want to connect a amp to the analog output of the DAQ to amplify the sound and play it through a speaker.
    We couldn't find any VI that does that. Can anybody tell us how to play a wave file, or perhaps even send us a VI that can do that?
    Thanks a lot for your help
    Martin - Physical Optics Corporation

    Hi Martin,
    The only example that I could find on how to do this was using our
    older Traditional DAQ drivers version 6.9.3.  If you're using Traditional
    DAQ drivers, the vi can be found here. 
    The example reads a 8-bit mono .wav file (an example .wav file is included in the .zip file) and writes it to the analog out of your DAQ card.  I've updated the
    example to work with our newer DAQmx drivers and attached it here.  
    I hope this helps,
    Paul C.
    Message Edited by Paul C. on 08-14-2007 05:47 PM
    Attachments:
    daqmx_wav_file_to_ao_output.zip ‏27 KB

  • I just want to know what Apple computer to get to play Civilization V down loaded from the App store.

    I just want to know what Apple computer to get to play Civilization V down loaded from the App store.
    The game Civ5 processes a turn in single core mode. It says “please wait” while it processes a turn. If the intel i7 CPU is “fourth generation” it is twice as fast for civ5 turn processing. It does not matter if you have more memory or a better graphics chip. So, I can get a smaller cheeper Apple computer as long as it is fourth generation. I tested three new iMacs, two new MacPros and two mac minis.
    See:
    http://apolyton.net/showthread.php/193302-Civ-5-Processor-performance-analyzis-a t-Gamespot
    I have looked at that darned “please wait” message for years. Now it can be 60 seconds on a new MacPro6,1 or late 2012 Mac mini and 30 seconds on a new iMac. Even the 21.5 iMac 3.1 GHz has 3.9 GHz turbo boost for single core and it is supposed to be fourth generation.
    Some of that does not seem to true for the new 21.5 inch iMac I just tested (Fusion drive). Mac Mini 54 seconds 21.5 iMac 49 seconds.
      Cliff Nelson

    Legality aside (I'm not a lawyer and have no opinion on the matter) in order to make a purchase of an iPhone 5 you would need to travel to a country where they are for sale and purchase it there. Be sure to get one that is officially unlocked or you would not be able to use it with your cell carrier. Be sure that your carrier supports use of the iPhone before you buy. Also note that the warranty of the iPhone is only valid in the country of purchase.
    Appe does not ship outside of the countries where it sells the phones.

  • Why cant I play embeded wave files in firefox but I can in explorer?

    I just embedded a wave file (Godsmack Voodoo) for my website & saved it but when I goto run teh intro no sound, But explorer plays it no problems? What is wrong with Firefox 9.01 & playing the embedded sounds?

    Can you post a link to a public page?
    Which code are you using to play that WAV file?

  • Playing a WAVE file after making a phone call.

    Hi everyone..
    I'm trying to play a wav file after making a phone call. I was able to make the call. But I get an exception when i try to paly a wav file..
    Can any one tell me where I've gone wrong..
    This is the code which plays the audio file..(I downloaded it by the way.. and it's working fine when used as a seperate program)
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.FloatControl;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.UnsupportedAudioFileException;
    public class PlayWave extends Thread {
         private String filename;
         private Position curPosition;
    //30000000(7324.21 kb)
         private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb
         enum Position {
              LEFT, RIGHT, NORMAL
         public PlayWave(String wavfile) {
              filename = wavfile;
              curPosition = Position.NORMAL;
         public PlayWave(String wavfile, Position p) {
              filename = wavfile;
              curPosition = p;
         public void run() {
              File soundFile = new File(filename);
              if (!soundFile.exists()) {
                   System.err.println("Wave file not found: " + filename);
                   return;
              AudioInputStream audioInputStream = null;
              try {
                   audioInputStream = AudioSystem.getAudioInputStream(soundFile);
              } catch (UnsupportedAudioFileException e1) {
                   e1.printStackTrace();
                   return;
              } catch (IOException e1) {
                   e1.printStackTrace();
                   return;
              AudioFormat format = audioInputStream.getFormat();
              SourceDataLine auline = null;
              DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
              try {
                   auline = (SourceDataLine) AudioSystem.getLine(info);
                   auline.open(format);
              } catch (LineUnavailableException e) {
                   e.printStackTrace();
                   return;
              } catch (Exception e) {
                   e.printStackTrace();
                   return;
              if (auline.isControlSupported(FloatControl.Type.PAN)) {
         FloatControl pan = (FloatControl) auline.getControl(FloatControl.Type.PAN);
                   if (curPosition == Position.RIGHT)
                        pan.setValue(1.0f);
                   else if (curPosition == Position.LEFT)
                        pan.setValue(-1.0f);
              auline.start();
              int nBytesRead = 0;
              byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
              try {
                   while (nBytesRead != -1) {
              nBytesRead = audioInputStream.read(abData, 0, abData.length);
              if (nBytesRead >= 0)
                   auline.write(abData, 0, nBytesRead);
              } catch (IOException e) {
                   e.printStackTrace();
                   return;
              } finally {
                   auline.drain();
                   auline.close();
         }I inserted
    new PlayWave("greeting.wav").start();In to a method an called this method in the program where i send commands to the modem.
    These are my modem commands
    send("ATZ");
        expect("OK");
    //Enable voice mode
        send("AT+FCLASS=8");
        expect("OK");
    //Dial the number
        send("ATDT"+number);
        expect("OK");
    //Choose encoding method //This is the default
        send("AT+VSM=140,8000,0,0");
        expect("OK");
    // start sending audio data
        send("AT+VTX");
        expect("OK");
    PlayAudio();
    send("ATH");The size of my audio file is 100 kb.I'm using a 56 K intel externel voice modem connected to a serial port.I wonder if it's because the buffer is too big. If anyone tried this and succeded please correct me.
    Thankyou in advance
    goodnews

    Hi goodnews!
    Did I understand well? Can You record the speech? This is what I want!
    Can you help me and send me sample code?
    This would be a big help for me!
    Thank You!
    rflair

  • Play a wav file once

    how do I play a wav file just once using the play sound
    file.vi. i keep getting it to repeat over and over
    thanks

    First may I recommend some reading here. This is not meant to be cocky just to help you.  
    Getting Started with NI LabVIEW Student Training
    LabVIEW101
    Second I have included sort of template. Notice the wire that ends in the while loop. This will ensure that the wav is played before the loop starts.
    Good luck with your Labview labwork
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    play wav file[2].vi ‏9 KB

  • How do I play the .wav file google mail sends me on my Iphone 5?

    I have cable phone service that sends out a .wav file of any voicemails I recieve to my e-mail account.  I use google mail on my Iphone, and cannot play the .wav file that is attached to that e-mail.  When I click on the "audio message box", it brings up a circle containing a south-west facing arrow which has a slash through it. 

    I have the latest software (6.1.4) and I can play the attachment if I go through "Mail" instead of "GMail".  I am still not certain why I have a widget called "Mail". 
    Inside the "Mail" app, there are it's own Inbox, VIP, Flagged, etc which are all in color.  Further down the list is my GMail boxes and sub-boxes.  They are all grayed out, but still funtional.
    Do I have something set up wrong causing me to be unable to play the .wav files that come to me through gmail?

  • 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.)

  • Play a .wav file fractional

    hi,
    i´m looking for a solution to play a .wav file.
    the special what i need is, that i want to jump to concrete points on the timeline.
    or can i seperate the timeline of a .wav file?
    martin

    Hi Martin
    this could help you starting. For the case you can't open LV 8.2- VIs, i attach the BD- picture.
    greets, Dave
    Message Edited by daveTW on 06-14-2007 10:26 AM
    Greets, Dave
    Attachments:
    play sound part_FP.png ‏10 KB
    play sound part.vi ‏50 KB

  • How to play DTS wav files on hd from sounblasterplay

    Hello,
    I've got many wav files on my harddisk. They are dts wav files.
    On cd-rom they play with software player soundblaster, no problem.
    But when i play them by harddisk there is no dts sound.
    What must i do to play them?
    greetings

    forgotten to say it is a X-fi music card
    thanks

  • Play music files loaded from pc

    Hi all, is it possible to play music files copied over from a pc ? I have transferred music files over from pc which was ok but cannot work out how to play them! I am unable to find anything on my iphone to play them. They were copied from Real player. Can anyone help with this please?
    Sam xx

    By design, the iphone will sync itunes content with ONE computer at a time. ANY attempt to sync such content with a second computer will result in ALL itunes content being first deleted from your phone & then replaced with the content from the second computer. This is a design feature and cannot be overridden.
    You need to decide what computer you want to sync itunes content with & stick with that computer.

Maybe you are looking for

  • Backing up KM Folders via Portal Drive

    Hi Experts, We've implemented Netweaver Portal 7.0 with SP14 for a local company. Company migrated all shared folders from filesystem into KM via Portal Drive. Portal is running on a VMWARE machine with Linux OS. Followings are common questions, when

  • Port Scan is shooting blanks

    I am finding it painful to set up VPN so any help anyone can give would be real generous. I have been trying to connect to a VPN to tunnel L2TP via IPsec over port 1701 and PPTP over port 1723 but having no joy at all. Macbook (10.5.6) uses mobile br

  • How to close a row in a Sales Order?

    Hi , How can i close a row in a sales order , I can do it in the purchase order, but in the sales order if i have two or more items of which i need to close one, i cannot do so as it gives an error. SAP version used 2005B PL41. Jyoti

  • ICS - Live With Walkman - Can't connect USB in MSC (Mass Storage) mode

    Hi Guys n Girls, I recently updated my LWW to ICS and I can't for the life of me get the phone connect to my PC in MSC, mass storage mode. Can anyone help? Thank you.

  • Volumes stay mounted after quitting Kanaka without logout

    Hi, this is with Kanaka 2.7 on Mac OSX 10.7.5. Our students have the unfortunate habit of quitting the Kanaka client without clicking on its Logout button. This has for consequence that the previous student's resources remain mounted on the desktop.