• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Improving PWM audio quality

Status
Not open for further replies.

StudentSA

Member
Good Day,

The raspberry pi generates its audio using PWM and passing the signal through a passive Bandpass filter:

raspberry_pi_audiofilter.png

I am trying to create an audio player (for indoor use) by passing the audio signal into and amplifier and into a pair of small (1.25" -> 2") 4Ohm speakers.
I am currently playing around with the PAM8406 amplifier and it delivers a decent audio.

My question is, on a budget of a few dollars ( like < $5), is there any additional "filter" circuitry I can add to the pi output and any better general purpose ampifier IC that can be recommended to improve the clarity and maximize sound generated.

Currently with the PAM8406 turned up to full there is a noticeable ssssshhhhh sound with and without audio playing.

Thanks,
StudentSA
 

alec_t

Well-Known Member
Most Helpful Member
With the amp audio input shorted, do you still get that sound? If so, the noise source is within the amp and tinkering with the PWM won't be of benefit.
 

StudentSA

Member
Good point,
The pi does some interesting things on the PWM channel,
firstly with no sound playing the sssshhhh kinda ticks along to processes running, like if i run an intensivee application is changes its pitch and ticks along. Once the process ends its just the normal ssshhhh.
secondly, while actually playing audio the ssssshhh is louder (in the periods of silence) than when there is no audio playing. I think I read somewhere the PWM is switched off when audio is not being used.

Anyhow to your question, shorting the input pins to the amp does not significantly reduce the ssshhh.
Tnx.
 

crutschow

Well-Known Member
Most Helpful Member
Anyhow to your question, shorting the input pins to the amp does not significantly reduce the ssshhh.
Then the problem is with the amp, not the PWM signal.
 

StudentSA

Member
Fudge!, sorry! I meant to say the opposite. i.e. when I unplug the input from the pi it has a soft shhhh and if i short it it is still a soft shhh. when I plug it into the pi and play audio it is a loud ssshhh.
 

alec_t

Well-Known Member
Most Helpful Member
I didn't say short the audio input to the pi; I said 'with the audio input to the amp shorted' (no pi connection).
From your description, the noise may be due to currents in the ground rail and nothing to do with the PWM.
 

crutschow

Well-Known Member
Most Helpful Member
Your RC filter corner is ≈50kHz which is higher than you need..
You might try reducing that to ≈20kHz by increasing the capacitors to 82nF and see if that makes a difference.
 

audioguru

Well-Known Member
Most Helpful Member
Shhhh is high audio frequencies. If you use a filter to cut that sound then music and speech will have no high audio frequencies and will sound like an AM radio or an old telephone.
 

StudentSA

Member
Hi, I see I'm causing confusion through my ambiguity :)

So this is the layout:

PiSound.png

The Raspberry Pi generates the audio signal passes it into the amp circuit and then speakers.

alec, I unplugged the "Signal Out" cable i.e. the amp and speaker are now a separate entity. The shh was soft. I then went further to short the "Signal In" input to ground which reduced the shh ever so slightly. But with the pi setup as above the shh is louder when playing audio at full volume.
On your point of ground rail currents, is there a way to reduce/isolate this?

Lets say that the pis PWM filter circuit cannot be improved, I have also noticed that the PAM8403 was worse on clarity than the PAM8406 that I am currently prototyping with. I believe the SNR is better on the 8406 which improves the clarity considerably.

I guess my question would then be around any suggestions for better lowish cost audio amp IC's?

audioguru, Im all for high audio frequencies, but the shh is a tad too loud for my ears, I'm sure it can be improved.

Tnx,
 

schmitt trigger

Well-Known Member
Do you have access to an oscilloscope, even if you have to borrow one?

I agree with AG, if you are able to listen to it, either the PWM carrier is too low, or you got an intermodulation product.....most likely the second.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Do you have access to an oscilloscope, even if you have to borrow one?

I agree with AG, if you are able to listen to it, either the PWM carrier is too low, or you got an intermodulation product.....most likely the second.
I would suggest it's not the PWM at all (as you say, that will be far too high), and possibly just switching noise from the PI.
 

audioguru

Well-Known Member
Most Helpful Member
The PAM amplifiers are very cheap so I guess they do not have hifi low noise.
 

alec_t

Well-Known Member
Most Helpful Member
On your point of ground rail currents, is there a way to reduce/isolate this?
Yes. In the pic below, 'A' shows a shared ground rail layout where Pi current causes voltage drop on the ground rail, which will affect the amp. 'B' shows a star ground layout, where Pi current won't affect the amp.
Grounding.PNG
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top