Go Down

Topic: Play Sound from EEPROM (Read 1 time) previous topic - next topic

hunt333r

Oct 03, 2013, 06:56 pm Last Edit: Oct 07, 2013, 08:04 pm by hunt333r Reason: 1
hy there guys i have a question is there any way to play sounds from internal arduino eeprom or from my sketch (simple sounds)
im intrested in  this ... for my arduino to play when something is happening... the best is to play midi ... but i'm satisfied with simple sound  u know a tutorial for this or something ...  it can be done??

thank you !

CrossRoads

Read this thread
http://forum.arduino.cc/index.php?topic=179761.0
Shows how I created up to 13 notes at once using blink without delay style programmming.
Its simple sound.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

GoForSmoke

Open your IDE and go to File->Examples->02.digital and look at the last 4 sketches in the menu, like toneMelody.

It says you need an 8-ohm speaker direct to pin 8. 8 ohms seems a bit low to me. Wouldn't I rather power that through a transistor and 2 resistors?
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

CrossRoads

Arduino pin driving a resistor directly is bad news.
Put at least a 120 ohm resistor in series with it. Will be quiet.
Better would be to connect the output to a powered computer system:
You can hear that here:
http://www.youtube.com/watch?v=4c8idXN4Pg0&feature=youtu.be

Here's  how I hooked it up - output thru a cap, thru a potentiometer to not  overpower the input oft the amplified speaker:
http://forum.arduino.cc/index.php?topic=179761.0
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

GoForSmoke

Is that what they call matching impedances is about?
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

CrossRoads

No, this is just straight current limiting, similar to an LED.
Need to keep current from pin under 40mA so it doesn't burn out.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

GoForSmoke

Pin sound is kind of fuzzy to my ears. In the early 70's we had an 80-in-1 Radio Shack Project Kit with a tone circuit that made nice clean tones. There weren't many parts but I forget and don't have that cookbook. Instead I see some that make clean sine waves using 2 opamps and I have quads, 2 tones per chip. I'm looking at digital pots but not so happy with what I see. Maybe a DAC would be simpler?.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

CrossRoads

Well, digital output is just a square wave. You can filter it some to smooth the corners, make it more sinusoidal.
DAC could make any shape you want, justs needs more programming.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up