Go Down

Topic: How to have arduino make sounds? (Read 3689 times) previous topic - next topic

ikestarm

I just recently got an arduino, and I figured out how to make beeps with a piezo with it. However, I have not been able to find any tutorials on how to make other noises by using speakers and things. Any help is appreciated. :)


ikestarm

#2
Sep 12, 2009, 06:06 pm Last Edit: Sep 13, 2009, 02:50 am by ikestarm Reason: 1
thanks, but I couldn't find a specific way to play songs or simply make a drum beat sound when you press a button how do you do that?

Sanguine

Sorry if I understand you wrong, but just go to the ArduinoIDE File>Examples>Digital>Melody

But make sure you understand the whole script, otherwise you won't learn anything from it  ;)


AWOL

Quote
but I couldn't find a specific way to play songs or simply make a drum beat sound when you press a button how do you do that?

By itself, the Arduino doesn't have enough memory to play very large samples. For this, you'd need some form of external memory like an SD card and an audio shield , or a MIDI interface.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

fubbi

or:

http://www.ladyada.net/make/waveshield/

Mike Mc

ALternatively you could connect it up to one of the many Sound Generator IC's on the market and get that to generate the sounds you want. This is a harder approach but would give you full control over the noises generated.

Mike Mc

#7
Sep 14, 2009, 03:07 pm Last Edit: Sep 14, 2009, 03:08 pm by zooto68 Reason: 1
ALternatively you could connect it up to one of the many Sound Generator IC's on the market and get that to generate the sounds you want. This is a harder approach but would give you full control over the noises generated.

Or, take a look at this..... http://code.google.com/p/tinkerit/wiki/Auduino

westfw

An arduino should theoretically be able to produce more interesting waveforms than simple tones, given fairly simple external hardware (three resistors and an amp?)  This is without going "all the way" to simply lpaying back pre-recorded sounds.  There's a whole science (and art) to digital synthesis of music; and there were some impressive results back in the past (before simple sample and playback became possible.)

I've been a bit surprised not to have seen any more complex digital synthesizer hacks out of the arduino crowd; I thought there was a fair amount of overlap between experimentally minded music folk and the art/arduino community.  Even some of the simpler "synthesizer toys" I've seen published seem to operate primarily in the digital realm (but not using a CPU.  Hmmph.)    But most of the hacks have involved just using Arduinos to provide input signals to more complicated commercial synthesizers...

We should get some like-minded folk together and do some experiments!

... or you could use our product, Rogue Robotics uMP3 Playback Module.

I'm whipping together a library now, so it should be as easy as:

Code: [Select]
ump3.play("/mysongs/song.mp3");

I'll update the playground once I get the library complete.

You can buy the module from RobotShop.us or from one of our other distributors.

b



Mike Mc

I'm currently about to experiment with an SN76477 Sound Generator IC.

westfw

As an update, I've been experimenting with a hack of 3-bit DAC (1k, 560, 200 ohm resistors and a speaker),
and I've been able to get much more interesting sounds than the usual square-wave beep.  For instance:
Code: [Select]
#define NOISEINT 30
void drumbeat(int len1, int len2)
{
 int i;
 long t;
 for (i=0; i < len1; i++) {
   write_DA(random(8));  //attack
   delayMicroseconds(NOISEINT);
 }
 for (i=0; i < 30; i++) {
   write_DA(random(6));  //sustain
   delayMicroseconds(NOISEINT);
 }  
 for (i=0; i < 30; i++) {
   write_DA(random(4));  //sustain
   delayMicroseconds(NOISEINT);
 }  
 for (i=0; i < 30; i++) {
   write_DA(random(3));  //sustain
   delayMicroseconds(NOISEINT);
 }  
 for (i=0; i < 150; i++) {
   write_DA(random(2));  //decay
   delayMicroseconds(NOISEINT);
 }
 delay(len2 - 6);
 //  t = len2 - (20*len1) - (600+600+600+4000)
}

Mike Mc


Go Up