TheInfoList

Pulse-density modulation, or PDM, is a form of modulation used to represent an analog signal with a binary signal. In a PDM signal, specific amplitude values are not encoded into codewords of pulses of different weight as they would be in pulse-code modulation (PCM); rather, the relative density of the pulses corresponds to the analog signal's amplitude. The output of a 1-bit DAC is the same as the PDM encoding of the signal. Pulse-width modulation (PWM) is a special case of PDM where the switching frequency is fixed and all the pulses corresponding to one sample are contiguous in the digital signal. For a 50% voltage with a resolution of 8-bits, a PWM waveform will turn on for 128 clock cycles and then off for the remaining 128 cycles. With PDM and the same clock rate the signal would alternate between on and off every other cycle. The average is 50% for both waveforms, but the PDM signal switches more often. For 100% or 0% level, they are the same.

Description

In a pulse-density modulation bitstream a 1 corresponds to a pulse of positive polarity (+''A''), and a 0 corresponds to a pulse of negative polarity (−''A''). Mathematically, this can be represented as : $x= -A \left(-1\right)^,$ where ''x'''n''is the bipolar bitstream (either −''A'' or +''A''), and ''a'''n''is the corresponding binary bitstream (either 0 or 1). A run consisting of all 1s would correspond to the maximum (positive) amplitude value, all 0s would correspond to the minimum (negative) amplitude value, and alternating 1s and 0s would correspond to a zero amplitude value. The continuous amplitude waveform is recovered by low-pass filtering the bipolar PDM bitstream.

Examples

A single period of the trigonometric sine function, sampled 100 times and represented as a PDM bitstream, is: 0101011011110111111111111111111111011111101101101010100100100000010000000000000000000001000010010101 Two periods of a higher frequency sine wave would appear as: 0101101111111111111101101010010000000000000100010011011101111111111111011010100100000000000000100101 In pulse-''density'' modulation, a high ''density'' of 1s occurs at the peaks of the sine wave, while a low ''density'' of 1s occurs at the troughs of the sine wave.

Analog-to-digital conversion

A PDM bitstream is encoded from an analog signal through the process of delta-sigma modulation. This process uses a one-bit quantizer that produces either a 1 or 0 depending on the amplitude of the analog signal. A 1 or 0 corresponds to a signal that is all the way up or all the way down, respectively. Because in the real world, analog signals are rarely all the way in one direction, there is a quantization error, the difference between the 1 or 0 and the actual amplitude it represents. This error is fed back negatively in the ΔΣ process loop. In this way, every error successively influences every other quantization measurement and its error. This has the effect of averaging out the quantization error.

Digital-to-analog conversion

The process of decoding a PDM signal into an analog one is simple: one only has to pass the PDM signal through a low-pass filter. This works because the function of a low-pass filter is essentially to average the signal. The average amplitude of pulses is measured by the density of those pulses over time, thus a low-pass filter is the only step required in the decoding process.

Relationship to biology

Notably, one of the ways animal nervous systems represent sensory and other information is through rate coding whereby the magnitude of the signal is related to the rate of firing of the sensory neuron. In direct analogy, each neural event – called an action potential – represents one bit (pulse), with the rate of firing of the neuron representing the pulse density.

Algorithm

right|thumb|300px|Pulse-density modulation of a sine wave using this algorithm A digital model of pulse-density modulation can be obtained from a digital model of the delta-sigma modulator. Consider a signal $x/math> in thediscrete timedomain as the input to a first-order delta-sigma modulator, withy/math> the output. In thediscrete frequencydomain, where theZ-transformhas been applied to the amplitude time-seriesx/math> to yieldX\left(z\right), the outputY\left(z\right)of the delta-sigma modulator\text{'}s operation is represented by :Y\left(z\right) = X\left(z\right) + E\left(z\right) \left\left(1 - z^\right\right),whereE\left(z\right)is the frequency-domainquantization errorof the delta-sigma modulator. Rearranging terms, we obtain :Y\left(z\right) = E\left(z\right) + \left\left(z\right) - Y\left(z\right) z^\right\left\left(\frac\right\right).The factor1 - z^represents ahigh-pass filter, so it is clear thatE\left(z\right)contributes less to the outputY\left(z\right)at low frequencies and more at high frequencies. This demonstrates thenoise shapingeffect of the delta-sigma modulator: the quantization noise is "pushed" out of the low frequencies up into the high-frequency range. Using the inverseZ-transform, we may convert this into adifference equationrelating the input of the delta-sigma modulator to its output in thediscrete timedomain, :y= x+ e- e-1There are two additional constraints to consider: first, at each step the output sampley/math> is chosen so as to \text{'}\text{'}minimize\text{'}\text{'} the "running" quantization errore/math>. Second,y/math> is represented as a single bit, meaning it can take on only two values. We choosey= \pm 1for convenience, allowing us to write :\begin y&= \sgn\big\left(x- e-1big\right) \\ &= \begin +1 & x> e-1\\ -1 & x< e-1\end \\ &= \left(x- e-1+ e\\ \end:e\leftarrow y- \big\left(x- e-1big\right) = \sgn\big\left(x- e-1big\right) - \big\left(x- e-1big\right).This, finally, gives a formula for the output sampley/math> in terms of the input samplex/math>. The quantization error of each sample isfed backinto the input for the following sample. The following pseudo-code implements this algorithm to convert apulse-code modulationsignal into a PDM signal: \text{'}\text{'}// Encode samples into pulse-density modulation\text{'}\text{'} \text{'}\text{'}// using a first-order sigma-delta modulator\text{'}\text{'} function pdm\left(\text{'}\text{'}real..s\text{'} x, \text{'}\text{'}real\text{'}\text{'} qe = 0\right) \text{'}\text{'}// initial running error is zero\text{'}\text{'} var \text{'}\text{'}int..s\text{'} y for n from 0 to s do if x\ge qe then y:= 1 else y:= -1 qe := y- x+ qe return y, qe \text{'}\text{'}// return output and running error\text{'}\text{'}$

Applications

PDM is the encoding used in Sony's Super Audio CD (SACD) format, under the name Direct Stream Digital. Some systems transmit PDM stereo audio over a single data wire. The rising edge of the master clock indicates a bit from the left channel, while the falling edge of the master clock indicates a bit from the right channel.Knowles
"SPK0641 Digital, CMOS MEMS Microphone" (PDF)