Normally, to play music or other audio on a microcontroller, you need to purchase a DAC digital-to-analog converter.
This is the easiest way and the most likely to get good intelligible sound. However, programmer Salvatore Sanfilippo decided to do it with a Raspberry Pi Pico PCB, a single pin and a PWM output.
The PWM output is tuned to a very high frequency, beyond the reach of human hearing. In this case, 100 kHz. The duty cycle of the PWM is then varied to produce different levels of average voltage at the pin. The output voltage is varied to match the desired sound file, using each sample to vary the PWM duty cycle. Voila! You can output any sound you want to this pin! Salvatore Sanfilippo's website http://invece.org/ describes the basics of this work, including processing simple WAV files into a raw format that can be populated into MicroPython code.