Galactic Unicorn: I just want a simple "BEEP"

First off, the Galactic Unicorn; WOW!

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.

Can any would provide or point me to an example?

Thanks!

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.

1 Like

I will say that ChatGPT is full of suggestions, yet none of it’s code will cause a 'BEEP".
I guess that’s a win for real programmers!

I would think you want a sine wave, at a set frequency, with a short duration.
pimoroni-pico/README.md at main · pimoroni/pimoroni-pico (github.com)

Alpha:

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")


2 Likes

Cool, I’ll give it a listen in a bit.

Finally had a chance to give it a listen. Kinda sounds like water dripping. =)

Right! Of course, that is from sweeping the frequency of the tone.
Anyway, glad it worked for you and thanks for the link.

1 Like