Go Down

Topic: real music (not tones) (Read 589 times) previous topic - next topic

anchange

I'm hoping someone can point me in the right direction.  I want to learn how speakers work and how I can control a speaker with an arduino to make sounds.  But not the basic tone stuff, actual music and/or playing back a person talking etc.  I see a lot of tutorials for making tones but that's not what I'm interest in.  I also see a number of shields that just do the whole thing for you but I'd like to understand what is happening and how to do it onboard the arduino.  Any help would be greatly appreciated. 

Nick Gammon

Here's the problem ... to play back real music you need to sample it, like how CDs are made. To get reasonable quality you need to sample at twice the frequency you want to have as your maximum, so for CD quality that is 40000 samples per second. At 8 bits per sample that is 40 Kb every second. But the Arduino only has 2 Kb of RAM and 32 Kb of program memory.

Either way, that's just a fraction of a second.

You might do it with extra storage (eg. an SD card) and a digital-to-analog converter, which is probably what these shields have.

Another more practical route is to play MIDI, because then you just have to send "play middle C for 1 second" which only takes a few bytes, and let the synth do the actual sounds.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

dc42

You need to have the Arduino control a synthesizer chip. A quick search brought up http://hackaday.com/2011/12/17/midi-synth-arduino-shield/.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

anchange

Thank you very much for the reply guys!  Not really interest in midi more into voice stuff then notes.  How is it done in cheap toys that can say a few words or make an explosion sound?  Like the GI Joes with a button on them that makes it say one of three phrases?


Grumpy_Mike

Most are either mechanical recordings or custom chips.

CrossRoads

And not the greatest sound quality either.

Try looking into a Speakjet chip.
http://store.nkcelectronics.com/SpeakJet_p_247.html
Some good info on it here
http://store.nkcelectronics.com/VoiceBox-Shield_p_175.html

Some sound samples here too
http://www.sparkfun.com/products/9578
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

joseph_m

Everybody gave you good advice but if you want to learn about sound reproduction you might want to start with studying amplifiers. In particular the class D amp.  It is most applicable for use with the arduino.  If you see the class D amp and a motor control using an H-bridge you will see that they are pretty much the same except there is a speaker where the motor would be.  When I first noticed that I thought it was amazing.

Go Up