  ' {$STAMP BS2}
' ========================================================================
' Program... SOUNDS.BS2
' Author.... Robert Jordan (modified by Jon Williams)
' Started... 03 SEP 2000
' Updated... 07 SEP 2000
' ========================================================================
' -----[ Program Description ]--------------------------------------------
'
' This program demonstrates the versatility of the Stamp 2 FREQOUT
' command.
' -----[ Revision History ]-----------------------------------------------
'
' -----[ I/O Definitions ]------------------------------------------------
'
Spkr CON 12 ' speaker port
spgnd CON 13 'spk gnd
row3  CON 0
row2  CON 1
row1  CON 2
LED1  CON 11
LED2  CON 10
LED3  CON 9
LED4  CON 8
LED5  CON 7
LED6  CON 6
LED7  CON 5
LED8  CON 4
LED9  CON 3
' -----[ Constants ]------------------------------------------------------
'
LOW spgnd
R CON 0 ' rest
C CON 33 ' ideal is 32.703
Cs CON 35 ' ideal is 34.648
D CON 37 ' ideal is 36.708
Ds CON 39 ' ideal is 38.891
E CON 41 ' ideal is 41.203
F CON 44 ' ideal is 43.654
Fs CON 46 ' ideal is 46.249
G CON 49 ' ideal is 48.999
Gs CON 52 ' ideal is 51.913
A CON 55 ' ideal is 55.000
As CON 58 ' ideal is 58.270
B CON 62 ' ideal is 61.735
N1 CON 500 ' whole note
N2 CON N1/2 ' half note
N3 CON N1/3 ' third note
N4 CON N1/4 ' quarter note
N8 CON N1/8 ' eighth note
' -----[ Variables ]------------------------------------------------------
'
x VAR Word ' loop counter
note1 VAR Word ' first tone for FREQOUT
note2 VAR Word ' second tone for FREQOUT
dur VAR Word ' duration for FREQOUT
oct1 VAR Nib ' octave for freq1 (1 - 8)
oct2 VAR Nib ' octave for freq2 (1 - 8)
ee VAR Byte ' EEPROM pointer
digit VAR Byte ' DTMF digit
clkDly VAR Word ' delay betweens "clicks"







Computer_Beeps: ' looks great with randmom LEDs
DEBUG "50's Sci-Fi Computer",CR
FOR x = 1 TO 50 ' run about 5 seconds
RANDOM note1 ' create random note
note1 = note1 // 2000 ' don't let note go to high
FREQOUT Spkr,50,note1 ' play it
PAUSE 100 ' short pause between notes
NEXT