How to convert  Wav file  in to byte array an vise vers into RMS???????????

hi Constantinos Loizou
i m having same problem which u were facing in last month.
my problem i have to save .WAV file into RMS and then retreive it from RMS.
my Code is
Read From RMS
RecordStore rsUser = RecordStore.openRecordStore(file,true);
if(rsUser.getNumRecords() > 0)
try {
byte[] byusrinfo = rsUser.getRecord(1);
InputStream in = new ByteArrayInputStream(byusrinfo,0,byusrinfo.length);
p = Manager.createPlayer(in,"audio/x-wav");
p.start();
return true;
catch(Exception ex) {
ex.printStackTrace();
return false;
rsUser.closeRecordStore();
catch(Exception ex) {
ex.printStackTrace();
return false;
Write in RMS
try {
RecordStore rsUser = RecordStore.openRecordStore(file,true);
int idata = is.available();
byte[] exdata = new byte[idata];
is.read(exdata);
if(rsUser.getNumRecords() > 0) {
rsUser.setRecord(1,exdata,0,exdata.length);
else {
rsUser.addRecord(exdata,0,exdata.length);
rsUser.closeRecordStore();
catch(Exception ex) {
ex.printStackTrace ();
now i have the file successfully when i retrieve it from RMS and p.reliaze() give me exception
javax.microedition.media.MediaException: Failed to realize Player: Malformed wave media: expected 'RIFF'
have u able to solve it. if yes then pls give me solution. or give other solution if this soution is not good
regardz
Hassan Mushtaq

Well, I'm not going to give you your code on a silver platter. You'll need to put some effort in it yourself.
So look at that available() method yourself an see if you can improve on that. Look at the api docs, there is loads of information there, and often it will give you pointers on why things are not working.

Similar Messages

  • Urgent How to convert wav files into mp3?

    Can anyone plz tell me how can i convert wav file into mp3 using JMF? tell me any sample programme, any method in JMF........ help me plz

    Examples could be found on the JMF Solutions page.
    Only I can say about mp3 through network - it's hardly possible. I recommend GSM for compression2transmit. It could be used via GSM content descriptor. I'm not sure, but I suppose MP3 is supported only for files, there's no MP3.RTP or such (if you want to transmit files, it should not cause any problems).
    About JavaSound - it does not matter... You still need JMF to be installed on Client, and AppletCapture to be enabled. Futrher - would it be DirectSound, JavaSound, or anything else - just the deal of JMF.
    I tried to use JavaSound capture with proceeding AudioInputStream to JMF, but failed to do this.
    About your problem - best solution seems like that:
    capture sound
    put it into processor
    set format to GSM
    transmit
    so then, server receives it and formats it as it likes.
    If you want to transmit exactly files, you should use just some of pure java after capturing. java.net, or such thing.

  • How to convert wav file to play on a cd player

    I have wav files I recorded using my digital recorder.  I want to convert and then burn to a CD so they will play on a standard CD player that doesn't accept mp3 or wav files.  How do I do this?

    You want to burn a data CD? Use Finder. Just insert your CD and open it in Finder. Drag in the files you want and click Burn.

  • How to convert a Image object to byte Array?

    Who can tell me, how to convert Image object to byte Array?
    Example:
    public byte[] convertImage(Image img) {
    byte[] b = new byte...........
    return b;

    Hello,
    any way would suit me, I just need a way to convert Image or BufferedImage to a byte[], so that I can save them. Actually I need to save both jpg and gif files without using any 3rd party classes. Please help me out.
    thanx and best wishes

  • How to convert an Image to a byte array?

    I want to make a screenshot and then convert the image to a byte of arrays so I can send it through a BufferedOutputStream.
    try
                   robot = new Robot();
                   screenshot = robot.createScreenCapture(new Rectangle(500,500));
                   imageFile = new File("image.png");
                   ImageInputStream iis = ImageIO.createImageInputStream(screenshot);
                   byte[] data = new byte[1024];
                   byte[] tmp = new byte[0];
                   byte[] myArrayImage = new byte[0];
                   int len = 0;
                   int total = 0;
                   while((len = iis.read(data)) != -1 ) // LINE 52 --- EXCEPTION CATCHED HERE
                        total += len;
                        tmp = myArrayImage;
                        myArrayImage = new byte[total];
                        System.arraycopy(tmp,0,myArrayImage,0,tmp.length);
                        System.arraycopy(data,0,myArrayImage,tmp.length,len);
                   ios.close();I get this exception while running:
    Exception in thread "Thread-0" java.lang.NullPointerException
    at Server.run(Server.java:52)
    at java.lang.Thread.run(Unknown Source)

    Fixed that. I got a new problem.
    When I connect to my simple server application that reads the image file, converts it to an array of bytes and sends it back, the file is created on the client side and it containts data, but I am not able to open the image. I have checked that the image that the server is sending is working. So where is the problem?
    The client application recieves the image as following:
    public void run()
            try
                socket = new Socket("127.0.0.1", 2000);
                BufferedOutputStream out_file = new BufferedOutputStream(new FileOutputStream("recieved_img.png"));
                BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                int inputLine;
                while((inputLine = in.read()) != -1)
                    char c = (char)inputLine;
                    System.out.println(c);
                    out_file.write(inputLine);
            catch(IOException err){ err.printStackTrace(); }
        }And the server sends the image like this;
    try
              socket = server.accept();
              in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
              out = new BufferedOutputStream(socket.getOutputStream());
              out.write(25);
              while((inputLine = in.readLine()) != null)
                   System.out.println(myArrayImage.length);
              System.out.println(inputLine);
                        out.write(myArrayImage);     // Send the array of bytes
         }

  • How to convert the record stored iin byte array to integers

    im making a simple game in j2me and i want to get the max scores and show it for each player , what i face right now that i cant convert the records which i stored in bytes to integers when i read it from file to get the max.
    thanks

    have a look at java.io.DataInputStream

  • How to convert .caf files to WAV, MP3, WMA etc

    I use QuickVoice free app on my ipad2 to record memos. I’ve just found out how to convert the files and play them on my Windows computer. First I used this program call QuickVoice Sync to copy my recording on my computer, used this link:
    www.nFinityInc.com/QuickVoiceSyncWin.exe   - for Windows
    www.nFinityInc.com/QuickVoiceSyncMac.zip   - for Mac users
    to download QuickVoice Sync onto your computer. Open the program up and it firsts asks you to backup your files, which I did through iTunes and iCloud just incase. Then I clicked import, the program then searched for my recording and copy them into a new folder in my documents called QuickVoice. My recording in the folder were .caf files which I couldn't open in Windows so I used a program called Audacity. Use this link to download:
    http://audacity.sourceforge.net/download/
    I downloaded the program and opened up one of my .caf files my clicking 'file', then 'open' in Audacity. When the files was opened I clicked 'file' again then clicked 'export' to convert my .caf file to WAV file for example. You can change the type of file my scrolling through the different types of files available by clicking the box next to 'save as type', I chose 'WAV (Microsoft) 16bit PCM' then click save. You can also change where you save the file by clicking another location before you click 'save'.
    I can now play these files in Windows Media Player on my computer or playing them in my QuickVoice app on my ipad2.
    Hope this helps, if there are any questions please ask and I will try to answer the best I can. I figured this out myself and I’m not a big pro in computers so I will do my best to answer any quires.

    Try "Easy CAF Converter for Logic Pro" on the Mac App Store.
    According to an app description,
    "The Easy CAF Converter for Logic Pro automatically converts Apple Loops installed with Logic Pro 9 and X to uncompressed audio formats (aiff and wave).
    With the Easy CAF Converter for Logic Pro, musicians using other major DAWs (e.g., Cubase, ProTools, Ableton Live, and Studio One, etc.) can now easily use the rich set of apple loops of Logic Pro in their music productions."
    App Store location:
    https://itunes.apple.com/us/app/easy-caf-converter-for-logic/id851083620?l=ko&ls =1&mt=12

  • How to get the file size (in bytes) for all files in a directory?

    How to get the file size (in bytes) for all files in a directory?
    The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
    Furthermore the size is not retrieved correctly.
    How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
    Thank you
    Peter
    java.io.File f = new java.io.File("D:/todo/");
    files = f.list();
    for (int i = 0; i < files.length; i++) {
    System.out.println("fn=" + files);
    if (new File(files[i]).isFile())
         System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }

    pstein wrote:
    ...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
    Here is an SSCCE.
    import java.io.File;
    class ListFiles {
        public static void main(String[] args) {
            java.io.File f = new java.io.File("/media/disk");
            // provides only the file names, not the path/name!
            //String[] files = f.list();
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                System.out.println("fn=" + files);
    if (files[i].isFile()) {
    System.out.println(
    "file[" +
    i +
    "]=" +
    files[i] +
    " size=" +
    (files[i]).length() );
    }Edit 1:
    Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting.   To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.  It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
    Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to converting WMV files?

    How to converting WMV files from PC to iPod playable files? thanks for all your help

    I just found this tip on allexperts.com...
    I'm on a windows box at work, so I cant verify the accuracy.
    I have one at home...name escapes me right now...icon is a blue square with 5 black dots (like on a die). It converts audio formats, video formats, extracts audio from video, and will batch process.
    Maybe someone will recognize the desciption and be able to name it.
    =======
    heres one on apples site:
    http://www.apple.com/downloads/macosx/audio/switchfileformatconverterformac.html
    =======
    Tunes will convert wma to mp3 (or acc) format. Here are the instructions:
    To convert a song's file format:
    Choose iTunes > Preferences, then click the Advanced button at the top of the window and click Importing.
    From the Import Using pop-up menu, choose the encoding format that you want to convert the song to, then click OK to save the settings.
    Select one or more songs in your library, then choose Advanced > Convert Selection to MP3, Convert Selection to AAC, Convert Selection to Apple Lossless, Convert Selection to AIFF, or Convert Selection to WAV. (The menu item changes to show what's selected in your Importing preferences.)
    To convert all the songs in a folder or on a disk, hold down the Option key and choose Advanced > "Convert Selection to," then choose the folder or disk containing the songs you want to convert. All the songs in the folder or on the disk will be converted except songs you purchased from the iTunes Store. (Purchased songs are encoded using a protected AAC format that prevents them from being converted.)

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • Pocket Playlist- how to convert mp4 file to use on pocket playlist

    I have an mp4 video that i would like to use on my pocket playlist, but not sure how to convert the file?

    Hello Andy,
    I do not have an HP Pocket drive but according to the manual...
    The pocket acts as any other drive to store files on. Its the media player that you use that has to support the type of file you are playing.
    This is cut from the manual.
    "File types supported by HP Pocket PlaylistYour playback device may not support all of the following formats. If your playback device does not support a format, use the ArcSoft MediaConverter 7 computer application to convert (transcode) the files into a format that will play back on your mobile device.
    HP Pocket Playlist supports the following file formats:
    Video: .avi, .3gp, .flv, .m4v, .m4p, .mov, mp4, .mpeg, .mpeg2, .mpg, .ogg, .qt, .ts, .tts, .wmv
    Music: .aac, .ac3, .adts, asf, .lpcm, .m4a, .mp3, wav, wma
    Photo: .bmp, .gif, .jpeg, .png, .tiff, .tif
    You need to import files with the "Arcsoft Media Converter" which will convert the format for you.
    Here are the links to all the info for HP Pocket Drives.
    Using the HP Pocket Playist to Play Media Files
    Converting Media Files Using Arcsoft MediaConverter 7
    Hope it helps.

  • How to convert .class file to exec file...

    hi.
    how to convert .class file to exec file...
    please explain me clearly.....
    thanks...

    Placing your exact "question" into google:
    http://www.google.com/search?q=how+to+convert+.class+file+to+exec+file...

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • HOW TO CONVERT PDF FILE IN TO XML FILE?

    HOW TO CONVERT PDF FILE IN TO XML FILE

    No Office programs can open a pdf and edit the contents so you will have to get a different app to convert teh pdf into xls format. There are plenty to be found on the web.
    Rod Gill
    The one and only Project VBA Book
    Rod Gill Project Management

  • Converting WAV files to AAC  Error convert Can't read from or write to disk

    For several weeks I had no problem converting WAV files (from an Olympus Digital Recorder) to AAC format in iTunes, then one day I clicked "Convert Selection to AAC" and received the message "Error occured while converting the file. The disk could not be read from or written to." There is no Error # associated with the Error message.

    I recently spent over 14 hours converting all my CD songs to WAV. WAV conversion was the only one of two options available with my older Nero software, and MP3 conversion was not an option. I intended to make mixed CD's. By the time I was done, I had over 300 songs that take up over 17 GB in this WAV format.
    The thought of sitting even more endless hours making these CD's made me even more exhausted, and I realized that I should get with the times and get an MP3 player. So, I bought an iPod directly from Apple two days ago (12/16), and get this, MaclessInAZ, the sales person told me that I all my WAV files could be imported into my iPod with iTunes. (!!!)
    I am very glad to have read this thread before I got my iPod. I would have been so upset if there was no easy solution. My new iPod is supposed to be delivered tomorrow, and I am looking forward to getting it. Many thanks to weavercs for the information on the Switch program that converts WAV to MP3. Even if I decide to buy the full version of Switch, it is a lot less expensive than other conversion programs that I just found online, like Roxio.

Maybe you are looking for

  • Lens profile not recognized by LR 5.3

    At work, on a Windows 7 laptop, I used the Adobe Lens Profile Creator utility to make an LCP file for a Nikon 1 6.7-13mm zoom lens.  After submitting that LCP file to adobe via email, I copied it to my Dropbox.  At home, on my Mac OS X 10.8.5, I copi

  • How do I add text to existing PDF files using Acrobat Pro10.1?

    I upgraded to Acrobat Pro just so that I would be able to complete blank forms send to me as PDF files.  But sometimes I can edit them and sometimes I cannot.  And the "help" does mention anything as ordinary as form filling. FoxLuca

  • Generate AWR Report automatically every day

    Hi Friends, I would like to generate AWR Report automatically every day. How do i do it. The Start Time will be 00:00 of Previous day and the end Time will be : 00:00 of current day. The File format is html. Currently i am using awrrpt.sql to generat

  • Asset life

    Gurus, We have situation were we need to change the assets useful life after lease renewal and that can be done through 'Asset workbench' or 'mass change' but the problem is: The assets have 'sub components' and I think through 'Mass Change' only the

  • Wrt54gs setup issue

    I have just purchased the wrt54gs router to replace an old Microsoft router.  When I run the setup off the included CD, right after the router is configured, I get an error saying the router cannot connect to the internet.  I know I have connected ev