I can’t find an example of a simple “BEEP” micropython program. I don’t want to play a fancy .wav file or create the next Top 40 pop tune. I just want to make the on board speaker make a simple alarm type sound for a second or so.
I just recently had the same thought. I haven’t sat down to give it a go though. I can’t find my round 2it. ;)
I’m going to tag along to see if anybody has some code. If that doesn’t happen I’ll give a go next week some time.
Thanks. How I missed those references after all the searching I did is beyond me.
This is my quickie crap code that does work. Thanks again for getting me on track!
I am absolutely certain others can improve on this…
import time
from galactic import GalacticUnicorn
gu = GalacticUnicorn()
channels = [gu.synth_channel(i) for i in range(1)]
volume = .5 # range is 0 to 1
start_tone = 500
end_tone = 1000
for tone in range(start_tone, end_tone):
print("Tone freq:", tone)
channels[0].play_tone(tone, volume)
gu.play_synth()
#time.sleep(.01)
gu.stop_playing()
print("end")