## Audio-rate PWM

itoa
KVRist

475 posts since 3 Sep, 2009, from Poland
I wonder... Does pulse wave jump from 0 to 1 and back multiple times in a single wave cycle when its audio-rate modulated e.g. by a white noise? How it usually works in analog oscillators?

Say I have a pulse osc. The wave cycle length is 10 ms.
Pulse width signal is set to 0.5.
At 0.5 my osc jumps from 0 to 1.
At 0.6 pulse width modulator jumps to 0.

Does pulse come back to 0 or its state is "frozen" until next wave cycle?

This question seems stupid.. I just implemented "analytic solution" osc state = 1, when pw>phase and 0 when pw<=phase and started to doubt
giq
Z1202
KVRian

902 posts since 11 Apr, 2002
I'm not an expert in analog oscillator circuits, but I would guess that a typical implementation would probably use a kind of comparator, comparing the oscillator's phase level with the threshold. In that case your implementation would be correct. IMHO, your implementation also makes the most "theoretical" sense, regardless of what actual analog implementations are.

BTW, as for "analog" white noise as a source of modulation, continuous-time white noise is a mathematical abstraction and doesn't exist. I'm not 100% sure, but I think a mathematically correct white noise would jump infinitely many times on any given time interval, if that kind of question can be answered at all. Practical white noise (like analog one) would be bandlimited by some (however high) frequency.
itoa
KVRist

475 posts since 3 Sep, 2009, from Poland
I guess in typical VCO there are 2 comparators, one works on vco phase and another on PW signal, just want to make sure
giq
mystran
KVRAF

4747 posts since 11 Feb, 2006, from Helsinki, Finland
itoa wrote:I wonder... Does pulse wave jump from 0 to 1 and back multiple times in a single wave cycle when its audio-rate modulated e.g. by a white noise? How it usually works in analog oscillators?

The most obvious analog implementation for a pulse-wave is to start with the saw-core (or triangle-core works too) oscillator and put it through a comparator, which is nothing but an amplifier with a very high gain, designed to run in saturation all the time. If you add a low-frequency waveform (eg. LFO, or voltage controlled by a pot, or whatever) into the oscillator signal before comparator to shift the DC point up and down, you get PWM modulation.

Practical comparators might have a bit of hysteresis built into them (not to mention the gain is necessarily finite, even though it might be very high... or not so high if it's a 303), to keep them from oscillating wildly in response to small amounts of noise when very close to the threshold level, but other than that the results you'd get is ideally the same as pushing the saw+mod value through a signum() function.
<- plugins | forum
itoa
KVRist

475 posts since 3 Sep, 2009, from Poland
Thanks, I'm surprised. So in (most) analog gears, PW modulated by noise results in a noisy transition region (depending on modulation amount)? I expected its set once per cycle.
giq
Urs
u-he

21777 posts since 7 Aug, 2002, from Berlin
In analogue synths it sounds a bit like a mixture of Sync and FM when you use one oscillator to PWM another. You can get a lot of ups and downs per cycle.

The most intrigueing dilemma is an oscillator PWMing itself, with its inverted output. Whenever the pulse is high, it reduces the pulsewidth. But the it's low, so it doesn't reduce the pulsewidth anymore. So then it's high. Low. High.

This is how it is in the Sequential Circuits Pro-One (PWM is inverted, unlike in Prophet 5), which I happen to know quite well. With the oscilloscope attached right to the pins of the CEM33040, one can see that indeed it's a wild pattern of ups and downs, depending on oscillator frequency, PW and Modulation Depth. This is however happening in the vicinity of MHz. Already down the road, behind the mixer, things start to even out. After the filter then, which closes at below 70kHz, all that's left is some envelope across these ripples, which looks much like a sawtooth. What happens really is that the variable edge of the pulse turns into a slope, resulting in a waveform with overall fewer harmonics than pulse or sawtooth.
itoa
KVRist

475 posts since 3 Sep, 2009, from Poland
Interesting, 1 bit synthesis, where energy is represented by pulse destiny.
giq
JCJR
KVRAF

2232 posts since 17 Apr, 2005, from S.E. TN
itoa wrote:Thanks, I'm surprised. So in (most) analog gears, PW modulated by noise results in a noisy transition region (depending on modulation amount)? I expected its set once per cycle.

Probably so with typical saw->comparator circuit. I can't recall if it was common to add hysteresis to such usage. Some hysteresis could make the transitions less "chattery".

Could look up arp odyssey schematic or octave cat or some other old implementations and see if it looks like hysteresis.

A comparator without hysteresis could either be an ordinary opamp or a comparator chip.Or some discrete transistors configured for the task.

Audio-compensated opamps which were 99+ percent used in synths, had built in tiny caps or other strategy to make them less sensitive to accidental parasitic high frequency oscillations. Some added rolloff or reduced slew rate to immunize em against oscillation merely because of bad circuit board layout or tiny amounts of accidental stray inductance or capacitance in the circuit layout. An audio compansated opamp would have a slow enough slew rate to be fairly gently and non-nervous comparisons if the two compared voltages spend too much time real near the same value.

Though not common in audio circuits, many instrumentation type opamps didn't have built-in compensation, and you could fine-tune the slewrate with a selected value of cap connected to the opamp compensation pins, or other places in the circuit.

OTOH dedicated comparator chips were built to be fast with high slew rate, and could be more likely to chatter when the two voltages are close. For instance if both voltages are nearly the same and they also have some noise/hum riding on the voltages. If the comparator can toggle real fast, and maybe there is 10 mv of voltage difference, but the voltages also have 10 mv or more noise/hum on the voltages, the random contributions of noise can cause too much chatter.

Anyway, apologies drifting-- Usually an opamp or comparator wired for no hysteresis, one voltage goes to non-invert input, one voltage goes to invert input, and there are no feedback resistors between opamp output and opamp inputs.

A typical circuit with hysteresis would have input resistor on non-invert input (optional resistor on invert input, not always strictly necessary). And a positive feedback resistor from opamp/comparator output to the opamp/comparator non-invert input.

The ratio of the noninvert input resistor and the positive feedback resistor establishes the size of the "dead zone" of the hysteresis.

For instance if feedback resistor is 10 X bigger than input resistor-- And the neg input reference voltage is 5 volts, and the comparator output can toggle between 0 volts low and 10 volts high--

If the comparator is low (0 volts) then because of the voltage divider attenuating the pos input by 10/11 = .909, the pos input would have to exceed 5 / .909 = 5.5 volts before the pos input exceeds the neg input and the comparator can toggle high.

And then after the output toggles high, the voltage divider requires the pos input to fall below about 4.5 volts before the comparator can toggle low. So there is about a 1 volt dead band preventing nervous chatter when both inputs are near the same value.

The positive feedback also makes the comparator output "snappier" because once the comparator starts ramping up or down for a toggle, the positive feedback accelerates the state transition by rapidly increasing the voltage difference between the two inputs.

Some comparators also had built-in hysteresis requiring no extra parts. This was also found on some cmos digital chips, so that a rising edge had to get bigger than the midpoint to toggle one direction and then a falling edge had to get smaller than the midpoint to toggle the other direction.

Moderator: Moderators (Main)