Can't get WAV file to play from SD card: Audio Guestbook for friends wedding

Marimoose

New member
Hey kind people!

My best buddy requested some help to build this project of an Audio Guestbook:
(I know you can buy them ready-made on Ali Express/Temu, but his partner wanted us to use a specific phone, and it seemed like a fun side project for a good friend)

It uses a Teensy 4.0 and Teensy Audio shield for the main components.

So far we've been able to follow the instructions from the YouTube video successfully and can record to the SD card following his code: https://github.com/playfultechnology/audio-guestbook

The main change we've had to make was adjusting the gain from 5 to 40 for our headset, but otherwise, the code is pretty much the same.

sgtl5000_1.micGain(40);

However, we're unable to get the greeting to play. Let alone any playback of even the recorded files.

playWav1.play("greeting.wav");

Hit a roadblock and have spent the past few weekends stepping through the code, printing statements to ensure the code is stepping through the correct places including the libraries the original creator has made. ie: play_sd_wav.h & play_sd_wav.cpp

Would really appreciate any guidance about debugging or alternatives to try to get to the core issue if it's either mechanical or in the code.

So far we've made a glorified recorder but getting playback of the greeting message and the last recorded message is all we need to fix to finish this project and make a friend happy.

Thank you for your help!
 

Attachments

  • play_sd_wav.h
    2.6 KB · Views: 10
  • play_sd_wav.cpp
    16.5 KB · Views: 9
  • audio-guestbook.ino
    18 KB · Views: 19
Hi,
I dont know that guestbook project and I dont work with Teensy 4.0 but 4.1 ... but it should be pin compatible as far as I know.
So my proposal ... I always start a bigger project with simple examples of the Teensyduino.
I created a working MP3/wave player ... so it should work.
Try this example from Teensyduino : Examples-->Audio-->WavFilePlayer
If this works fine for you - it really should - then try to implement it to your guestbook or check the differences.
Hope you will get it run :)
 
After a short glance to the ino ... it seems that the pin mapping is not ok ...
At least pin7 is used by the interface between Teensy and Audio shield.
Check the PJRC site for the shield please https://www.pjrc.com/store/teensy3_audio.html
I connected Teensy directly with the Audio shield like Paul did it ... short connections without long wires are perfect :)
Hope this helps

Thank you for the tip! Going to try this ASAP. I'll let you know if this helps.

Appreciate your advice buddy!
 
Hello Marimoose,
I had some issues too when i began learning with teensy,about the sd card wav player
the monitor said the song was playing but no sound was heared,all the examples were written with
the names in upper cases,then i tried with lowercases or mixing upper and lower in the name
and git it to work.But it seems you're in lower case and you got no sound,maybe it's an issue with a
library that can't interprate a way of writting names.
Do you see a wave in the serial plotter?
 
Would really appreciate any guidance about debugging or alternatives to try to get to the core issue if it's either mechanical or in the code.

As a quick test to check whether your sound output is working, please try opening File > Examples > Audio > Synthesis > Guitar. When you run this on your Teensy + Audio Shield, you should hear a guitar strumming sound. This program doesn't use the SD card or other stuff, so it's a good way to check whether your hardware can output sound.

If you get no sound, then let's focus on the hardware side. Best to start by showing us photos. Maybe we'll be able to spot something you've missed?

If you do get the guitar sound, then at least we can start digging into the code side with confirmation your hardware is able to make sound output.
 
Hey AntiLoop & Paul,

Thank you for your feedback. Sorry for the late reply, didn't get a chance to work on the project until this weekend.
My buddy and I tried a little more debugging based on your input.

Tried the guitar sample Paul recommended, and it works fine.

The pins outputting are fine. With Teensy 4.1 (10, 11, 13)
Checked pinouts for Audio Shield REV D2, matches.

SD card playback with external headphones/plug-in earbuds to audio shield directly (not using the phone speaker) is choppy, robotic and slow.

Used the WAV file player sample and the Audio is choppy and slower.

We had two audio shields on hand and tested two different shields in case we fried the board or made some mechanical errors. S
ame issue persisted with the WAV File Player and Playing Music example and both led to choppy audio.

Not sure what else to try to debug and fix the choppy, robotic and slow-sounding audio playback from the SD card. Appreciate any advice on what we can do next.
 
If you're using Teensy 4.1, you would also try putting the SD card into the SD socket on Teensy 4.1. To use it, edit the code to use BUILTIN_SDCARD rather than pin 10.

If using the WAV player example, uncomment these lines:

Code:
// Use these with the Teensy 3.5 & 3.6 & 4.1 SD card
//#define SDCARD_CS_PIN    BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN  11  // not actually used
//#define SDCARD_SCK_PIN   13  // not actually used

and of course delete or comment the line for using pin 10.
 
Are you sure the caracteristics of "greeting.wav" or "greeting.mp3" : fit the player to be played correctly?
Also,some mp3 players don't like too high bitrate and generate what you call
"choppy, robotic and slow-sounding audio playback"
if 125kb/s is a good beginning to test a mp3 player,160kb/s mabe too high...
 
Test with these 4 WAV files (if you aren't already... difficult to know which files you're really using)


Yup we used these WAV files to test with

If you're using Teensy 4.1, you would also try putting the SD card into the SD socket on Teensy 4.1. To use it, edit the code to use BUILTIN_SDCARD rather than pin 10.

If using the WAV player example, uncomment these lines:

Code:
// Use these with the Teensy 3.5 & 3.6 & 4.1 SD card
//#define SDCARD_CS_PIN    BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN  11  // not actually used
//#define SDCARD_SCK_PIN   13  // not actually used

and of course delete or comment the line for using pin 10.

Will test this out and report back
 
Back
Top