Changing Wave File Sampling rates

Hello,
I was wondering if there was a java class or package that can do this. I want to up sample a 8000 Hz wave file into a 44100 Hz one, and vice versa.
Any info would be appreciated!
Vicki

Use the javax.sound.sampled package.
Try this:
// Suppose you got a file, or an url
File file = new File("Blablablabla.wav");
AudioInputStream oldstream = AudioSystem.getAudioInputStream(file);
AudioInputStream newstream = AudioSystem.getAudioInputStream(
          new AudioFormat(44100.0f,16,2,true,false),
          oldstream
// Use the following code if you want to write to file:
AudioSystem.write(
  newstream,
  AudioFileFormat.Type.WAVE,
  new File("blabla.wav")
);The variable oldstrea can also be obtained with an URL.
Check the part where the AudioFormat is constructed, you may want to change something, but if im right, this is cd quality.
The last method is for if you want to write the new stream in a file.
Note that if you change the file extension where it says new File("blabla.wav") and change the AudioFileFormat.Type you can also convert between wav and aiff and au etc.
R. Hollenstein

Similar Messages

  • How do I change the audio sample rate from 48kHz to 44.1kHz for Mpeg2

    Hey all,
    I've been searching for a while but haven't found any direct answers in the forums or the user manual so here goes.
    I have to dispatch a file to Bloomberg TV and the file specs they have given me are as follows:
    Video Standard: MPEG-2, MP:ML, 4:2:0
    Frame Rate: PAL 25fps
    Video Size 720 x 405
    Aspect Ratio 16:9
    Audio Standard MPEG-1 Layer 2
    MPEG-2 Program Stream Mux rate 6mbs per second
    Bit Rate Type: CBR
    Video Bit Rate 5.7mbs
    Audio Bit Rate 192kbs
    Audio Sample Rate 44.1Khz
    Interlacing: Upper Field first (why they want interlaced for web streaming is beyond me)
    GOP Structure: IBBP
    I-Frame distance 12
    Now everything above is fine except the audio encoding because even though I have set up a new setting from scratch I cant find anywhere to adjust the audio sample rate. The Inspector tells me the Audio encoder is set to:
    Format: MPEG
    Sample Rate: 48.000kHz
    Channels: 2
    Bits Per Sample: 16
    Anyone Know how or even if I can change these audio settings? The only adjustments I can find are the filters or the transport/program stream option. I have it set to program as specified by Bloomberg.
    Thanks in advance
    J

    The only setting that I could find in compressor that lets your change the bitrate to 44.1 is when you create a new dolby digital setting and then under the inspectors audio tab/Target System button, change the button to Generic AC-3. When done, you can change the Sample Rate to 44.1.
    Hope this helps?

  • Change the audio sample rate?

    It looks like upon export, the audio default sample rate is 44khz, which creates some issues when uploading to vimeo and youtube. Is there a way to switch the sample rate to 48khz?
    Thanks!
    Kyle

    Are you exporting from Motion straight to Vimeo or Youtube? If so, Motion encodes the audio at 48khz.
    I've never had any problem using 44 or 48 kHz when sending files to youTube or Vimeo. Please explain the kind of problem your having... and your workflow.
    ps... You can send to Compressor from Motion and change the sampling rate. Along with that you can send to youTube or Vimeo from Compressor.

  • Changed wav file names – files unrecoverable

    Hi. I was asked to import some important imterviews made on an iPod mini and an ExtremeMac Micromemo onto a Mac, but, as requested, I change the file names first. Since changing the file names the files are completely unplayable, undownloadable and unrecoverable. Please, can anyone help.
    Matthew Whiting

    Hi Chris
    What I did was to change the file names of the wav files in the Finder while they were still on the iPod Nano, before downloading them to iTunes. The iPod Nano uses a hybrid file system, and once the file names were changed iTunes refused to recognize the files. The Finder and Mac OS X flags them as wav files but cannot read them. All other software (players, audio apps and file recovery apps) that we have attempted to use, whether on Mac OS X, Windows XP and Vista, and Linux Red Hat has either crashed, failed to read the files or ignored them. Changing the file names back to an arbitrary time, similar to the original, still does not help.
    It's hard to appreciate the problem, but two of us with many years of Mac (and other IT) experience spent three hours yesterday, on a total of 6 computers, trying to get something to read or recover these files, without any luck whatsoever.
    Thanks for your interest.
    I might be able to get my hands on some industrial strength recovery software, today, and then we'll see. The problem, however, is that the data of the files is intact, but absolutely nothing succeeds in reading them as wav files.
    Matthew Whiting

  • Change wav file names on iPod - unreadable

    Hi. I was asked to import some important imterviews made on an iPod mini and an ExtremeMac Micromemo onto a Mac, but, as requested, I change the file names first. Since changing the file names the files are completely unplayable, undownloadable and unrecoverable. Please, can anyone help.
    Matthew Whiting

    Hi Chris
    What I did was to change the file names of the wav files in the Finder while they were still on the iPod Nano, before downloading them to iTunes. The iPod Nano uses a hybrid file system, and once the file names were changed iTunes refused to recognize the files. The Finder and Mac OS X flags them as wav files but cannot read them. All other software (players, audio apps and file recovery apps) that we have attempted to use, whether on Mac OS X, Windows XP and Vista, and Linux Red Hat has either crashed, failed to read the files or ignored them. Changing the file names back to an arbitrary time, similar to the original, still does not help.
    It's hard to appreciate the problem, but two of us with many years of Mac (and other IT) experience spent three hours yesterday, on a total of 6 computers, trying to get something to read or recover these files, without any luck whatsoever.
    Thanks for your interest.
    I might be able to get my hands on some industrial strength recovery software, today, and then we'll see. The problem, however, is that the data of the files is intact, but absolutely nothing succeeds in reading them as wav files.
    Matthew Whiting

  • How do i change the audio sample rate in motion 5?

    Hello,
    here's a simple question.  I import 48 Khz audio into the project, but when I go to export the summery says the audios will be exported at 44 Khz. Why is that and how do I export in 48 Khz?
    Thanks!
    Mike

    I'll see if I can muddle through this.
    According to the documentation, Motion converts everything internally to 44.1kHz 16-bit. There's no way to change this.
    To export in 48kHz, you need to quit Motion. From the Finder > Go > Utilities.  Open the Audio MIDI Setup application.  For (all) outputs, set the sample rate(s) to 48.000 kHz (and 2  -  24 bit if available [32bit float might work as well]).  Quit Audio MIDI Setup and restart Motion.
    When you go to export from Motion, be aware that the export Summary will still show 44.1kHz (which is thoroughly annoying!), but the exported video will be the audio rate you set in the Setup app:
    The Info from an exported project:
    HTH

  • Changing existing audio sample rates

    would it benefit me at all to convert my existing 44100 audio to say 48000 or above? would it sound better or just make it compatable to record the rest of the project at 48?

    No reason to change sample rates unless your project requires delivery of audio at a particular sample rate.
    If your original recordings are at 44.1, say, there would be no increase in audio quality by converting them to 48. Depending on the nature of the audio, there's actually a slight chance you'd be decreasing the audio quality (i.e., introducing aliasing artifacts).
    If you haven't gotten too far in your recording, and you have lots of tracks to go, sure, you could convert existing audio to 48 and record the rest of your stuff at 48. This will give you slightly better high-end definition, for the most part. But ultimately, if you're going to put this stuff on CD you're going to have to go down to 44.1 anyway.

  • Change range or sampling rate whilst generating a voltage waveform continuously

       Dear Sir/Madam,
    I would like to be able to change the sampling rate and range "on-the-fly" (whilst generating a continuous analogue waveform with a DAQmx). How to do this?
    Thank you.
    Regards
    Albert

    Hey Albert,
    It is possible to perform a simultaneous AI and AO in DAQmx. You simply have to set up the AI task in parallel with the AO task. Since you are doing continuous, this will probably work best in two parallel loops.
    To change the sampling rate "on-the-fly", please see the forum post below.
    Possible to change sample rate dynamically?
    http://forums.ni.com/ni/board/message?board.id=250&message.id=35581&requireLogin=False
    Regards,
    Chris Delvizis
    National Instruments

  • Automating wav import, sample rate change, mp3 export

    I do radio spots, lots of them, and every day I have to take my spot that is a 48k wav, convert it to 44.1k, then convert it to a mp3, them distribute via email.
    Can I automate this task?

    Rather than trying to automate iTunes, it might be easier to do the conversion in one go with a utility such as Sound Converter or Switch.
    Hope this helps.

  • Why does Soundbooth change Premiere Pro sample rate?

    I asked this question in the Soundbooth section and nobody had an answer, so please pardon the cross-post. (The Google machine didn't help, either.)  When I take a sound track in PPro CS5 and run the  Edit in Soundbooth command, how do I prevent Soundbooth CS5 from changing my 44.1k audio to 48k? It does it 100% of the time. I changed the SB preferences to default to 44.1, but it made no difference.
    As a result, the Edit and Replace feature is half useless. I can extract the audio, but can't simply save and switch back to PPro, like the marketing literature would have me believe. I have to save as a separate file, choose the 44.1 rate, then manually remove the original audio and insert the file I just saved. Not the end of the world, but not seamless integration, either.

    I'm producing material that's destined for Flash output. That's why I need 44.1. This "feature" is especially irritating since SB's preferences even has a setting to default to 44.1, noting in the dialog box that 44.1 is for Flash. Or tell me if I misunderstand something: my videos will become FLV, not SWF. Should I be using 48k for FLV, even though SWF needs 44.1?
    Do that on export, then--not during editing.
    I'll take your word for it that PPro is doing the conversion, but when I look at the properties of the extracted audio file in SB, it shows that it's 48k.
    If you're using Render and Replace (you said Edit and Replace, but I think this is what you're talking about), Premiere is essentially exporting the audio clip or the audio portion of a movie clip at the highest resolution and bit depth that it can. This is so that any editing you do on the audio in Soundbooth is done at higher level of quality. Regardless of the resolution and bit depth of the source audio, Premiere will "uprez" the audio to the highest quality it can, which is 48kHz at 32-bit depth. So it is Premiere that is doing the conversion, but I don't know if I agree with Jeff that this is a bug. If, on the other hand, you're using the Edit Source File command and it's changing the sample/bit rate, that would be a bug.
    Incidentally, you didn't mention if these are movie clips or audio clips you're trying to edit. If movie clips, what is the nature of the video?

  • Change sample rate on NI9477 on the fly

    I want to generate a continuous square wave on NI9477 and need to change the frequency of the square wave on the fly. Can this be done by changing the output sample rate? Are there any examples how it cane be done?

    E-team,
    You really can't change your generation rate of your card without stopping the task and then restarting it. However, you can do things like generate at a higher rate and vary the waveform you are generating to change the appearance of the signal. For Instance:
    Let's say you are generating at 1 kHz, and your waveform is 10101010, it would appear that you are generating a 500 Hz square wave. You could generate at 2 kHz and write 1100110011001100 and it would also appear as a 500 Hz square wave. Now, if you are generating at 2kHz and you have generated 1100110011001100 and you want to suddenly change the frequency of your output signal you can just start generating 1010101010 at the same 2kHz and it would now appear as though you have changed your output frequency, while in reality you have always been generating at 2 kHz.
    As for examples, you could look at a non-regeneration example, where you are always writing new samples to the DAQ card.
    Aaron W.
    National Instruments
    CLA, CTA and CPI

  • Can't find where to change audio sample rate

    I'm trying to change the audio sample rate but can't find where to change it

    You can change it in SoundTrack Pro, or with QuickTime Pro.
    -DH

  • Changing sample rates for recorded audio?

    I've been trying to record VO through premiere. I'm using an m-audio mobile pre which has never given me trouble in any other application. When i turn on Meter Input(s) Only from the panel menu of the track mixer i can clearly see the input move in time and responsively. When I record however the resulting clip is much shorter than the ammount of time recorded and the audio is all garbled and chopped. It clearly jumps out to me as a sample rate problem. I looked at the clips and they are 44.1 but the sequence i'm recording to is 48. I made a 44.1 sequence and recorded to that which worked fine but there must be a way to change the recording sample rate right? I can't find a solution anywhere. Anybody know?

    i'm just following up here. Thanks for the replies. I understood i would lose data as one answer suggests, but i wanted to convert it so i could work in a new song environment in which all the NEW tracks were recorded at 192. So the second answer was very helpful. incidentally, with further research we are recording at 96.

  • Conforming media changed Audio sample rate to 20khz by mistake!!!

    Has anyone had experience conforming media from 59.93 to 23.98 and Cinema Tools changes the audio sample rate? Where is the settings tabs for audio???

    There are no options for audio - you can't change anything - when conforming (or reverse telecining) clips in Cinema Tools.
    Is there any reason you're conforming from 60 to 24 in Cinema Tools? Did someone advise you to do that or is this a workflow that has been successful in the past?

  • Multiple sample rate question

    I have one project with edits of different files all over the place recorded at 44.1 kHz. I have another project with edits all over the place recorded at 88.2 kHz. I wish to combine all tracks from these two projects. I realize I will need to convert the sample rate of all the 88.2 kHz files, but I don't want to mix down any track. I want all of the edits to be cut at the same places in time, just with the referenced files being at a different sample rate.
    I've tried everything. It seems that it is impossible. If I convert the sample rate of the referenced files, then open the project and change it's sample rate, the edits are now cut at differnt locations in time. It seems I have to mix down each 88.2 track, then sample rate convert these to 44.1.
    But I need to have all the edited segments as they appear in both projects in the same project. Any ideas?

    Don't record at 88.2! Why would you do that?!
    I'd back up and archive your current session first as you are probably going to have to do some very destructive messing.
    I haven't put this to the test but maybe you could try converting the route files in a third party software like ProTools. You'll get a bunch of prompts when you reopen Logic but this may work. But for me the simplest (albeit time consuming route) would be to convert all of your regions to new original sound files (you can do this from the audio pop down on the arrange page). Then in your audio pool select all unused audio, delete and go through each new file and convert the sample rate. It's a bit of a car crash situation needless to say next time preparation preparation preparation!
    Finally when you have been through this kind of process make sure that you are operating at the correct new clock rate before continuing otherwise this stuff still aint gonna work.
    Hope this is of help.
    Good luck.

Maybe you are looking for

  • How to reorganise the sales value in FD33 tcode

    Hi gurus,    I had a customer whose credit limit is "1" rupee, in general process when we raise a sales order for him get the proforma invoice and send to him and then he pays for that then only we deliver and invoice him, but now system allows him t

  • Cant reset my apple id password

    Cant reset my apple id password (my kids have realised what it is) - dont know answers to security questions so have selected option to receive instructions via email but am not receiving email from apple ( email address is correct on id) Please Help

  • Purchasing music from UK iTunes site

    Why can I not purchase music from the UK iTunes website? When I try I get bumped back to the US iTunes website. You offer music on the UK site that that is not available on the US site.

  • How to interpolate 3D shapes?

    Hey, I'm trying to make a web presentation where the user can click over a 3d object and by the movements of the mouse it gets deformed. I though it by interpolating the shapes of tow 3D objects previously done on Maya. I searched on Director documen

  • App contact is not working anymore

    Since some weeks, the Contact app is not working anymore on my MBA. Symptoms : Contact is very slow and crashes very often The contact list contains all entries, but when I select one, on the right side, the message is "Aucune fiche" (I''m French, so