0

Alright, there is something missing in the question, I was able to hear one sound of the files and the others apply to the question I asked and that is why I am wondering. what is happening!

Here is the code:

#include <SD.h>                      // need to include the SD library
#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch

void setup(){

  tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc

  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not
  }
  tmrpcm.play("music.mp3"); //the sound file "music" will play each time the arduino powers up, or is reset
}

void loop(){  

  if(Serial.available()){    

    if(Serial.read() == 'p'){ //send the letter p over the serial monitor to start playback

      /* These are spkean Numbers */

     // tmrpcm.play("1-24bit.wav");
     // tmrpcm.play("1-16bit.wav");
     // tmrpcm.play("200-insane.mp3");   
     // tmrpcm.play("music.mp3")       // Strangely this is the working perfectly with good sound
     // tmrpcm.play("200-standard.mp3");
        tmrpcm.play("200.wav");        // from https://evolution.voxeo.com/library/audio/prompts/numbers/index.jsp
    }
  }

}

Everything is good when I play this tmrpcm.play("music.mp3"); but the others I hear aliens sounds expect this tmrpcm.play("200.wav"); which I can hear the number two hundred but I feel the sound is 4-bit depth which very noisy. The files used in the code are here

For clarification previously, I thought it was amplifying issues which then I had to used LM386 but the sound was the same noise with tmrpcm.play("200.wav"); and later when I tried this tmrpcm.play("music.mp3"); I was shocked it worked perfectly like what I need it to be! so I was curious I removed the LM386 and played this tmrpcm.play("music.mp3"); again and worked alright just maybe less volume.

  • Should I try to record a sound again with a lower pitch? – Noajm IsMy Name Jun 8 '19 at 19:06
  • you renamed the sample file "music" to "music.mp3"? the library can play only prepared sound files github.com/TMRh20/TMRpcm/wiki – Juraj Jun 8 '19 at 19:49
  • Yes, that is correct and it was working. I made to music.mp3 and music.wav because I just was curious. I was going to rename 200.wav to 200 but did not know how my Mac was not allowing me. – Noajm IsMy Name Jun 8 '19 at 20:20
  • So how I do play spoken numbers from 1 to 100 as prepared sound files? Can I record them? – Noajm IsMy Name Jun 8 '19 at 20:23
  • @Juraj I'm so dumb that link you sent has the solution... I will try it when I go home... sorry I just hate to read so that why I skip links. They are a smaller version of books. – Noajm IsMy Name Jun 8 '19 at 23:39
1

As @Juraj mentioned it was solved by changing the setting and I was able easily to play the sound when I matched the setting to this file:

enter image description here

So, I could not create one from scratch matches above setting but I was able to convert existing sound through this site which allowed me to convert with desire setting and here finally the exiting sound has matched the setting:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.