I hope this is the correct forum. I started to do some programming involving sound recently and have encountered a lot of technical terms that are all foreign to me. I am slowly learning about them but there is a couple of them that I find it hard to grasp. I am trying to change the sample rate with one of my codes but I am not sure how to verify that it really got resampled and am unsure if I have understood the whole logic behind it.

Say that my laptop's default sample rate is 48000 Hz. I record something in 48000 Hz and want to change the sample rate to 96000 Hz. When I've done it, according to this pdf (http://dsp-book.narod.ru/Pitch_shifting.pdf) the pitch will get higher and the sound shorter. My code does indeed do that. But when I compare the audio file with default sample rate with the one with modified sample rate, they are in the same size. Shouldn't the upsampled version be larger since it contains more samples? And the quality of the file should be better, right? Should the pitch and speed of the upsampled file sound "normal" when played in a 96000 Hz-machine?

Yeah, as you can see I am a bit confused. I think that I may have implemented the upsampling incorrectly, but what conditions should it fulfill when it is upsampled correctly? How can I verify?

Thanks in advance!

  • The better question is why are you trying to go from 48khz to 96khz? You don't gain anything meaningful by interpolating the sound up from 48khz since the extra samples are all make believe and have no additional detail that wasn't present in the original 48khz (and may even lose some from anti-aliasing).
    – AJ Henderson
    Aug 12, 2014 at 14:01
  • I am exploring a javascript library and the new web audio API and there were some people suggesting that it might be possible to change the sample rate (both up and down) using existing tools and nobody had confirmed it, so I wanted to try it myself. So it is just for experimental reasons. :)
    – waylie
    Aug 13, 2014 at 2:03

1 Answer 1


It seem to me that your code does not any interpolation with further addition of samples between each pair of existing ones (in that case the size of the file would double, but pitch and speed should remain the same). More likely it "reinterprets" the original file, changing its header and telling the player to read the existing samples 96000 times per second instead of 48000. The effect is exactly the same as tape played on double speed: the pitch and speed of sound varies, but the length of the tape does not.

  • I tested encoding it to 48000 Hz although I had "resampled" it to 96000 Hz and the file was exactly the same as the one I didn't "resample". So it is as you thought, it didn't get altered at all. Thank you for your explanation! Everything is much clearer now.
    – waylie
    Aug 12, 2014 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.