8.3 FORMAT - STILL NO SOUND (even though I can get SDTEST1.WAV to play fine)

Status
Not open for further replies.

NewtonBIV

Active member
Hello everyone! I've got a Teensy 4.0 with an Audio Shield REV D all soldered together and working PERFECTLY for everything else - just can't play my tracks off the sd card Capture.PNG

So everything was going great, I was thoroughly enjoying baby stepping along with Alex Glow as my tour guide, and i've been able to get pretty much everything to work functionally. I've got all the connections to produce the desired effect with all the PROVIDED audio files you guys made available (which are amazing by the way and kudos to the chef if one of them happens to be on 'the team').

However, I have as yet been unable to get any audio files I've put on the sd card to play in any kind of way. Sure the device is happy to tell me its playing them, I was able to get this far by changing the title of the files to an 8.3 format. I've tried everything i can think of, even converting to RAW headerless file types and attempting to play from MEM (all my files are tiny little samples I'll eventually want to simply loop, driven by hopefully one of the clocks on teensy so it would be amazing if i could play them like that though i don't expect to really was just trying it to see if i could get something to play).

Here is source code for playing one of the files (I think the sketch is the first music playing one in the tutorial) and the serial monitor just outputs 'Start Playing' over and over again to the delay that is set. No sound though, and if i play any of my files in the 'wavplayer' it'll actually say that it's 'playing DRUM120.WAV' or whichever just no sound until it plays one of YOUR files like SDTEST3.WAV and then it plays all the way through, then going to KEYS150.WAV, GUIT85.WAV, and so on and so forth with no sound whatsoever.

I assuming it's the format of the files but they are all 32-bit 44100Hz which is the same as the SDTEST.WAV files i've noticed so not sure why that wouldn't work. Ok i've included the source code and a pic. hope ya'll can help!




Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

AudioPlaySdWav           playSdWav1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection          patchCord2(playSdWav1, 1, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;

// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN    10
#define SDCARD_MOSI_PIN  11
#define SDCARD_SCK_PIN   13

void setup() {
  Serial.begin(9600);
  AudioMemory(8);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  SPI.setMOSI(SDCARD_MOSI_PIN);
  SPI.setSCK(SDCARD_SCK_PIN);
  if (!(SD.begin(SDCARD_CS_PIN))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
  delay(1000);
}

void loop() {
  if (playSdWav1.isPlaying() == false) {
    Serial.println("Start playing");
    playSdWav1.play("DRUM80.WAV");
    delay(10); 
  }
 
}
 
Last edited by a moderator:
Indeed that works here on a Beta T_4 with Audio card.

Using PJRC published file "SDTEST1.WAV" in place of the posted file name.

Something not converted properly - or perhaps the file is corrupt.
 
Note: it does take some delay(); after the .play() command to have the sound start (open file and begin transfer and output) or the next test will still see .isPlaying == false

On my machine I'm seeing start time take ~1.5 to almost 3 ms at times with this code ending setup() and starting loop() using PJRC supplied samples.
Without that delay() { the while() } in setup - it leaves setup() and enters loop() and TEST2 plays instead of TEST3
Code:
	Serial.println("Start playing ... 0");
	playSdWav1.play("[COLOR="#FF0000"]SDTEST3[/COLOR].WAV");
	uint32_t ww = micros();
	[B][COLOR="#FF0000"]while [/COLOR](playSdWav1.isPlaying() == false && ww + 10000 > micros()) ;[/B]
	Serial.println(micros() - ww);
	if (playSdWav1.isPlaying() == false)
		Serial.println("FAILED Start playing");
}

void loop() {
	if (playSdWav1.isPlaying() == false) {
		Serial.println("Start playing");
		playSdWav1.play("[COLOR="#FF0000"]SDTEST2[/COLOR].WAV");
		delay(10);
	}
 
I assuming it's the format of the files but they are all 32-bit 44100Hz which is the same as the SDTEST.WAV files i've noticed so not sure why that wouldn't work. Ok i've included the source code and a pic. hope ya'll can help!
not 32-bit
SDTEST3.WAV: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
 
not 32-bit
SDTEST3.WAV: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

Wow really? Thank you! I opened the file on one of my audio editors and guess i mistook the default encoding for the file's original specs. I'll change one of the files then woohoo!

As always thank you everyone!
 
Status
Not open for further replies.
Back
Top