mjs513
Senior Member+
I new to the audio world and just trying out different examples using a propshield and a T3.5. I am using 1.38Beta1 teensyduino by the way. For a speaker I am using a old 0.25watt 8ohm one.
I am sure the wiring is ok because if I run examples from the Talkie Library and TTS library there is no problem with the sound. At that point figured I wanted to give playing some music from SerialFlash so I used teensytransfer to transfer the mp3 to serialflash. Verified by listing the files and do some prints from the MP3Play.ino (File size) so I know its seeing it. The sketch says its playing the file but no sound. I did try changing audiomemory to 20 instead of 8 but still nothing.
One quick question, dac1 is the equivalent of dac0?
Thanks in advance.
For reference here is the sketch:
I am sure the wiring is ok because if I run examples from the Talkie Library and TTS library there is no problem with the sound. At that point figured I wanted to give playing some music from SerialFlash so I used teensytransfer to transfer the mp3 to serialflash. Verified by listing the files and do some prints from the MP3Play.ino (File size) so I know its seeing it. The sketch says its playing the file but no sound. I did try changing audiomemory to 20 instead of 8 but still nothing.
One quick question, dac1 is the equivalent of dac0?
Thanks in advance.
For reference here is the sketch:
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, 0.5);
mixer1.gain(1, 0.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()) {
yield();
}
}
void loop() {
playFile("zarathustra.mp3");
delay(1000);
}