Audio Issues with Teensy 3.2 and Prop Shields

Status
Not open for further replies.

Lemonade

Member
Hello,

I have been using a prop shield with a Teensy 3.2 for almost a year now to play mp3 files using the MP3Player example project from the SerialFlash Library found here [URL="https://github.com/PaulStoffregen/SerialFlash/blob/master/examples/MP3Player/MP3Player.ino"[/URL]. Since the beginning of using it, I noticed that the MP3 audio quality was decreasing each time I used it, slowly and slowly becoming more static. It has since become inaudible and my attempted solution was to use a different prop shield, thinking that maybe I had blown the amp or some other hardware. Apparently, using a new prop shield is actually worse, and instead of a small pop noise, we get no sound or a much quieter pop. Nothing changed when using a different Teensy 3.2.

Is there something about using audio for the prop shield I am not understanding, or have we missed a step somewhere along the way? I am including the code below, it is just a slightly modified version of the example file.

Code:
// Simple MP3 file player example
//
// https://forum.pjrc.com/threads/27059-MP3-Player-Lib-with-example?p=101537&viewfull=1#post101537
//
// Requires the prop-shield and Teensy 3.2 or 3.1
// This example code is in the public domain.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <play_sd_mp3.h> // https://github.com/FrankBoesing/Arduino-Teensy-Codec-lib
//#include <play_sd_aac.h>


// GUItool: begin automatically generated code
//AudioPlaySdWav           playSdWav1;     //xy=154,422
AudioPlaySdMp3           playMp31; //xy=154,422
AudioMixer4              mixer1;         //xy=327,432
AudioOutputAnalog        dac1;           //xy=502,412
AudioConnection          patchCord1(playMp31, 0, mixer1, 0);
AudioConnection          patchCord2(playMp31, 1, mixer1, 1);
AudioConnection          patchCord3(mixer1, dac1);
// GUItool: end automatically generated code


#define PROP_AMP_ENABLE    5
#define FLASH_CHIP_SELECT  6
//#define FLASH_CHIP_SELECT 21  // Arduino 101 built-in SPI Flash

void setup() {
  Serial.begin(9600);
  AudioMemory(8); //4
  delay(2000);

  // Start SerialFlash
  if (!SerialFlash.begin(FLASH_CHIP_SELECT)) {
    while (1) {
      Serial.println ("Cannot access SPI Flash chip");
      delay (1000);
    }
  }

  //Set Volume
  mixer1.gain(0, .5);
  mixer1.gain(1, .5);

  //Start Amplifier
  pinMode(PROP_AMP_ENABLE, OUTPUT);
  digitalWrite(PROP_AMP_ENABLE, HIGH);    // Enable Amplifier
}

void playFile(const char *filename)
{
  SerialFlashFile ff = SerialFlash.open(filename);
  Serial.print("Playing file: ");
  Serial.println(filename);

  uint32_t sz = ff.size();
  uint32_t pos = ff.getFlashAddress();

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playMp31.play(pos,sz);

  // Simply wait for the file to finish playing.
  while (playMp31.isPlaying()) {
    playMp31.stop();
  }
}


void loop() {
  playFile("testmp3.mp3");
  delay(3000);
}
 
Status
Not open for further replies.
Back
Top