NOPE! Banged my head against this for a couple hours before giving up and throwing a support request up on reddit.com woke up this morning to an answer. Func=2 not 4 if you are using the right channel for a mono speaker and pin18. Seems strange that the func=# would differ between 13 vs 18...Popcorn wrote:You can follow my circuit above, that is mono.joe7dust wrote: Wow grats on making this looking somewhat user-friendly. I took one look at the adafruit guide and was like NOPE not worth the effort, but this actually looks quite doable now.
Would someone mind telling me what I would need to change on this if I only wanted mono sound? I don't plan to have a headphone jack at all, just a single speaker that was pulled from an old laptop. I'm not exactly a connoisseur of gameboy beeps and bloops at 8-bit or whatever it was encoded at, and mono will be just perfect for that. Also I don't think the original had stereo speaker output at all, it only affects the headphone jack I think.
edit: Also, I don't need a potentiometer. I plan to keep the volume at a fixed level!
Just add this to your /boot/config.txt
Code: Select all
dtoverlay=pwm,pin=13,func=4
PWM Audio Guide
Re: PWM Audio Guide
A kind redditor noticed the mistake right away. It is supposed to be func =2 not 4 if you are using the right channel for a mono speaker.
- Popcorn
- Trailblazer
- Posts: 354
- Joined: Thu May 05, 2016 12:58 am
- Location: Berlin
- Has thanked: 29 times
- Been thanked: 71 times
Re: PWM Audio Guide
^^ It's not really a mistake. You have to pick which side you want outputted as the mono channel. Either the left or the right side sent to the GPIO driver which is either 2 or 4. Both will work.
- alien0matic
- Posts: 102
- Joined: Wed Jun 08, 2016 7:20 am
- Has thanked: 15 times
- Been thanked: 23 times
Re: PWM Audio Guide
Please don't kill me if this is a stupid question... does it have to be a 0.033uF capacitor? Only thing I could get was a 0.047uF.
Re: PWM Audio Guide
I believe it would be fine but I am not quite sure. I do know adafruit used a 0.01uF and claimed they would just have a higher cutoff frequency with nearly no audible change. So you may have a lower cutoff frequency? If someone else knows for sure this is safe to do please help him out. I don't have enough knowledge on this to say if you are good with a 0.047 or not.alien0matic wrote:Please don't kill me if this is a stupid question... does it have to be a 0.033uF capacitor? Only thing I could get was a 0.047uF.
- Popcorn
- Trailblazer
- Posts: 354
- Joined: Thu May 05, 2016 12:58 am
- Location: Berlin
- Has thanked: 29 times
- Been thanked: 71 times
Re: PWM Audio Guide
This is the problem. There is no dtoverlay called pwm-1chan.SP33 wrote:I have not tried mono sound myself yet but from my own tests, pin 18 was outputting in the right channel so I believe pin2 and func2 would be for left channel (pin 13)Ganreizu wrote:So say i'm doing mono sound, is this the code i would use?
(for left channel?)Code: Select all
dtoverlay=pwm-1chan,pin=18,func=2
vs
Code: Select all
dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
so either tryorCode: Select all
dtoverlay=pwm-1chan,pin2=13,func2=4
(I'm unsure if pwm-1chan is valid)Code: Select all
dtoverlay=pwm-2chan,pin2=13,func2=4
or you could just use the original code and not use pin 18, only hook up pin 13 (left channel) just to be sure.
It's either "pwm" for mono or "pwm-2chan" for stereo. There is no "pwm-1chan".
-
- Posts: 10
- Joined: Wed May 04, 2016 10:23 pm
- Has thanked: 2 times
- Been thanked: 2 times
Re: PWM Audio Guide
I have mono audio working but.....
As an example, playing Sonic the sound of the ring collection alternates between the left and right channel. As its set up now I only get every second ring sound. I thought as mono sound it would mix both left and right and output both mixed to one speaker.
I have it wired up exactly as per Wermys guide with the mono low pass filter.
I have also constructed a stereo low pass filter to install if required.
Could someone help me with either what I am doing wrong with the mono audio, or how to wire up stereo audio to the amp (and the headphone jack)
Thanks in advance
As an example, playing Sonic the sound of the ring collection alternates between the left and right channel. As its set up now I only get every second ring sound. I thought as mono sound it would mix both left and right and output both mixed to one speaker.
I have it wired up exactly as per Wermys guide with the mono low pass filter.
I have also constructed a stereo low pass filter to install if required.
Could someone help me with either what I am doing wrong with the mono audio, or how to wire up stereo audio to the amp (and the headphone jack)
Thanks in advance
-
- Posts: 5
- Joined: Wed Jun 29, 2016 9:55 am
- Location: PA, USA
- Been thanked: 1 time
- Contact:
Re: PWM Audio Guide
Will someone please let me know what GPIO pins we're actually using? e.g. Are we using BOARD numbering? or BCM numbering?
I cannot seem to find this info for the life of me
I cannot seem to find this info for the life of me

Re: PWM Audio Guide
13 & 18 for stereo. I use 18 on mono in my guidedantheflipman wrote:Will someone please let me know what GPIO pins we're actually using? e.g. Are we using BOARD numbering? or BCM numbering?
I cannot seem to find this info for the life of me
Re: PWM Audio Guide
Sorry to sound thick, but just to check that this connects to two GPIO pins at one end (not sure where the ground goes) and then can the other end be straight connected to a 3.5mm stereo jack block?
I'm not sure yet how I'd control volume. Any suggestions would be most appreciated
Thanks
Also, do you need that blue amplifier board as well that's used in the video?
Edit:- As I'm not using an original gameboy, I don't have anywhere to fix the potentiometer to, so it looks like I might just have to go the usb audio route sadly
I'm not sure yet how I'd control volume. Any suggestions would be most appreciated

Also, do you need that blue amplifier board as well that's used in the video?
Edit:- As I'm not using an original gameboy, I don't have anywhere to fix the potentiometer to, so it looks like I might just have to go the usb audio route sadly

- RxBrad
- Posts: 278
- Joined: Fri Jul 22, 2016 9:10 am
- Has thanked: 125 times
- Been thanked: 160 times
- Contact:
Re: PWM Audio Guide
So, I built the stereo circuit. I've been scouring the forum, and for life of me, I can't figure out how I'd wire up the circuit, pot, and headphone jack so I get stereo output through headphones, and the left/right channels are COMBINED through the speaker. While MOST games are mono, as previously mentioned, some are stereo (e.g. Sonic ring collection sound effects). If I only wired one channel to the speaker, some sounds wouldn't play.
Can anyone point me in the right direction.
EDIT 3: I believe that all of the stuff below applies to pre-amped signals, and those resistor values would make the audio from the speaker unusably low. I'm also guessing that the higher resistance across the active signal and ground are already accomplished through the pot. The actual answer appears to be in the diagrams here.
EDIT: Figure 2 on this page looks promising. The input would be coming from the headphone jack, and the output going into the speaker. Looking around, I've seen other similar diagrams that recommend 1k resistors in place of the 475ohm resistors. I'm just not 100% sure how to interpret the diagram. Is the bottom line the ground? (EDIT 2: yes it is .. S = shield/ground)

Can anyone point me in the right direction.
EDIT 3: I believe that all of the stuff below applies to pre-amped signals, and those resistor values would make the audio from the speaker unusably low. I'm also guessing that the higher resistance across the active signal and ground are already accomplished through the pot. The actual answer appears to be in the diagrams here.
EDIT: Figure 2 on this page looks promising. The input would be coming from the headphone jack, and the output going into the speaker. Looking around, I've seen other similar diagrams that recommend 1k resistors in place of the 475ohm resistors. I'm just not 100% sure how to interpret the diagram. Is the bottom line the ground? (EDIT 2: yes it is .. S = shield/ground)

Who is online
Users browsing this forum: No registered users and 1 guest