Wave Sheild Volume Low

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
miax
 
Posts: 157
Joined: Tue Apr 05, 2011 11:41 am

Wave Sheild Volume Low

Post by miax »

Adafruit,

Per my question in the last AAE, my Wave shields volume is very low even when the potentiometer is turned-up all the way.

I've assembled two Wave shields now successfully (using the Mega wiring hack to PINs 50-53), and they both work Excellently (including the SD cards). I've got working C code that uses both based on the WaveHC example, "daphc". I really don't know where to start in troubleshooting it, other than building the second shield/music pack kit to see if I got the same results (which I do). Here are pictures of one shield:

Front (Note: This shows the default wiring for an Aurdino, I re-route the connections to 50-53 as required for the Mega).
Front side of wave shield
Front side of wave shield
WaveShield_Front.JPG (704.63 KiB) Viewed 1718 times
Back:
WaveShield_Back.JPG
WaveShield_Back.JPG (732.24 KiB) Viewed 1718 times
Here is the sample code that I've been using (daphc.pde):

Code: Select all

/*
 * This example plays every .WAV file it finds on the SD card in a loop
 */
#include "WaveHC.h"
#include "WaveUtil.h"

SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the volumes root directory
WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

uint8_t dirLevel; // indent level for file/dir names    (for prettyprinting)
dir_t dirBuf;     // buffer for directory reads


/*
 * Define macro to put error messages in flash memory
 */
#define error(msg) error_P(PSTR(msg))

// Function definitions (we define them here, but the code is below)
void play(FatReader &dir);

//////////////////////////////////// SETUP
void setup() 
{
  Serial.begin(9600);           // set up Serial library at 9600 bps for debugging
  
  putstring_nl("\nWave test!");  // say we woke up!
  
  putstring("Free RAM: ");       // This can help with debugging, running out of RAM is bad
  Serial.println(FreeRam());

  //  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init()) {         //play with 8 MHz spi (default faster!)  
    error("Card init. failed!");  // Something went wrong, lets print out why
  }
  
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);
  
  // Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {   // we have up to 5 slots to look in
    if (vol.init(card, part)) 
      break;                           // we found one, lets bail
  }
  if (part == 5) {                     // if we ended up not finding one  :(
    error("No valid FAT partition!");  // Something went wrong, lets print out why
  }
  
  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?
  
  // Try to open the root directory
  if (!root.openRoot(vol)) {
    error("Can't open root dir!");      // Something went wrong,
  }
  
  // Whew! We got past the tough parts.
  putstring_nl("Files found (* = fragmented):");

  // Print out all of the files in all the directories.
  root.ls(LS_R | LS_FLAG_FRAGMENTED);
}

//////////////////////////////////// LOOP
void loop() 
{ 
  root.rewind();
  play(root);
}

/////////////////////////////////// HELPERS
/*
 * print error message and halt
 */
void error_P(const char *str)
{
  PgmPrint("Error: ");
  SerialPrint_P(str);
  sdErrorCheck();
  while(1);
}
/*
 * print error message and halt if SD I/O error, great for debugging!
 */
void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  PgmPrint("\r\nSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  PgmPrint(", ");
  Serial.println(card.errorData(), HEX);
  while(1);
}
/*
 * play recursively - possible stack overflow if subdirectories too nested
 */
void play(FatReader &dir)
{
  FatReader file;
  while (dir.readDir(dirBuf) > 0) {    // Read every file in the directory one at a time
  
    // Skip it if not a subdirectory and not a .WAV file
    if (!DIR_IS_SUBDIR(dirBuf)
         && strncmp_P((char *)&dirBuf.name[8], PSTR("WAV"), 3)) {
      continue;
    }

    Serial.println();            // clear out a new line
    
    for (uint8_t i = 0; i < dirLevel; i++) {
       Serial.print(' ');       // this is for prettyprinting, put spaces in front
    }
    if (!file.open(vol, dirBuf)) {        // open the file in the directory
      error("file.open failed");          // something went wrong
    }
    
    if (file.isDir()) {                   // check if we opened a new directory
      putstring("Subdir: ");
      printEntryName(dirBuf);
      dirLevel += 2;                      // add more spaces
      // play files in subdirectory
      play(file);                         // recursive!
      dirLevel -= 2;    
    }
    else {
      // Aha! we found a file that isnt a directory
      putstring("Playing ");
      printEntryName(dirBuf);              // print it out
      if (!wave.create(file)) {            // Figure out, is it a WAV proper?
        putstring(" Not a valid WAV");     // ok skip it
      } else {
        Serial.println();                  // Hooray it IS a WAV proper!
        wave.play();                       // make some noise!
        
        uint8_t n = 0;
        while (wave.isplaying) {// playing occurs in interrupts, so we print dots in realtime
          putstring(".");
          if (!(++n % 32))Serial.println();
          delay(100);
        }       
        sdErrorCheck();                    // everything OK?
        // if (wave.errors)Serial.println(wave.errors);     // wave decoding errors
      }
    }
  }
}
This code (and other examples from WaveHC) work perfectly on the shield. I made sample voice files using the AT&T Natural Voice site that the Wave Shield tutorial page recommends (http://www2.research.att.com/~ttsweb/tts/demo.php#top) - it's very excellent!

To make sure the problem wasn't in my audio files I uploaded some U2 songs as well, and then pulled the AT&T voice files into Audacity and amplified them by 3 times. This makes them slightly louder, but max volume is still very low.

Any input would be most appreciated!

Thanks,

Kris

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Sheild Volume Low

Post by adafruit_support_bill »

Not sure what kind of sound-pressure levels you are looking for, but the small on-board amplifier can be augmented with an external amplifier. Many have had good results using amplified computer speakers, or small kit amplifiers such as the ones sold by Velleman.

User avatar
miax
 
Posts: 157
Joined: Tue Apr 05, 2011 11:41 am

Re: Wave Sheild Volume Low

Post by miax »

Okay thanks. :) I appreciate the response!

So I take it from your response that there is nothing horrible wrong with my shields...

I can definitely get some amplified speakers - good idea. I shouldn't need them for every unit, but sound would be too-low for the hustle and bustle of the busier areas like the main barn isle.

I found these Velleman Mono amplifiers that look as though they could fit the bill: http://www.vellemanusa.com/product/view/?id=522062

Do you think this amp would work well with the wave shield?m

Thanks!

Kris

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Wave Sheild Volume Low

Post by adafruit_support_bill »

7 watts should be plenty of power. You will probably something more than the 1W speaker that come with the music&sound pack to take advantage of that.

Also, you will get more volume from speaker with an enclosure than the same speaker in open air.

User avatar
miax
 
Posts: 157
Joined: Tue Apr 05, 2011 11:41 am

Re: Wave Sheild Volume Low

Post by miax »

Awesome thanks!! :)

I have my custom mega protoshield 100% done and working now, which took almost a week (and one failed attempt). I have the PN532 board, the ST7565 LCD, the Wave shield, a Chronodot, an Ethernet shield and one of your Rotary Encoders all working together now - been writing code for a few days now. Once done I'll make an Acrylic encloser for it and add a new speaker.

I'll put up a WIP post soon, work has been crazy lately!

Thanks again :)

Kris

User avatar
miax
 
Posts: 157
Joined: Tue Apr 05, 2011 11:41 am

Re: Wave Sheild Volume Low

Post by miax »

Update:

The Velleman amplifier works Very nicely with the wave shield!

I got the Velleman K4001 7 watt (@ 4 ohms) mono amplifier kit:

https://www.jameco.com/webapp/wcs/store ... _127255_-1

The instructions are not good (well, I'm spoiled on Adafruit tutorials now), and the really funny part is that the kit is inexpensive ($14), but it doesn't include the $9 47K Log Potentiometer that I need for the volume control. :roll: I've got some of those on order now, which is the last hardware bit I need for the Scanner units.

Cheers,

Kris

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

Return to “Arduino Shields from Adafruit”