I'm writing a metronome sort of program for a friend... using the BEEPER as the sound source... I have it as "blip" in the program.
User selects how many BPM... hits "START"... it starts it's 1,2,3,4...1,2,3,4... counting... each time making a "blip" sound...
Works great about 5 seconds... then stops producing sound. :sign0085:
Under GLOBALS I have this...
When I first start the program I do this...
Then the main sound generation loop is contained in a TIMER1 like this...
Runs well about 5 seconds... then no more sound.
Thoughts???
Thanks,
Jerry
File should be attached.
User selects how many BPM... hits "START"... it starts it's 1,2,3,4...1,2,3,4... counting... each time making a "blip" sound...
Works great about 5 seconds... then stops producing sound. :sign0085:
Under GLOBALS I have this...
B4X:
Dim blip As Beeper ' Noisemaker
When I first start the program I do this...
B4X:
blip.Initialize(100, 2000) ' Initial tone on startup.
blip.beep ' Make wakeup sound.
Then the main sound generation loop is contained in a TIMER1 like this...
B4X:
Sub Timer1_tick
' First blip
If note=1 Then
blip.Initialize(halfbeat, 2000) ' milliseconds, hz
End If
' All other blips
If note>1 Then
blip.Initialize(halfbeat, 1500) ' milliseconds, hz
End If
' Dull Redish Brown
LED1.Color=Colors.RGB(165,42,42)
LED2.Color=Colors.RGB(165,42,42)
LED3.Color=Colors.RGB(165,42,42)
LED4.Color=Colors.RGB(165,42,42)
' Bright Yellow
If note=1 Then LED1.Color=Colors.RGB(255,215,0)
If note=2 Then LED2.Color=Colors.RGB(255,215,0)
If note=3 Then LED3.Color=Colors.RGB(255,215,0)
If note=4 Then LED4.Color=Colors.RGB(255,215,0)
DoEvents
' Make a tone depending on beat number.
blip.Beep
' Increment cycle
note=note+1
' If greater than higest allowed, reset to one.
If note>4 Then note=1
End Sub
Runs well about 5 seconds... then no more sound.
Thoughts???
Thanks,
Jerry
File should be attached.