Up until now, I was of the apparently misguided belief that all .wav files are 44100 samples per second; some recent experiments have given me to strongly suspect that the .wav format supports 48000 as well, and perhaps other, additional rates. Will someone who actually knows please answer my question: what are the sampling rates that .wav format supports?
This question would probably never have occurred to me, except that last night something very peculiar happened: a certain .wav file that I have plays in the correct key on my computer, but plays about 146.7 cents flat on a Sparkfun “Wav Trigger”. The first thing I suspected was that the crystal clock on the Wav Trigger was off frequency; however, the piano-tuning tracks that I have created (that can be a whole new subject!) all play at the correct pitch on the Wav Trigger as well as on the computer.
What I take home from this is that the .wav file header must tell the codec in a computer what sample rate to read at, but in the Wav Trigger that header is at least partially ignored, or perhaps the Wav Trigger has a fixed sample rate of 44100, no matter what.
By the way, using Cool Edit, I made an ASCII listing of the contents of the .wav file I had experienced the wrong pitch on, and LO AND BEHOLD, the “samplespersecond” field said “48000”. Using Cool Edit, I then invoked the “Edit Sample Rate” function to set the rate to 44100; however, this caused the same song to play 146.7 cents flat on my computer; therefore, as a next step, I used Cool Edit’s “Transform Time/Pitch” function to correct the pitch, saved the file, closed the file, reopened it and made a new ASCII content listing of it. The sampling rate, this time, correctly displayed “44100”. Also, the newly-saved .wav file now plays in the correct pitch BOTH in my computer AND in the Wav Trigger. Once again, please: what sampling rates does .wav format support?
There are a number of standard sample rates, the most common being 44100 (CD standard) and 48000 (DVD standard). Other standard rates include 8000, 11025, 22050, 96000. 192000. As far as I’m aware, a WAV file can have any sample rate (though non-standard rates are rarely used).
To change the sample rate of a WAV file with Audacity:
Import the file
Set the “Project Rate” (lower left corner of the main Audacity window) to the required sample rate.
Export as a WAV file
(It’s good practice to give the new file a unique name so as to not overwrite the original, just in case you make a mistake and mess up somehow.)
Most sound systems “know” what 44100 and 48000 are and just slosh between them with no notice to the performer. As you’re finding, you can create some interesting problems if the sample rate is that critical.
I would give some very serious consideration to not using devices or software that becomes confused by a common shift like that. If it’s that brittle, you may not know what else it’s going to do wrong.
.wav files can be any sample rate desired. I often export Audacity .wav files in rates as low as 128 samples per second. This allows me to do FFTs in a 0 to 64Hz window with very high resolution. Most of the apps I use do not care what rate is provided.
Apropos of the pitch shift mentioned by the OP, I have an tuning app that ocassionally and randomly shifts from the default 48kHz sample rate to 44.1kHz while I am actually using it. This causes it to think the note I am tuning is now is actually the note half a tone lower. Restarting the app solves the issue.
Edit: Audacity will import (and export as indicated above) just about any sample rate. One can change the sample rate used for editing by typing any number in the “Project Rate (Hz)” box. A 113Hz sample rate .wav imported into Audacity will automatically change the “Project Rate (Hz)” box to read “113” as well as changing the data in the “Audio Track” box.