PDA

View Full Version : needed: most annoying piezo alarm tones



xanadu
03-08-2012, 06:29 PM
Anyone got any really annoying piezo melodies to share?

Duane Degn
03-08-2012, 06:37 PM
This is what I use when I get an error with my datalogging equipment.

I'm not sure if the sound is so annoying or if it's annoying because I associate with an error.


PUB Init(piezoPin)
'' AND TIMING FOR MANY FUNCTION, typically:
'' BS2.Start
pin := piezoPin
s:= clkfreq ' Clock cycles for 1 s
ms:= clkfreq / 1_000 ' Clock cycles for 1 ms
us:= clkfreq / 1_000_000 ' Clock cycles for 1 us
Last_Freq := 0 ' Holds last setting for FREQOUT_SET
note[0] := 262 'c'
note[1] := 294 'd'
note[2] := 330 'e'
note[3] := 349 'f'
note[4] := 392 'g'
note[5] := 440 'a'
note[6] := 494 'b'
note[7] := 523 'c"
note[8] := 587 'd"
note[9] := 659 'e"
note[10] := 698 'f"
note[11] := 784 'g"
note[12] := 880 'a"
note[13] := 988 'b"
note[14] := 1047 'c"'

PUB Bonk
Freqout(250, note[4])
Freqout(750, note[0])
PRI FREQOUT(Duration, Frequency)
{{
Plays frequency defines on pin for duration in mS, does NOT support dual frequencies.
BS2.Freqout(5,500,2500) ' Produces 2500Hz on Pin 5 for 500 mSec
}}
Update(Frequency,0) ' Set tone using FREQOUT_Set
Pause(Duration) ' duration pause
Update(0,0) ' stop tone

PUB PAUSE(Duration) | clkCycles
{{
Causes a pause for the duration in mS
Smallest value is 2 at clkfreq = 5Mhz, higher frequencies may use 1
Largest value is around 50 seconds at 80Mhz.
BS2.Pause(1000) ' 1 second pause
}}
clkCycles := Duration * ms-2300 #> cntMin ' duration * clk cycles for ms
' - inst. time, min cntMin
waitcnt( clkCycles + cnt ) ' wait until clk gets there




Do you have a S2 robot. It makes lots of great sounds.