Go Down

Topic: Piezo Buzzer - Win and Fail Sound (Read 1 time) previous topic - next topic

dehlen

Hey, i am searching for two sound examples for my piezo buzzer.
Currently i am using the piezo with the example from arduino
Code: [Select]

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 :) ?!

Thanks

DuaneB

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.

http://www.youtube.com/watch?v=0_IP14gFKcI&feature=plcp

Duane B

rcarduino.blogspot.com
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

dehlen

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 ?

DuaneB

#3
Dec 12, 2012, 03:09 pm Last Edit: Dec 12, 2012, 03:24 pm by DuaneB Reason: 1
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: [Select]

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);
      }
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com


DuaneB

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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview