Pages: [1]   Go Down
Author Topic: real music (not tones)  (Read 518 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/.
Logged

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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31555
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Most are either mechanical recordings or custom chips.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 444
Posts: 23859
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: