Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Please, need to correct sample rate without resampling (Read 6805 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Please, need to correct sample rate without resampling

I was able to do this sometimes with the free program 'wavosaur' but it seems very unstable on my PC - so looking for something else.

I have some wave files which I recorded, I am happy with the quality, however the sample rate is slightly off - for example 48002 rather than the 48000 which I want.

I don't want to actually resample them!, I merely would like to change the sample rate of them to specify 48000. Can anybody point me to some program, other than Wavosaur, that can do this preferably easily and simply, I'm comfortable with using the CLI. Thankyou.

p.s. I use Audacity sometimes, I know you can change the project rate, but I'm not sure if it is actually resampling when I select this before saving or not???

Please, need to correct sample rate without resampling

Reply #1
An easy way is to export the raw PCM data and import it back - that requires you to specify the sampling rate, which is what you want. You can do that with Audacity, even with FLAC.

Please, need to correct sample rate without resampling

Reply #2
sox -r 48000 input.wav output.wav

Please, need to correct sample rate without resampling

Reply #3
Audacity can do this.

Please, need to correct sample rate without resampling

Reply #4
sox -r 48000 input.wav output.wav


If I'm reading the documentation correctly, that does force a resampling, which is specifically *not* what the user wants.

It looks like the option in audacity resamples too (at least it generated a bigger file when specifying 96Khz), so probably the best option is trying to import it as raw format, as has been suggested.

Please, need to correct sample rate without resampling

Reply #5
Quote
' date='Oct 18 2008, 16:07' post='594120']

sox -r 48000 input.wav output.wav

If I'm reading the documentation correctly, that does force a resampling, which is specifically *not* what the user wants.

I didn't read the doc  but I did try the command before posting, and it does work -- comparing the input and outfiles revealed just 4 bytes in the header (and none in the actual audio) were different.

Please, need to correct sample rate without resampling

Reply #6
Thanks very much everyone. Will try those methods :)

@Axon:
  Please would you tell me how to get Audacity to change the resampling rate in the header, but without performing any resampling on the file. Thanks.

edit: I see the information above about Exporting and Importing in Audacity, will try that - sorry I'm half-asleep.

Please, need to correct sample rate without resampling

Reply #7
I assume we are talking about WAV files?  If you're feeling really brave, you can use a hex editor (i.e. XVI32 is FREE!!!).    Don't try this when you're half-asleep, and make a backup of your file first!   

Look for these two bytes (probably in the 2nd line in XVI32):  82 BB.  Change 82 to 80.  Save the file. 

48,002 (decimal) = BB82 (hexadecimal)
48,000 (decimal) = BB80 (hexadecimal)
You can double-check that by using the Windows calculator in scientific mode, and switching between decimal & hex.  (Programs -> Accessories -> Calculator -> View -> Scientific).

The bytes in a WAV file are stored "backwards" (least significant byte first), so you will see 82 BB, instead of BB 82.  If you want to read about the WAV file spec, there some links at Watsit.org

Please, need to correct sample rate without resampling

Reply #8
Thanks DVDdoug! Those instructions were very clear and helpful - that method is the way I have found the quickest and easiest and are what I will stick with using 

I love using these small unobtrusive but so functional programs like XVI32:

Open the wave file. Over-type a value. Save --> done!

Please, need to correct sample rate without resampling

Reply #9
Adobe Audition can do it.