Sound FX Project Help

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
convoy
 
Posts: 13
Joined: Thu Mar 14, 2013 8:25 pm

Sound FX Project Help

Post by convoy »

Hello,


I was wondering if anyone might be able to point me in the right direction to upgrade a previous project. I created a PA system for my car incorporating the Adafruit Sound FX board (16mb). It works great but I would like to have access to more sounds.

Is there any way to add flash storage to the board or can it access external memory like a microSD card?

If not, I have some limited experience with Arduino/CircuitPython/Raspberry Pi. I guess I would like to use a microcontroller to play the files in a similar way but this time using a rotary encoder and LCD screen to select from many sounds to play. I’m not very good at creating code from scratch but I can sometimes modify and combine things from other guides and videos. Does anyone know of a similar project that could help with menu selection and display that I could combine with audio playback?

Any help would be greatly appreciated, Thanks!

I have included photos of my current design if anyone is curious.
Attachments
D6640E37-7B39-4449-8252-F4014929AFA4.jpeg
D6640E37-7B39-4449-8252-F4014929AFA4.jpeg (159.39 KiB) Viewed 357 times
8E67466B-C747-4637-BFBD-3FC6360F4830.jpeg
8E67466B-C747-4637-BFBD-3FC6360F4830.jpeg (97.7 KiB) Viewed 357 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Sound FX Project Help

Post by adafruit_support_mike »

convoy wrote:Is there any way to add flash storage to the board or can it access external memory like a microSD card?
I’m afraid not. That one was designed as an easy all-in-one solution for things like props and toys.

It sounds like you’re ready to bump the project up to a Music Maker:

https://www.adafruit.com/?q=music+maker&sort=BestMatch

That one is an MP3 codec that can read data from an SD card. We have several sample projects over in the Learning System:

https://learn.adafruit.com/search?q=music%2520maker

User avatar
convoy
 
Posts: 13
Joined: Thu Mar 14, 2013 8:25 pm

Re: Sound FX Project Help

Post by convoy »

Hi!

Thanks for the advice. I have now purchased the music maker but I am having some trouble getting it working. After following all the steps I can't get it to work. Anyone have any idea what I could do or what I am doing wrong? Any help would be greatly appreciated!

I get no sound at all. I get nothing in the serial monitor, not even errors. I double checked the solder joints and checked the headers for continuity and everything looks good. It seems like a code problem because I can get other sketches to run correctly, specifically a serial monitor test.

I also tried the VS1053 "player_gpiotest" and it also doesn't work, same-nothing in serial monitor.

Some info and code below

I am using the Music Maker #1790 connected to the Metro M4 # 3382.

To get started I have been following the Music Maker Guide here:
https://learn.adafruit.com/adafruit-mus ... bis-player

I soldered on all the headers and the 6-pin socket. I installed it on the Metro M4.
I then installed the latest version of the Arduino IDE.
I installed the Adafruit SAMD Boards and Arduino SAMD Boards libraries. I installed the VS1053 library.

I wanted to start with the "player_simple" example code in the library so I followed the guide. I commented and uncommented the appropriate lines to indicate in the code that I am using the shield. I copied two mp3 files(named track001.mp3 and track002.mp3)to a microSD card and put it in the shield. I verified and uploaded the code to the Metro M4 successfully. I plugged in a 3.5mm cable and connected it to a powered speaker.

Code: Select all

/*************************************************** 
  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"));
  
   if (!SD.begin(CARDCS)) {
    Serial.println(F("SD failed, or not present"));
    while (1);  // don't do anything more
  }

  // list files
  printDirectory(SD.open("/"), 0);
  
  // 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("Playing track 001"));
  musicPlayer.playFullFile("/track001.mp3");
  // Play another file in the background, REQUIRES interrupts!
  Serial.println(F("Playing track 002"));
  musicPlayer.startPlayingFile("/track002.mp3");
}

void loop() {
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1) {
      delay(10);  // we're done! do nothing...
    }
  }
  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);
}


/// File listing helper
void printDirectory(File dir, int numTabs) {
   while(true) {
     
     File entry =  dir.openNextFile();
     if (! entry) {
       // no more files
       //Serial.println("**nomorefiles**");
       break;
     }
     for (uint8_t i=0; i<numTabs; i++) {
       Serial.print('\t');
     }
     Serial.print(entry.name());
     if (entry.isDirectory()) {
       Serial.println("/");
       printDirectory(entry, numTabs+1);
     } else {
       // files have sizes, directories do not
       Serial.print("\t\t");
       Serial.println(entry.size(), DEC);
     }
     entry.close();
   }
}

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Sound FX Project Help

Post by adafruit_support_mike »

Let's start by checking the connections. Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

User avatar
convoy
 
Posts: 13
Joined: Thu Mar 14, 2013 8:25 pm

Re: Sound FX Project Help

Post by convoy »

I have now tested the music maker shield with an Arduino Uno R3 clone (with ATMEGA328) that I had laying around and it works fine. I was just hoping to use it with the Metro M4. Do you happen to know if I would need to modify the code or include more libraries to work with the Metro?

I also tested the Metro with a few basic example sketches and it seems to work fine with other code. I also tried bridging the ICSP pads but still no change so I de-soldered them.
Attachments
MusicMaker-4.jpg
MusicMaker-4.jpg (388.14 KiB) Viewed 171 times
MusicMaker-2.jpg
MusicMaker-2.jpg (222.61 KiB) Viewed 171 times
MusicMaker-1.jpg
MusicMaker-1.jpg (283.61 KiB) Viewed 171 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Sound FX Project Help

Post by adafruit_support_mike »

convoy wrote:I was just hoping to use it with the Metro M4. Do you happen to know if I would need to modify the code or include more libraries to work with the Metro?
The only changes you need to make will be the GPIO pin numbers at the top of the sketch. The M4 already knows its SPI pins, but you'll need to match the others.

User avatar
gpstar
 
Posts: 11
Joined: Mon Mar 14, 2022 9:11 am

Re: Sound FX Project Help

Post by gpstar »

convoy wrote:I have now tested the music maker shield with an Arduino Uno R3 clone (with ATMEGA328) that I had laying around and it works fine. I was just hoping to use it with the Metro M4. Do you happen to know if I would need to modify the code or include more libraries to work with the Metro?

I also tested the Metro with a few basic example sketches and it seems to work fine with other code. I also tried bridging the ICSP pads but still no change so I de-soldered them.
Did you ever get this to work? I am having trouble getting a M0 Express to work with the Music Maker Shield. It works fine with my 328 Metro (uno) board, but on the M0 Express I have the same problems you are.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”