Recording audio files in PCM_FLOAT format

Hello!
I'm trying to record voice sample and I've got a problem with my .wav format. With:
AudioFormat format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 1, 2, 44100.0F, false);everything works fine. But what I need (because of further analysis of this audio file in Matlab) is PCM_FLOAT format:
AudioFormat format = new AudioFormat(AudioFormat.Encoding.PCM_FLOAT, 8000.0F, 32, 1, 4, 8000.0F, true);which unfortunately returns an error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
No line matching interface TargetDataLine supporting format PCM_FLOAT 8000.0 Hz, 32 bit, mono, 4 bytes/frame,  is supported.I've tried a lot of different combinations with PCM_FLOAT but every one of them returns same exception. I'm probably missing something but the question is: what? How can I find what audio formats could work with my sound card? If I can only use PCM_SIGNED or UNSIGNED how can I convert recorded .wav file to PCMFLOAT?

I've finally been able to try what you suggested. As server received from the client an array of bytes I tried to convert it to an array of floats:
IntBuffer sbuf = ByteBuffer.wrap(myAudioBytes).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
int[] audioInts = new int[sbuf.capacity()];
sbuf.get(audioInts);
float[][] audioFloats = new float[audioInts.length][1];
for (int k = 0; k < audioInts.length; k++)
    audioFloats[k][0] = ((float)audioInts[k])/0x8000; // Two dimensions in audioFloats because Utils.floatsToWav needs to know whether it's mono or not.
}and then save it to file using http://code.google.com/p/j-simple-wav-io/ :
Utils.floatsToWAV(audioFloats,new File("output.wav"),8000);Unfortunately it didn't work. I checked the .wav files with AudioFileInfo from jsresources.org and it recognizes the format of output.wav as:
Type: WAVE
AudioFormat: PCM_SIGNED, 8000.0 Hz, 16 bit, mono, 2 bits/frame, little-endian
Lenght of audio data: 22050 frames, 44100 bytes, 2,75625 seconds
Total lenght of file (including headers): 44144 byteswhile valid audio file (I mean the one that actually works with my Matlab script) is:
Type: WAVE
AudioFormat: PCM_FLOAT, 8000.0 Hz, 32 bit, mono, 4 bits/frame
Lenght of audio data: unknown
Total lenght of file (including headers): unknownBefore that I tried to do it another way:
- getTargetEncodings(originalFormat) --> returned PCM_FLOAT (amongst others);
- isConversionSupported(targetFormat, originalFormat) --> returned true;
(where originalFormat is "PCM_SIGNED, 8000.0F, 16, 1, 2, 8000.0F, false" and targetFormat is "PCM_FLOAT, 8000.0F, 32, 1, 4, 8000.0F, false" - as you can see above I don't really know if Matlab wants little or big endian).
so I thought sth like this will do the trick:
ByteArrayInputStream bais = new ByteArrayInputStream(myAudioBytes);
AudioInputStream AIS = new AudioInputStream(bais, originalFormat, myAudioBytes.length / originalFormat.getFrameSize());
if(AudioSystem.isConversionSupported(targetFormat, originalFormat))
    AIS = AudioSystem.getAudioInputStream(targetFormat, AIS);
File file = new File(fileName);
int nWrittenBytes = 0;
try
    nWrittenBytes = AudioSystem.write(AIS, AudioFileFormat.Type.WAVE, file);
}It didn't work either (but it seems that this bit can help switching from 16 to 32 bits and from 2 to 4 bits/frame).
So - clearly I've done something wrong but again have no idea what. I'm sort of new to Java and an absolute novice to processing audio files so thanks for all the advices :-).

Similar Messages

  • Record audio file in a wav file format using QuickTime 7 Pro for Windows?

    Is it possible to record audio file in a wav file format using QuickTime 7 Pro for Windows? The system I want to upload audio files that I record to requires they be in a wav file format / PCM - 112025kh / 8 bit mono / 11.05khz
    Something tells me no...and I bought this upgrade for nothing...GRRRRRRR

    QuickTime Pro for Windows allows you to make audio recordings from some input devices.
    You can then "export" these new files to .wav format at any setting you choose.

  • HT3775 How can I play an audio file in 3GP format?

    Hi,
    I have an audio file in 3GP format, which was recorded in a mobile phone and transferred to me.
    I am not able to play it using QuickTim and VLC Player.
    Can someone please help me how to play this?
    Regards
    Sharath Arun

    Is that file played in a tab in the current window or in a separate pop-up window?
    Are you allowing pop-up to modify the window size (dom.disable_window_move_resize = false)?
    *http://kb.mozillazine.org/JavaScript#Advanced_JavaScript_settings
    You can try set the Boolean pref <b>media.windows-media-foundation.enabled</b> to <i>false</i> on the <b>about:config</b> page to disable the built-in HTML5 media player.
    *http://kb.mozillazine.org/about:config

  • Hello! I have some my violin recorded audio files and want them to be converted to printable notation throw "audio to score"from Factory. But do not have a normal result. Could someone help me, please. .

    I have some my violin recorded audio files and want them to be converted to printable notation throw "audio to score"from Factory. But do not have a normal result. Could someone help me, please. .

    seeren wrote:
    Normal result is on the sloppy side of inaccurate.
    Wish I'd started this topic so I could give you a green star!
    Great description.

  • HT201066 How can I split a long recording audio file into multiple audio files?

    Hi,
    How can I split a long recording audio file into multiple audio files?
    With Windows I was using Nero software, which is not available for Mac. Is there any similar app for free for Mac?
    Thanks!

    Hello ingiorgio
    You can import the track into GarageBand and then split the tracks there. Once that it is done you can highlight the ruler section and then share the song to iTunes to get them separated out. 
    GarageBand - Split regions in the Tracks area
    http://help.apple.com/garageband/mac/10.0/#gbnd76fcce04
    GarageBand - Share songs to iTunes
    http://help.apple.com/garageband/mac/10.0/#gbndfb96a96f
    Regards,
    -Norm G.

  • Converting  audio file from one format to another format

    Hi Friends,
    Is it possible to convert the audio file from one format to another format(*.mp3 to *.wav file and vice versa)?
    If so, please guide me on the same.
    Thanks in advance,
    Kavitha Anbazhagan

    It's been covered here already, but take a look here:
    Converting CDs to iTunes Audiobooks
    Just read the parts after the section on importing from CD.
    Regards.
    Message was edited by: Dave Sawyer

  • How do you add an already recording audio file to garageband

    hi, i want to create an audio podcast. i have already recorded the audio using another recording software. i have no idea how i now import this .mp3 file into garageband to create a podcast and submit to iTunes. thanks

    Just pull the audio file into GB's timeline (the big gray area in the middle.)

  • Recorded audio files are gone after power outage during a concert

    Hello together,
    yesterday I used Logic Pro X to record a concert at our school. I had connected my MacBook Air to our mixer via FireWire, and everything went fine until two minutes before the concert's ending, the power went out. My MacBook was still working from battery, however, Logic Pro stopped recording and all recorded files except for one audio file are gone. I have already tried to recover the lost data by using a data recovery app, but it didn't find anything.
    Is there a way to recover the lost recordings? I mean, Logic must have written its audio files to the hard drive somewhere and even when everything crashed, I don't think the files got overwritten with zeros or something else that could have destroyed it...
    Many Regards,
    Leo Bernard

    hhaammrr wrote:
    I copied each track and pasted it into a new file.  I saved each new song file, and thought it would be safe to delete the tracks I had copied from the original file.
    http://www.bulletsandbones.com/GB/GBFAQ.html#saveasarchive
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How many MB does an iPhone 4S record Audio file?

    I am planing to buy an iPhone 4S but I don't know which capacity should I chose.
    I think I will record up to 8 hours.
    Also, I don't know which is the best format for recording audio?
    ( *.mp3 ; *.aac or *.wav )

    mine took a long time lost patience and rebooted it and then I started from the begining
    so guess I made it take even longer and I did it over usb

  • Are plug-ins applied in the recorded audio file with GB2?

    I have a very basic question and I think I know the answer but I just want to have a confirmation. I am using the ChannelStrip plug-in from Metric Halo, which is great by the way, I am wondering if the process is applied directly in the audio file when I am recording a track or if it will only be when I export the track to iTunes? For example when you process a file with a software like PEAK you must indicate that you want the plug in to be applied to the audio file unless it will leave the original audio file unchanged.
    Thanks in advance!

    If I can remember rightly, a sound recordist friend of mine had one of these units and there was a problem importing the audio from it into pro-tools and avid. I do remember though it was a firmware update that eventually fixed it.
    Also does this thing record dual stereo channels onto one .wav file, or two seperate .wavs?

  • Why can't I playback Sonority Recorder audio files?

    I have transferred audio files from my Olympus Voice Recorder DM-420 to my iMac and would like to use Sonority application to playback.  IMac will not play the audio files.  Any ideas as to why?  Thanks in advance...

    Yes you can merge two audio regions
    Simple way:
    Create two audio tracks...
    Place audio region 1 on 1st Audio track
    Place audio region 2 on 2nd Audio track
    Press play and adjust levels/pan/fx etc in mixer.....
    Select all regions using Shift and Left click on each region
    Right / Control Click on one of the regions and from the popup menu choose Bounce & Join > Join or press CMD + J
    Now in the next dialog box choose Stereo or Mono mixdown
    Mixdown done... Single audio file now found in first track with mixdown of both tracks....
    (Rename track.region to taste)
    Bear in mind track volume /pan levels etc get mixed down also so again mix to taste before joining
    Done!

  • How to remove noise from a recorded audio file.

    I'm a relatively new user. I recorded certain audio files which are noisy(humm or hiss). Can anyone suggest ways to remove noise from that clip? I tried Denoiser but it added further noise artifacts which were unpleasant to hear Need help. And pls dont ask me to rerecord it in a noise free environment!

    If you have some cash you go after 'Sonnox Restoreor' or 'iZotope RX'. Otherwise this might be of some help:
    http://www.howtogeek.com/howto/40469/the-how-to-geek-guide-to-audio-editing-basi c-noise-removal/
    Have a nice day!

  • Itunes store downloads audio files in QuickTime format & no convert options

    My wife's XP computer received audio files from ITunes store in Quick Time format. Can find no help in so-called "Help" files, right-click on downloaded song offer only "Convert to AAC". I've used Real Player to convert QT files to MP3 but this seems overly complicated. Any ideas?

    Thesbrian wrote:
    Looks like I just had to change my preferences 3 or 4 times, and it finally shows the option to convert to MP3. I'll see how successful it is in converting while downloading. Thanks for the suggestions.
    Also please note that if you are looking for MP3 files, it is easier to buy directly in MP3 format from an online music retailer who sells in MP3 format, such as the amazon.com MP3 download store.
    MP3 format is compatible with iTunes/iPod and virtually every other player, program, and device.

  • E72 recorder: audio file MP4??

    Today I recorded some  economy lessons with my E72. I chose "High Quality" in the options and started.
    When went to listen to them, back home, the recorder couldn't find them in the card!! I was sure ti have recorded them correctly.  And I remember I could see and play previous recordings made in medium quality .
    So explored the card with the office file explorer and I found them as "videoclips" ??!! And, in actual fact, clicking on them the real player opened and I could listen to them. Then, I explored the files via PC Suite and realized the medium quality have the WAV extension, the HIGH Q have the MP4 extension. Then, I made the experiment of renaming all of them with the MP3 extensione ..and  finally  the recorder could see and play all of them, MID Q and HI Q
    So, why the phone doesn't give always the MP3 extension to the recorded files? To me they should simply be MP3 files sampled at diferent rates, but always MP3...or not?

    You're question is quite interesting that I decided to test out the Recorder application too using the various settings.
    Indeed, when settings is "Standard", it uses:
    Format: audio/wav
    Bitrate: 128 kbit/s
    Sampling rate: 8000Hz
    roughly 5-second sample clip's file size: ~ 85 kb
    setting is "MMS-compatible"
    Format: audio/amr
    Bitrate: 12 kbit/s
    Sampling rate: 8000 Hz
    roughly 5-second sample clip's file size: ~ 8 kb
    setting is "High"
    Format: audio/mp4
    *Bitrate: 64 kbit/s
    *Sampling rate: 48000 Hz
    roughly 5-second sample clip's file size: ~ 43 kb
    *I got this info after downloading the sample .mp4 I recorded to the PC
    (for the WAV and AMR, those info are shown using the phone's Clip Details)
    The 5-second is not exact (I just recorded my voice saying the same words approx for 5 seconds).
    ~~~~~~
    puasho:
    AMR is different from WAV which is different from MP4.
    Even when you rename the MP4 to MP3, it won't become an MP3 file (though sometimes it fools the PC's player to force playing the sound file (sometimes, it may know how to play a certain file format but didn't recognize the file extension)

  • Is it possible for me to Burn an audio file in cd format not mp3 to play in my car. I don't seem to know how to do it in my mac .. Please I need help ASAP . Thanks

    Hello community ... Hope all of you are happy and doing great today.... Please I need yet another valuable help from you all... I want to know if my MacBook pro can burn the type of audio format that can play in my car as my car does not play mp3 audio CDs ... It needs the kind of format used in general audio disc we get in shops for example  a jay-z album cd .... Please does anyone have an idea on what to do... I used to burn it on my then windows laptop with real player but now the real player on mac doesn't seem to do it ..... Any suggestions please?

    Random Geeza is correct; I burn audio CDs frequently, and it's perfectly painless in iTunes,
    Create your playlist, ensure that all the tracks you want to record are checked, then click the 'burn' button at the bottom right of the window. You'll get this dialogue;
    Select the settings you require, then click 'burn' - at that point you'll be prompted to insert a blank disc.
    Don't put the disc in before then as it then requires a different procedure.

Maybe you are looking for

  • Is there a way to stop the B8550 and D7560 printers from wasting ink?(Black)

        I am having serious ink problems on two new HP printers. A little history, have always had HP printers. First was a 600 series desk jet one of the first consumer models. Used 2 years and never had to replace ink cartridge. Then I bought an 895 de

  • Help required in starting to learn Flex 3

    Hi All,  I want to start learning Adobe Flex 3.  I have various questions.  1) What is the difference between adobe flex builder 3 and adobe sdk 3.0  I have heard that flex builder 3 is commercial and adobe sdk is freely downloadable. I would like to

  • Download starts but freezes up at around 20%

    No matter what I do the download keeps freezing up in the same spot. I've run as admin, rebooted, cleared cache but it still stops at the same point. yes, i've tried saving to desktop and the default, didn't work. I'd download it on my mac but it onl

  • Myxperia in the case of burglary

    I was wondering how "myxperia" in the case of burglary would work. My screen lock setting is a pattern; the unabling of the myxperia app still seems to be very easy. The stealer just has to press the power botton and activate the flight mode or turn

  • How to find manage server name in weblogic server?

    I have two managed server in weblogic server. I need to find out which managed server serving my request. Please let me know if any body knows about this.