can't play wav file on my audio adapter

Status
Not open for further replies.

Gibbedy

Well-known member
Example wav files play fine.

My file is following format according to adobe premiere:

Type: Windows WAVE audio file
File Size: 34.9 MB
Source Audio Format: 44100 Hz - 16 bit - Stereo

Using this code:
Code:
// Simple WAV file player example
//
// Requires the audio shield:
//   http://www.pjrc.com/store/teensy3_audio.html
//
// Data files to put on your SD card can be downloaded here:
//   http://www.pjrc.com/teensy/td_libs_AudioDataFiles.html
//
// This example code is in the public domain.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>

// GUItool: begin automatically generated code
AudioPlaySdWav           playWav1;       //xy=154,78
AudioOutputI2S           i2s1;           //xy=334,89
AudioConnection          patchCord1(playWav1, 0, i2s1, 0);
AudioConnection          patchCord2(playWav1, 1, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=240,153
// GUItool: end automatically generated code

void setup() {
  Serial.begin(9600);

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(5);

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);

  SPI.setMOSI(7);
  SPI.setSCK(14);
  if (!(SD.begin(10))) {
    // stop here, but print a message repetitively
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
}

void playFile(const char *filename)
{
  Serial.print("Playing file: ");
  Serial.println(filename);

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playWav1.play(filename);

  // A brief delay for the library read WAV info
  delay(5);

  // Simply wait for the file to finish playing.
  while (playWav1.isPlaying()) {
    // uncomment these lines if you audio shield
    // has the optional volume pot soldered
    //float vol = analogRead(15);
    //vol = vol / 1024;
    // sgtl5000_1.volume(vol);
  }
}


void loop() {
  playFile("BOOB.WAV");
  delay(500);
  //playFile("SDTEST2.WAV");
  delay(500);
  //playFile("SDTEST3.WAV");
  //delay(500);
  //playFile("SDTEST4.WAV");
  //delay(1500);
}

teensy 3..

Anything obvious?
Thanks.
 
your sketch works for me playing SDTEST2.WAV, so maybe it's your BOOB.WAV. Does monitor say it's playing BOOB.WAV?
try one of Paul's WAV files https://www.pjrc.com/teensy/td_libs_AudioDataFiles.html

Pauls wav's play so it is mine.

Its a converted MP4.
Serial monitor shows it just continually starts playing file:
Code:
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV
Playing file: BOOB.WAV

Just wondered if there was some limitation, size or something.

Perhaps someone can recommend software for conversion of iTunes mp4 to (teensy audio compatible) wav.

I have access to Rasbian and windows.
Thanks.
 
Last edited:
Status
Not open for further replies.
Back
Top