Go Down

Topic: Talking Clock Mp3 Shield not speaking all minutes (Read 897 times) previous topic - next topic

snufer

Hello,  

I have recently begun exploring the world of Arduino and have decided to make a talking clock.

I'm using a momentary push-button with LED, Arduino Uno, DS1307 RTC breakout board and an Adafruit "Music Maker" MP3 Shield. In the end, I would like to record my own voice but for now I am using the .WAV files found here: https://learn.adafruit.com/wave-shield-talking-clock.  I have compiled a sketch using a few different talking clock examples on the web but I am having issues with the minutes being spoken properly.

As far as hookup goes, the MP3 is shield stacked on the Uno, the DS1307 is hooked to pins 5V, GND, A4, A5. The momentary switch is wired to pins A1, A0. The switch's LED is wired to pins 8 and GND with a 220ohm resistor on the gnd side.

When I push the button I expect the annc.wav file to be spoken followed by the hour, then minute (broken up by minTen then minUnit digits).

When I press the button, annc.wav is spoken followed by the hour, but I run into issues with minutes. For some hours, the minutes work as expected, but others only say the tens digit...example 25= "twenty" not "twenty-five" as expected. Other hours just speak the hours and do not say minutes. Sometimes the hours are spoken, followed by a pause then the minute units (ex-10:49 = "ten ... nine").  I've messed around with the delays but that doesn't seem to do it. I have also changed startPlayingFile to playFullFile but the issue was not fixed.

I have attached my code, please let me know where I've gone wrong!

 Edit--- The WAV files are all on the root directory of an 8GB SD that I formatted using SDFormatterV4.0

Thanks!

snufer

#1
Mar 11, 2016, 05:10 am Last Edit: Mar 11, 2016, 05:16 am by snufer Reason: was not finihed typing before I hit enter....oops
Hi again!

So I have made a bit of progress into my issue. I changed my sketch and still had the same problem... With my second sketch, the hours, "o'clock", and minutes 01-20, 31-39 all work as expected.

This got me looking into the actual WAV files. I redownloaded these files from the Adafruit website, tested them on my computer using VLC. They all play as expected. I reformatted my 8GB SD card using SD Formater v4.0 and placed the files in the root directory of the card. I then ran the VS1053 test programs included in the Adafruit VS1053 library and the same files failed to play. I have attached the Adafruit VS1053 library along with the talking clock WAV files for reference.

If I open the player_simple example and change the first track name to m5x.wav then the second to m2.wav the second file fails to play. If I change the first track name to m3x.wav then the second file plays just fine. This is the same result I see with my clock sketch.

Does anyone have ideas as to what's going on??

Thank you!

Here is the code:
Code: [Select]
/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries. 
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// define the pins used
//#define CLK 13       // SPI Clock, shared with SD card
//#define MISO 12      // Input data, from VS1053/SD card
//#define MOSI 11      // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins.
// See http://arduino.cc/en/Reference/SPI "Connections"

// These are the pins used for the breakout example
#define BREAKOUT_RESET  9      // VS1053 reset pin (output)
#define BREAKOUT_CS     10     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8      // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create breakout-example object!
 // Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
  // create shield-example object!
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
 
void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit VS1053 Simple Test");

  if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));
 
  SD.begin(CARDCS);    // initialise the SD card
 
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20,20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
 
  // Play one file, don't return until complete
  Serial.println(F("m5x.wav"));
  musicPlayer.playFullFile("m5x.wav");
  // Play another file in the background, REQUIRES interrupts!
  Serial.println(F("m2.wav"));
  musicPlayer.startPlayingFile("m2.wav");
}

void loop() {
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1);
  }
  if (Serial.available()) {
    char c = Serial.read();
   
    // if we get an 's' on the serial console, stop!
    if (c == 's') {
      musicPlayer.stopPlaying();
    }
   
    // if we get an 'p' on the serial console, pause/unpause!
    if (c == 'p') {
      if (! musicPlayer.paused()) {
        Serial.println("Paused");
        musicPlayer.pausePlaying(true);
      } else {
        Serial.println("Resumed");
        musicPlayer.pausePlaying(false);
      }
    }
  }

  delay(100);
}

Go Up