Pages: [1]   Go Down
Author Topic: How to have arduino make sounds?  (Read 3139 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a whole section on audio in playground:
http://www.arduino.cc/playground/Main/InterfacingWithHardware#Output
Logged

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

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?
« Last Edit: September 12, 2009, 07:50:06 pm by ikestarm » Logged

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

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  smiley-wink

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25865
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

berlin
Offline Offline
Full Member
***
Karma: 0
Posts: 154
fubbi.com
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

or:

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

London, England
Offline Offline
Edison Member
*
Karma: 4
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London, England
Offline Offline
Edison Member
*
Karma: 4
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: September 14, 2009, 08:08:40 am by zooto68 » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6653
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Toronto, ON
Offline Offline
Full Member
***
Karma: 10
Posts: 233
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged


London, England
Offline Offline
Edison Member
*
Karma: 4
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6653
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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)
}
Logged

London, England
Offline Offline
Edison Member
*
Karma: 4
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any MP3's we can listen to?
Logged

Pages: [1]   Go Up
Jump to: