Go Down

Topic: Audio Feedback (Read 455 times) previous topic - next topic

JesseW6889

Hello everyone!

I'm working on a lockbox with keypad access and I'm interested in using piezo buzzer audio for feedback, i.e. key presses, incorrect pin, correct pin, etc.

For example, type in the correct 4 digit pin number, press enter and it plays an upbeat tune and then unlocks the box. Same for incorrect pin entries, play a downbeat tune to indicate an incorrect entry.

I know about tone() and the 'Play Melody' example, I'm just trying to figure out how to determine the values to make the sounds that I am looking for.

Any ideas?! Thanks!

DVDdoug

Quote
I'm just trying to figure out how to determine the values to make the sounds that I am looking for.
I think that's a "creative decision" you'll have to make yourself.

If you look at the standard Western Musical Scale, two notes next to each other (say B and, C or C and C-sharp) sound dissonant ("sour") when played together or in sequence.  If you skip a note (such as C and D, skipping C-sharp) those notes sound "sweet" when played together or in sequence. 

Try not to get confused by sharps & flats...  C is one full-note above B, and C# is one full-note above C.  The spacing between the 12 notes is equal (logarithmically or percentage-wise) but instead of naming the notes A-L, they used A-G with sharps & flats for some notes.

I made a little pass/fail sound routine a long time ago.  It runs on a PC, and it was written in BASIC so the actual code would be useless to you.  The pass sound is a rising-tone that's supposed to sound pleasing.   The fail sound is is two falling-tones that are supposed to sound dissonant .

The sequences are:
Pass -
500 Hz, 300 ms
700 Hz, 400 ms
900 Hz, 300 ms

Fail -
500 Hz, 300 ms
150 Hz, 500  ms
450 Hz, 300 ms
130 Hz, 700 ms

These frequencies might be too low for a piezo.  If that turns-out to be the case, you can try doubling or tripling them, etc. 

Go Up