Raspberry Pi: Audio Output via GPIO

If you need audio out from the Raspberry Pi's GPIO (in case you are using an Raspberry pi0 that doesn't have audio jack):

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4

If you need mono audio (in case GPIO pins are used in another way, for example GPIO controllers), you must connect GPIO13 (pin33) only and GROUND. In this case the string is

dtoverlay=pwm,pin=13,func=4

For better audio, you can add a filter and an amplifier before connecting speaker/headphones.