Pages: [1]   Go Down
Author Topic: Piezo Buzzer - Win and Fail Sound  (Read 1559 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, i am searching for two sound examples for my piezo buzzer.
Currently i am using the piezo with the example from arduino
Code:
int melody[] = {
  262, 196,196, 220, 196,0, 247, 262};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 8, 8, 4,4,4,4,4 };

 for (int thisNote = 0; thisNote < 8; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(12, melody[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    noTone(12);
    }

But i am searching for a sound that underlines whether the user won or lost. But i can't find any examples for arduino/piezo sounds. So maybe you have some hints for me where i can find sounds like that for my arduino, or maybe you composed sounds like that by yourself smiley ?!

Thanks
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I use two low notes - duh, duuhh to indicate fail and two fast arpeggios of higher notes for winning, you can hear them here, its not going to win any grammies, but you know whether you got a good lap or not.



Duane B

rcarduino.blogspot.com
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, first of all great project ! I like the sounds very much. Do you think you could send me the melody and noteDurations array for these two sounds ?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Its inline in the code like so, converting to an array would be better but I was experimenting with tunes this way -

Build your own lap timer here -

http://rcarduino.blogspot.com/2012/07/lap-timer-build-along-part-one.html

Code:
if(lapTime == bestLapTime)
       {
         for(uint8_t nLoop = 0;nLoop < 2;nLoop ++)
         {
           tone(sAudioPin,NOTE_A5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_B5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_C5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_B5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_C5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_D5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_C5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_D5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_E5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_D5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_E5);
           delay(NOTE_SUSTAIN);
           tone(sAudioPin,NOTE_E5);
           delay(NOTE_SUSTAIN);
         }
         noTone(sAudioPin);
       }
       else
       {
           tone(sAudioPin,NOTE_G4);
           delay(250);
           tone(sAudioPin,NOTE_C4);
           delay(500);
           noTone(sAudioPin);
       }
« Last Edit: December 12, 2012, 09:24:15 am by DuaneB » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks a lot smiley
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you Piezo still sounds a bit underwhelming you can try using a simple amplifier and a speaker for better quality sound -

http://rcarduino.blogspot.com/2012/08/adding-audio-to-arduino-projects.html

Duane B

rcarduino.blogspot.com
Logged


Pages: [1]   Go Up
Jump to: