Raspberry Pi Pico
Pimoroni noise:bit

The noise:bit is one of my favourite micro:bit accessories. It is a speaker and amplifier built into something that slots nicely onto a micro:bit edge. It is one of the easiest things to connect to a Pico using something like the Pinbetween.

In the photograph, you see the noise:bit connected to a Pico. I have used female to male jumpers to connect from 3V to 3V3, GND to GND and pin0 to GP2 on the Pico. You can make that last connection to any GPIO pin.

Pico Circuit

After that, you can use any of the code that you would use to control a buzzer. You're going to get something a little louder than a buzzer.