Connect with us

PWM Audio

Discussion in 'Audio' started by Raven Luni, May 30, 2012.

Scroll to continue with content
  1. Raven Luni

    Raven Luni

    798
    8
    Oct 15, 2011
    I've made use of PWM in software (for lossless downsampling among other things) and was thinking of trying my hand at a few electronic projects including a class d amplifier and a 'perfect' ring modulator (no diode losses) among other things (its actually a good way to cheat at maths since most operations can be reduced to simple logic).

    Anyway - I think my understanding of the subject is at odds with what I've been reading - particularly with class d amplifiers. Most sources say you need a minimum 'carrier / encoding' frequency of 10x the maximum output frequency - but wouldnt that give you a hell of a quantisation error? Compared with a digital signal, that equates to a resolution of only 3.32 bits. By that reasoning, for a 16-bit CD quality signal, you'd have to be well into the gigahertz.

    Any light-shining would be much appreciated :)

    Dam - I meant to post this in the general forum - can somene move it - thanks :)
     
    Last edited: May 30, 2012
  2. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    At 200 KHz to get 16 bit resoltution you would need indeed need 13GHz counters. I suspect most class D audio amplifiers don't supply anything like 16 bit accuracy, or they are analog.

    Bob
     
  3. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
  4. Raven Luni

    Raven Luni

    798
    8
    Oct 15, 2011
    Nice bit of info there with some valuable points particularly dead times / shootthrough condition.

    I still dont see how a 100% analog solution would be immune to quantisation effects though. If you are comparing an input signal with a triangle or sawtooth wave (linear slope is required so that there is an even 50% coverage reflecting values on a linear scale), if that wave is 10x the maximum desired frequency of an input signal then basically what you have is a PWM signal with 10 high or low values representing each discrete part of the signal. These are all effectively added to give the final output, so any point in the signal is basically represented by one of 10 possible energy levels - which is rather poor compared to the 65536 in a 16-bit digital signal.
     
  5. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    No, it is not 10 high or low values that are representing the audio level, it is the length of the high part of a variable duty square wave. This length is a continuum with no steps at all.

    Lets look at it this way, representing a DC signal of various voltages. The PWM period is, lets say 10 usec and the V+ voltage is 10V.

    To represent 1 volt, I turn the signal on for 1usec of each 10usec period.
    To represent 2 volts I turn the signal on for 2usec of each 10usec period.
    ...
    To represent 10 volts I turn the signal on for 10usec of each 10usec period.

    Those are 10 steps, but also:

    To represent 1.5V I turn the signal on for 1.5usec of the 10usec period.
    To represent 3.14159V I turn the signal on for 3.14159 usec of the 10usec period.

    Filtering then removes the high carrier frequency leaving us with a nice DC voltage as stated above. The requirement that the carrier is 10X the frequency to be reproduced is just to make the filtering easy, it can theoretically work at 2X.

    AC is just a changing DC voltage, so in each PWM period I match the instantaneous DC voltage of the audio signal with the corresponding duty cycle for that PWM period. At max frequency, the wave is only sampled 10 times across the entire sine wave, but the filtering basically fills in the blanks with a smooth curve that nearly reproduces the original sine wave. And if, say that max is 20KHz then any error in the waveform will show up as a harmonic at 40KHz or higher, which you cannot hear, though your dog might complain about the poor audio quality.

    Bob
     
  6. Raven Luni

    Raven Luni

    798
    8
    Oct 15, 2011
    Riiight - I was thinking in terms of cycles rather than the fact that the comparison is done continuously and not at intervals. I need to stop thinking digitally :p

    Thanks :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-