Let's say I have an audio sample, whose pitch is known to be C4 (don't wanna go in detail here, let's say I just sampled a tuned piano playing the C4 key).

The rules of the game are: I can only change the sample playback rate by any ratio. No pitchshifter module, no frequency analysis. If I set the playbackrate to 2.0, for example, the sample is played back at twice its speed. If I set it to 0.5, the sample is played back at half its speed, and so on. This changes the playback time as well as the sample pitch.

If I wanted to generate any arbitrary "note" from this sample, what is the relation between the playback rate and the sample pitch? For example, I know that C4 fundamental frequency is 261.63 Hz. What playback rate should I set to make the sample "sound like" a C#4/Db4 (277.18 Hz) or a D4 (293.66 Hz)? What is the general, formulaic, relationship?

  • $\begingroup$ Very interesting topic. So do you have any issues with the duration of the note changing based on the pitch? $\endgroup$
    – user2718
    Feb 1, 2013 at 22:50

1 Answer 1


The ratio of sample playback rates should be equal to the ratio of pitches you want to obtain.

For example, if your C4 note was sampled at 48kHz, you'll need to play it back at $48000 \times \frac{277.18}{261.63} = 50.85kHz$ to make it sound like a C#4.

  • $\begingroup$ Since sampling rate is ininfluent (fixed) here, my playback rate should be 277.18 / 261.63 = 1.05943508, am I right? $\endgroup$ Feb 1, 2013 at 12:19
  • $\begingroup$ Yes, this is correct. $\endgroup$ Feb 1, 2013 at 12:28

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.