Having problem storing incoming MU-LAW to PMC WAV file

Hi,
I am able to receive ULAW/rtp, 8000.0 Hz, 8-bit, Mono stream and play it using the Player class. What I need to do is to store the stream data into WAV file. I have followed the JMF tutorial to set the output file format. I can also create the WAV file no problem. But when I try to play the gnerated WAV file using Windows Media Player, it says : Windows Media Player cannot play the file. The Player might not support the fle type or might not support the codec that was used to compress the file.
Does anyone know what is wrong with my code?
I am attaching the code below:
stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
DataSource ds = stream.getDataSource();
// Find out the formats.
RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
if (ctl != null){
System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
} else
System.err.println(" - Recevied new RTP stream");
if (participant == null)
System.err.println(" The sender of this stream had yet to be identified.");
else {
System.err.println(" The stream comes from: " + participant.getCNAME());
synchronized (dataSync) {
dataReceived = true;
dataSync.notifyAll();
ProcessorModel model = new ProcessorModel(ds,new Format[]{ }, new FileTypeDescriptor(FileTypeDescriptor.WAVE));
Processor processor = Manager.createRealizedProcessor(model);
boolean result = waitForState(processor, Processor.Configured);
if (result == false)
System.out.println("process is not configured");
TrackControl[] tracks = processor.getTrackControls();
if (tracks == null || tracks.length < 1)
System.out.println( "Couldn't find tracks in processor");
Format supported[];
Format chosen = null;
boolean atLeastOneTrack = false;
for (int i = 0; i < tracks.length; i++)
Format format = tracks.getFormat();
if (tracks[i].isEnabled())
supported = tracks[i].getSupportedFormats();
// Here we choose the ULAW format ...
if (supported.length > 0)
for(int k=0; k<supported.length; k++)
if(supported[k] instanceof AudioFormat)
String encoding = supported[k].getEncoding();
System.out.println("encoding = " + encoding);
if(encoding.indexOf("LINEAR") != -1)
chosen = supported[k];
break;
tracks[i].setFormat(chosen);
//tracks[i].setFormat(new AudioFormat(AudioFormat.LINEAR,8000,16,1));
System.err.println("Track " + i + " is set to transmit as: " + tracks[i].getFormat());
atLeastOneTrack = true;
} else
tracks[i].setEnabled(false);
} else
tracks[i].setEnabled(false);
if (!atLeastOneTrack)
System.out.println( "Couldn't set any of the tracks to a valid RTP format");
// create a player by passing datasource to the Media Manager
result = waitForState(processor, Controller.Realized);
if (result == false)
System.out.println( "Couldn't realize processor");
MediaLocator dest = new MediaLocator("file://c:\\tmp\\dddd.wav");
DataSink sink = Manager.createDataSink(processor.getDataOutput(), dest);
sink.open();
sink.start();
processor.start();
Thread.sleep(5000);
processor.stop();
sink.stop();
sink.close();
System.out.println("sink close");
Thank you very much in advance for all your help.
JB

outraspace wrote:
Hi,
I am able to receive ULAW/rtp, 8000.0 Hz, 8-bit, Mono stream and play it using the Player class. What I need to do is to store the stream data into WAV file. I have followed the JMF tutorial to set the output file format. I can also create the WAV file no problem. But when I try to play the gnerated WAV file using Windows Media Player, it says : Windows Media Player cannot play the file. The Player might not support the fle type or might not support the codec that was used to compress the file.
Does anyone know what is wrong with my code? Lots of things. As tbm pointed out, don't use a processor model. Use create a regular processor, and then create a ContentDescriptor object with all of the formatting you want, and set that on the Processor.
In your code "Here we choose the ULAW format", it doesn't appear that you're chosing ULAW. It appears you're chosing linear encoding. ULaw isn't linear, it's logarithmic, so certainly that's not the right format.
In the examples I've seen, the processor is started before the DataSink is started. You're doing this in reverse.
If you plan to configure a processor, do not get a realized one. That's like say "I'd like some ice cream", going out and buying ice-cream sandwiches and scraping out the ice cream...
You should disable all of the tracks except the ones you want data from. That means if it's not an audio format, you'll want to go ahead and disable it.
Without nitpicking anymore, I have no idea where your sample code came from, but it seems pretty useless. The best idea would be to take your code, delete it, and start over with the following code:
[http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/RTPExport.java]

Similar Messages

  • I have CS4 Ilustrator and am having problems with gradient banding. I'm ripping files through Wasatch 6.7 to a Roland SC-540 printer.

    I have CS4 Ilustrator and am having problems with gradient banding. I'm ripping files through Wasatch 6.7 to a Roland SC-540 printer. Is there a fix for this? Please let me know, I have been asking here for a few days here and no answers yet? Josh

    I have CS4 Ilustrator and am having problems with gradient banding. I'm ripping files through Wasatch 6.7 to a Roland SC-540 printer. Is there a fix for this? Please let me know, I have been asking here for a few days here and no answers yet? Josh

  • Having problem storing movies on ipod

    they are the right format and all, but when i drag the movie on the ipod icon in itunes, it seems like its gonna work...but then nothing happens. It just started doing this for cetain videos i D/L. like 2 outta 3 in the past few hours. am i screwing something up, can someone help me plz

    You have to search the web for software that will convert your DVDs.
    Maybe go check in the iPod video forums
    http://discussions.apple.com/forum.jspa?forumID=808
    Best of luck!

  • Still having problems storing bytes...

    Ok, I tried using the Util.CopyArray and CopyArrayNonAtomic methods with the following arguments:
    Util.CopyArrayNonAtomic(buffer, ISO7816_CDATA, first, (short)0, byteRead);
    I am still receiving the same error and I'm sure that it must be from this section. This is the code that I use for my method that writes data:
    byte[] buffer = apdu.getBuffer();
    byte numBytes = buffer[ISO7816.OFFSET_LC];
    byte byteRead = (byte)(apdu.setIncomingAndReceive());
    if (numBytes != byteRead){
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
    Util.CopyArrayNonAtomic(buffer, ISO7816_CDATA, first, (short)0, byteRead);
    I'm wondering if it's possible for me to use a for loop as I had originally intended since this method isn't working?

    Allocate memory for first byte array.
    Also check the return value on the CopyArray..() method.

  • Having problem with Unable to find "Adobe PDF" resource files

    Hello
    I have Adobe Acrobat XI PRO (11.0.05) and using MS Office 2010 on my Windows XP SP3.
    I've read about this issue.
    "Unable to find PDFMaker resource files error shows up for Microsoft Word when Acrobat XI
    is installed with Acrobat X Standard already on the same machine. If the user repairs
    or even uninstalls Acrobat XI, then the same error shows up for Acrobat X Standard also.
    The user must repair Acrobat X Standard in order for PDFMaker to work with it again. [3327895]"
    But i don't have Acrobat X installed anymore also I didn't encountered this problem when i was using a lower version of Acrobat XI can't remember what exact version.
    Repair Mode works but only temporary once i shutdown my laptop and boot-up then create a pdf the error returns again so yeah i once again run the Repair Mode to in-order for me to create PDF's
    What should i do?
    Any help would be geatly appreciated

    Hi RazzMaTazz007 ,
    You might want to refer to the discussion on the thread : http://forums.adobe.com/message/4781497#4781497

  • Having problem in execution of MY SQL DB Script File

    Hi everybody !
    I'm trying to execute My SQL's script file using JDBC's execute method. But I'm getting some exceptions and unable to create tables.
    SAMPLE CODE
    =============
    stat.execute(str_dbScript);
    Note: The script is running fine from My SQL's native console as well as from query analyzer. I'm using JDK1.5.0.10 and My SQL 5.x.
    EXCEPTION
    ==========
    com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE Customer2 (
             CustomerID INT NOT NULL PRIMARY KEY,
           ' at line 9
         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)
         at com.mysql.jdbc.Statement.execute(Statement.java:692)SAMPLE DB CODE
    ===============
    CREATE TABLE Customer1 (
             CustomerID INT NOT NULL PRIMARY KEY,
             FirstName VARCHAR(20) NOT NULL,
             LastName VARCHAR(20),
             PhoneNo INT,
             Address VARCHAR(100)
    CREATE TABLE Customer2 (
             CustomerID INT NOT NULL PRIMARY KEY,
             FirstName VARCHAR(20) NOT NULL,
             LastName VARCHAR(20),
             PhoneNo INT,
             Address VARCHAR(100)
           )

    Actually I'm working on an server side web application, which can be configured with Oracle, SQL Server and My SQL using respective databse script file. For example I'm running three individual web applications of same type but with different dbs. So as we know that the separator in Oracle is "\" in MySQL it is ";" and in SQL Server it is "GO". So I think, I have to read the separator accordingly and then divide these lines into separate SQL queries.
    KS

  • Help !  Having problem with program that converts .pdf to .doc file

    I just purchased the program that converts a pdf file to a docx or doc file and it worked fine.   the form looks great BUT when i tried to use it tonight, the first line typed just find.   After that letters are typing over other letters and the space bar does not work...  what could i be doing wrong or does this producct not work?

    I don't think this is a Adobe program, or is it?  What's the name of the program?

  • Having problems importing and viewing any kind of video file in iTunes 7

    I just cannot seem to be able to do this. I have tried dragging and dropping files into iTues and importing files and whole folders of videos but nothing happens. Do video files have to be Quicktime format to be viewed in iTunes and if so does Quicktime Pro have a tool that converts other file formats to be viewed in Quicktime?
    I would be really grateful if anyone can help with this.
    James

    See Repair security permissions for iTunes for Windows and for the future see Backup your iTunes for Windows library with SyncToy.
    tt2

  • Problems with incoming emails

    After going through tons of support discussions and trying all that i could i would like to ask your help guys.
    As header suggests im having problems with incoming emails on mac mail (4.6)  (outgoing mails are working perfectly)
    Yesterday evening i noticed that i cant receive emails (wheel just kept spinning without downloading anything but webmail and my phone mail app show that there are tons of unread emails)
    Today around 10AM it worked for second (after messing around with settings (which i did not touched again) but when came back from lunch --- ***** not working again)
    I checked that i have correct incoming & outgoing server names, correct passwords and all other settings like SSL (port995) are ok.
    Confirmed from my Email Service Provider that their servers, my quota etc are working propperly
    Mac mail Connection doctor does not show any red lights so it is ok
    Someone said that "unable to load" can be caused by "corrupted" email and i should Rebuild my mailbox to see if if might show what message is f*** up. => did that and it just stays in "Fetching new email" and below reads "preparing to retrieve messages"   and again nothing.
    I tried to make new account in Mac mail client and it is not helping ... same thing  Nothing.
    I tried to install thunderbird and create new account in there, got it to work for first time i tried but result was the same ... it only downloaded some messages and stopped working.
    Previously when i used to launch mac mail app on my laptop it always asked "do you want to connect to this server bla bla bla" => click ok and it downloaded everything but now i dont even get that pop-up message. (i think it disappeared after making account in thunderbird client and clicking "always trust" which did not help as it is still not downloading) 
    I would really appreciate your help cos im going mad with this problem and i cant get any help from my ESP
    PS. im using POP settings.
    Thank you in advance!
    Jimi

    Just remembered that i took printscreen from thunderbirds error when first attempted to set up new account. And now when looking at this it is the same message that i got every time when launching mac mail client. But as said this error went away after clicking "allways trust" (it does show my ESP name and due date is sept.2013")
    And error message was
    "Mail cant varify the identity of "autodiscover."mydomain"......".
    The certificate for this server is invalid. You might be connecting to a server that is pretending to be "autodiscover....." 
    Jimi

  • Indesign CS6 on MACs with OS 10.8 are having problems with links

    Hi
    Indesign CS6 on MACs with 10.8 are having problems with links. All links to other files have to be updated when opening a file although definitely nothing has changed to the linked files.
    We can rule out our company's networking and the system hosting the files (HELIOS software on RedHat Linux VM). This happens with newly created Indesign files and with old ones. E.g. we create a file on Tuesday, save it and open it again on the exact same MAC on Wednesday and all links to other fiels (.indd, .png, .bmp, etc. nothing uncommon) have to be updated as they all show the yellow triangle + black exclamation mark symbol next to them. Has anybody else experienced this, What can we do? We have tried absolutley everything and updated all software from MAC OS to CS6 itself but nothing seems to help on the long run.
    Any further information required?
    M. Miller

    Thanks for your quick reply.
    We actually noticed that there also seems to be something wrong with the timestamps:
    If we open the infos via the MAC finder to a file (.psd e.g.) which is linked in one of our indesign files, it states a certain date of creation.
    If we then switch to the Indesign file we just opened in which we had to update all links and open the infos to exactly the same file we looked at in the finder, a different date of creation is stated. So there also seems to be a mistake here (hope it's clear what I mean).
    We are ruling out our network as the error cannot be "re-enacted". We have created numerous test files in Indesign (simple white page containing one link to a .psd file which is also used in one of the supposedly defective files) and have opened them on various MACs with various OS versions over the past days/weeks but unfortunately the files open without any notifications or errors.
    Just as a background: a few months ago, the problem seemed to occur between MACs with differing OS, 10.6 - 10.8 at first. A file which was created on a 10.6 MAC could not be opened without updating all links on a 10.8 MAC. That is why we updated everything to 10.8. The error did not occur for about 2-3 weeks but then reoccured again.?
    Have you heard anything similar?

  • Having problems extracting/convert Adobe Reader Pdf files to Adobe Digital Reader files.

    I am currently having problems trying to convert my Adobe Acrobat PDF file to and Adobe Digital Reader File.
    o

    What kind of problems?

  • HI, I am having trouble when importing .wav files into logic.

    Everytime I import this .wav file of a DJ set i recorded, it shows me the waveform but no sound comes out when its played. I have tried converting the bitrate to 16bit and the filetype to aiff as I saw it had helped people with similar problems but when i do this its boosts the gain massivly and the recrding becomes very distored? Really dont know what to try??
    Also the reason I am trying to get the Wav in was bevause i need to normalise it as it had to be recorded very quitely to avoid distortion on the recording. I recorded it by using the imput on the back of my monitors as they are usb, and th programme i used to record it is "audio recorder tool" from the app store
    Thanks for your help, Joe

    I think the problem is you're recorded 32-bit wav files which Logic doesn't support.
    (don't convert to aiff, unless you have the right program, that understands converting little endian 32 bit wavs to big endian aiff format, you will get distortion)
    I think your best bet is to download "Audacity" the free audio editor and convert to 24-bit WAV files. Re-save the audio file under a different name after converting. In Audacity this is done using the Export function, selecting other non-compressed formats.
    http://audacity.sourceforge.net/download/mac
    The reason you want 24-bit WAVs to work with is you're going to be raising the volume of the file, 24-bit files will suffer less damage when editing with plugins, normalizing...etc.

  • Problem with an import of .wav files

    Hello everyone,
    I have a very annoying problem when I try to import a wave file: FCP doesn't respect the length of the audio file. It stretches it!
    The audio file is the final mix of my film which lasts 59min25sec.
    Exported from ProTools, the Finder sees the file as 59min25sec, idem for QuickTime Player 7. Everything is normal.
    When I import it in Final Cut, it sees it as 59min21sec Stretched...
    Help !

    Thanks for your answers!
    @ darbypsnm and 2reverb
    It's a stereo 48KHz 24bit file. I did a try with a 48KHz 16bit version: same problem...
    I can read it on the specs that show me Final Cut and when I place the sound file on the timeline of my editing, a progressive desync happens.
    @ Michael Grenadier
    Ok I will check this but I think I've already done it...
    I'm not sure it's a matter of frame rate because 4 seconds of length difference on a 1 hour film is not enough for a 25fps/30fps misunderstanding...
    I'll do some further tests based on all your advises. Thanks again!

  • Having problem with storing data in array

    Hi,
    I'm having problem on storing data in array. My problem is that each time it loops, the array just keep overwrite instead save to the next index. Like at 0 the value is 123, and 1 is 234. But i having that all data capture all overwrite at 0 till the last data it still show at 0. How do i correct this problem?
    Solved!
    Go to Solution.

    How to use array to do comparison? Like Array 1 go thru array 2 to get data Loss out and build an array. Like Array 1 ,1000,1024,1048,etc before 1520 fall in between Array 2 range 1000-1500. So Freq 1000,1024,1048 etc will get Loss value as 1 and 1520 fall in between 1500-2000 will output Loss 2. and so on till the end of the list. How should do this? Need help on this.
    Array 1                                                Array 2
    Freq                                              ​     Freq   Loss
    1000                                              ​    1000      1
    1024                                              ​    1500      2
    1048                                              ​    2000      3
    1100                                              ​     :
    1200                                              ​     :
    :                                                 ​        18000
    1520
    18000

  • Hi Can anyone help. I'm having problem with FaceTime on my IPAD .It connects but cuts out Simolarly when someone calls me it connects , then cuts out ThanksBrian

    Hi Having problem with FACETIME on my IPAD Connects to call but then cuts out , similarly calls in connect &amp; cut out Can someone help. Brian

    My ipad is doing the same thing to it won't let me except a incoming call on Facebook and I don't know what to do

Maybe you are looking for