Wish A Library for playing music by Arduino

derez

Expert
Licensed User
Longtime User
Wishing again...
Arduino/ESP + a small loudspeaker (8 ohm) + SD card reader + one transistor + few buttons
You get a music player (for example - to put on your baby's bed to make him listen to real music, not the usual that is running in the children's mobile toys.
It works very nice in arduino sketch but I would like it to be in B4R.
I tried to put it in inline but failed.
Promise to share !

Edit: I need the following methods- tmrpcm.speakerPin , tmrpcm.setVolume, tmrpcm.play, tmrpcm.stopPlayback, tmrpcm.isPlaying
 
Last edited:

derez

Expert
Licensed User
Longtime User
Ready to move to Beta Site (my grandson's bed):



Attached the Arduino sketch and the connection drawing.
I used the existing structure of the faulty devide, took out the battery housing and put Arduino Uno instead + sd card reader. I used the existing buttons and motor.
I used 3.3 volt for the motor and the speaker, to have slow rotation and low volume.
To get louder - use 5v or add a transistor like for the motor.
The SD card has 3 great classics- Beethoven's "Ode To Joy", Handel's "Water Music" and Vivaldi's "Spring" , but one can change them easily - take out the SD, write the file you want instead of 1.wav,,2.wav or 3.wav. The files are converted from mp3 to 8bit 8Khz sampling rate wave files.
 

Attachments

  • music.zip
    15.7 KB · Views: 361
Cookies are required to use this site. You must accept them to continue using the site. Learn more…