Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: Noob Question - Wav file format?

  1. #1

    Noob Question - Wav file format?

    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 by BenDanville; 09-09-2022 at 05:15 AM. Reason: extra info

  2. #2
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    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.

  3. #3
    Quote Originally Posted by h4yn0nnym0u5e View Post
    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

  4. #4
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    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.

  5. #5
    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!

  6. #6
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    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.

  7. #7
    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!

  8. #8
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    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.

  9. #9
    Quote Originally Posted by h4yn0nnym0u5e View Post
    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/yoafha70z...SAEKJxCIa?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!

  10. #10
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    Thanks. Probably can’t get to it until the weekend (busy week!) but I’ll definitely take a look.

  11. #11
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,885
    I can't find a WAV file in that project.

    Pete

  12. #12

  13. #13
    Senior Member
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    443
    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…

  14. #14
    I am with the same issue, Do you solve it in any way?

  15. #15
    Quote Originally Posted by BenDanville View Post
    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!
    What is this online converter?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •