About WAV audio files
Usually uncompressed PCM, so about 10 MB per minute of CD-quality stereo. Browsers play it, but for the web, compress it to MP3, AAC or Opus. Older software sends audio/x-wav or audio/wave.
Other types seen for these files:
audio/x-wav
,
audio/wave
,
audio/vnd.wave
. Accept them when reading uploads, but send audio/wav yourself.
File signature
WAV files start with "RIFF", then "WAVE" at byte 8. The extension and the type a browser reports for an upload both
come from the file name, so check these bytes on the server before trusting a file.
Serve .wav with the right Content-Type
Content-Type: audio/wav
audio/wav wav;
AddType audio/wav .wav
@wav path *.wav
header @wav Content-Type "audio/wav"
curl -sI https://example.com/file.wav | grep -i '^content-type'
# Content-Type: audio/wav
Set the type in code
res.set('Content-Type', 'audio/wav');
// Or make the browser download it:
res.attachment('file.wav');
import mimetypes
mimetypes.add_type('audio/wav', '.wav') # if your system doesn't know it
mimetypes.guess_type('file.wav')[0] # 'audio/wav'
mime.AddExtensionType(".wav", "audio/wav")
w.Header().Set("Content-Type", "audio/wav")
Accept .wav uploads
<input type="file" accept=".wav,audio/wav">
The accept attribute only filters the file picker; users can still choose another file. Listing the
extension as well as the type matters, because operating systems don’t always report the type you expect.
Related types
More audio
.m4a , .aac . Look up any extension or type with the MIME type lookup.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What is the MIME type for .wav files?
audio/wav. You may also see audio/x-wav, audio/wave, audio/vnd.wave, which are older or unofficial; send audio/wav. The full header is "Content-Type: audio/wav".
Why does my server send the wrong Content-Type for .wav?
Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .wav is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".
How can I check that a file really is WAV?
Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. WAV files start with "RIFF", then "WAVE" at byte 8. The MIME type lookup on this site reads them for you when you drop a file on it.