I am unable to get audio output from the GPIO pins on my Raspberry Pi 4.

I initially added dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to the config.txt file in boot directory and used the GPIO pins 13 and 18 with filters to get audio output following this video but was unable to get any sound (there was only white noise).

I searched on the internet and found this answer, but it was still unclear to me whether dtoverlay=audremap,pins_12_13 and dtoverlay=audremap,pins_18_19 also need to be added, or only one, or do one of these replace the line mentioned before. Regardless, I tried a a lot combinations and so far nothing has worked. Every time I run sudo raspi-config and go to Audio, the two options are always 'HDMI 1' and 'Headphones'.

I apologize if I sound annoyed, but the fact that there is no explanation anywhere as to what dtoverlay=blah blah does here (I found no explanation for pwm-2chan or audremap, but a lot of other stuff about it that was way to confusing and overwhelming) or the fact that I have to write an entirely separate question due to StackExchange's reputation requirements for commenting are driving me insane.

I am running a Raspberry Pi 4 Model B with RetroPie 4.7.1 installed. My config.txt file only contains the following: (there are the usual comments between them)




If someone knowledgeable could please explain what dtoverlay does here, or could tell me what I'm doing wrong, I would be very grateful.

Edit: I am also confused how the alternate functions of GPIO pins like 12, 13, 18 and 19 are assigned; Is that what func and func2 is?

  • 1
    Just use dtoverlay=audremap,pins_12_13 nothing else.
    – CoderMike
    Commented May 21, 2021 at 19:38
  • @CoderMike and I guess that output is selected by the Headphones option. Why not make that an answer?
    – joan
    Commented May 21, 2021 at 19:49

2 Answers 2


"but the fact that there is no explanation anywhere"

The README file in /boot/overlays/ describes all the options and there is plenty of documentation in config-txt


The following worked for me on a raspberry pi zero




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.