I have an audio circuit setup currently in which a microcontroller (PIC32MM) sends PWM signals to an amplifier which is attached to some speakers in order to hear what is going on. I have attached a diagram of the connection from the micro to the amplifier.

When testing the code, I can hear that sound is being emitted, but it is in a distorted and high pitched way that I cannot make out the sounds, since it should be saying specific words.

I have also attached oscilloscope graph of signal coming from the micro with measurements. I would like to know how I could bring down the pitch of the sound since currently its very high pitched or squeaky and then if it is still distorted how to resolve that issue if it exists.

enter image description here

enter image description here

enter image description here


  • 1
    \$\begingroup\$ What is the PWM frequency? I don't see a filter to remove the PWM signal to convert it back to normal audio. \$\endgroup\$
    – JRE
    Dec 5 '20 at 22:24
  • 1
    \$\begingroup\$ Your schematic is too hard to read. I don't see a low-pass filter. What is your PWM frequency, it seems to be way too low? Your scope measurements are meaningless when the waveforms are complex. You need to zoom so only a few cycles are shown. \$\endgroup\$
    – Mattman944
    Dec 5 '20 at 22:26
  • \$\begingroup\$ What's your audio source? Pitch error would come from incorrect playback speed, eg recording at one sample rate and playing back at another, not an error in your output circuit. \$\endgroup\$ Dec 5 '20 at 22:53
  • 2
    \$\begingroup\$ The 'scope says 8.3kHz. If that is the PWM carrier frequency then that is what produces the high pitched squeaking. Make the frequency 25kHz or higher so it cannot be heard. The groups of 3 or 4 pulses then a gap then more pulses then a gap is not PWM because the pulses widths do not change. \$\endgroup\$
    – Audioguru
    Dec 5 '20 at 23:32
  • \$\begingroup\$ So I have attached a better schematic and also an audio file that represents what I am hearing when playing the sound, I have not tried any of the previous solutions yet but wanted to provide this extra information first before attempting any solutions so that I can try the most helpful ones \$\endgroup\$
    – daswer
    Dec 17 '20 at 7:28

C2 and R1+R2 acts as high-pass filter with about 80Hz cut-off frequency. To demodulate PWM signal you also need LOW-PASS filter to filter PWM carrier. Your schematic lack any form of low-pass filter.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ so how should the schematic be rearranged, I am able to desolder caps and resistors and replace with same dimension counterparts at varying capacity/resistance \$\endgroup\$
    – daswer
    Dec 17 '20 at 9:49
  • \$\begingroup\$ @daswer I have added schematic with low-pass filter - in general you should not stack passive filters without buffers in between but in this case it should work. \$\endgroup\$
    – ufok
    Dec 17 '20 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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