Noob Question - Wav file format?

BenDanville

Active member
Hi Everyone, I hope you can please help me,

I am able to play the example files wav files with the WavFilePlayer example. I am using the Audio Shield and Teensy 3.2
My problem is when I switch it to play my file "SOUND.WAV" the serial says it's successfully reading the file but no audio comes out. I have the made sure I have capitalised the filename on the SD card and in the code. My file is about 1mb and 5 seconds long.
Is there a particular format or encoding that needs to be used with the wav file format?

For clarity I just exported my sound from Audacity as a Wav file.

Thankyou for any advice!

Edit:
I have just seen something about the 8.3 (max 8 chars then 3 extension) so have tried changing to TEST.WAV (even though prev file name met that) with no success.
Also have tried renaming the example file to my name, and that works.
I have also tried rexporting the file with a different name. So next I will try the different encoding options with the WAV export.

Edit2: Saw references in forum posts about it needing to be 44.1khz mono, so have converted file in Audacity to those settings and that did not help.
 
Last edited:
16 bit PCM at a sample rate of 44.1kHz, either mono or stereo.

When you get that far, be sure to use the Audio System Design Tool, and check out the info pane on the right as you select the various modules. It’s a useful reference for many of the features that aren’t immediately apparent from the examples.
 
16 bit PCM at a sample rate of 44.1kHz, either mono or stereo.

When you get that far, be sure to use the Audio System Design Tool, and check out the info pane on the right as you select the various modules. It’s a useful reference for many of the features that aren’t immediately apparent from the examples.

Thanks! Those are the settings I've been using but no success. I imagine there's some other thing I am doing slightly wrong, so I have isolated so the only thing I am changing is the file name in the example sketch (which I have verified with the sample files).
I assume there's no minimum length for the file?

I will take a look at the Audio System Design Tool :)
 
No minimum length, no. 1Mb for a 5s stereo file sounds about right, though if you used 48kHz it wouldn’t be much different in size, but it wouldn’t work!

You’ve not stated Arduino or Teensyduino versions: probably worth updating to the latest if you’re not already using them.
 
Thanks for more advice, I'm using Windows 10, Arduino 1.8.19 and TD 1.57
I suspect it is file related as when I change the name of the example files to my custom name it works. But my settings in Audacity are 16 bit PCM at a sample rate of 44.1kHz, and have tried mono and stereo.
This one has really stumped me!
 
Does your file have any unusual metadata chunks in it? The WAV player object does try to skip these, but I've no idea how good a job it does. You only need the 'RIFF' header and 'fmt ' and 'data' chunks; a hex editor will let you look and see if the file is strange.
 
Thanks for all your advice, I have no idea what was going wrong on the file. I used an online converter to "convert it" to the same file format and it works now.
Strange!
 
Do you have, or can you re-create, the original file in non-working form? I’ve been working on an improved WAV file player object, and it would be good to make sure it can play unusual files, assuming they’re not hopelessly weird. I think you can upload via the forum.
 
Do you have, or can you re-create, the original file in non-working form? I’ve been working on an improved WAV file player object, and it would be good to make sure it can play unusual files, assuming they’re not hopelessly weird. I think you can upload via the forum.

No worries, here it is (warning it is of a weapons firing, the project is a non-profit non-commercial sound effect generator for a museum)
https://www.dropbox.com/sh/yoafha70zty1205/AADNjPoGGJn4_dOKSAEKJxCIa?dl=0

If that works without issue for you let me know in case I have got the files mixed up :) as I should be able to download the original and regenerate a "non working" one :) but I think thats the one!
 
OK, had a quick look at that, and the file is at 48kHz sample rate, not 44.1kHz. So that’s why it wouldn’t play…
 
Back
Top