Simple C++ Audio on Pico

Hi, I’ve reached the end of google looking for an answer in C++ and thought I’d post here. My project requires a simple audio alarm. I would like to at least test it on the Pico Explorer, but ultimately it will be delivered via a simple shielded wire to a commercial audio amplifier/control panel.

The requirement is simple: I just need a monotone alert at a bare minimum, but would prefer a tri-tone alert or rising & falling horn-type sound. The Pico_Audio example is way too complex for what I need – I actually need a boring sine wave :D and my knowledge is “dated” at best. Perhaps a simple sine wave from a DAC or output it from a GPIO at a certain freq, or use the ADC somehow?? I’m at a loss.

I have found a few examples in MicroPython, but I’d like to stay with C++ because 95% of my project is done. I simply cannot find the Buzzer object as mentioned in the Pico_Explorer ReadMe. I also can’t seem to figure out how to implement the examples in the Pico_Extras library either.

Any help would be appreciated.

you should search for “passive buzzer” (and maybe Arduino). A passive buzzer needs a digital IO, that’s all. And the Arduino examples should be easily portable to C++. But that is nothing for an audio-amplifier.

1 Like