PWM compressor

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

ruffrecords

Well-known member
Joined
Nov 10, 2006
Messages
16,255
Location
Norfolk - UK
Before I went on holday I looked at the Pye compressor schematic thinking it was a regular FET compressor but it turns out to be a PWM compressor. Whilst chilling in Cornwall, I wondered if such a compressor could be greatly simplified using one of the readily available microcontrollers with PWM outputs Something like an Arduino shield with the analogue bits on and all the hard work done in the micro. it would make short work of stereo linking/tracking. A quick Google search failed to find one.

Cheers


Ian
 
Great River and Fearn both make PWM compressors today.  EMT did at one point in the 1970's.  Grass Valley Systems may have made the first one in 1964 or so. 
 
I don's see why not but the heavy lifting is probably the saturated switching and reconstruction filters.  I ASSume you don't intend to convert the analog audio stream to PWM, but to chop the analog audio with a much higher frequency PWM (50% duty cycle = -6dB etc).. 

I recall looking at PWM back decades ago to make tracking LP filters for use around delay lines (chopping a resistor in series with a TG to look like a larger resistor for lower cut off frequencies), it looked promising but analog delay lines were made moot by digital for significant delay a long long long time ago. 

For a little more effort you could hang a codec on the micro and use the digital multiplier to effect gain changes.  8)

JR
 
I don't thing a PWM from a µC will cut it, the Arduino mega wont go over 62kHz PWM, probably a DUE would be more suitable. I couldn't find as easily that info as for the MEGA.

http://forum.arduino.cc/index.php?topic=72092.0

  For a PWM modulator to be clean it needs to run few times faster than the bandwidth. Then add filtering or you will have aliasing. We do want to conserve our precious 20kHz intact, we could go for 25kHz filter, which needs to attenuate 48dB at 31kHz. I say that number because it's an 8bit PWM on the MEGA, and that could give a decent range for usability, but not great.

  In any case going up in the PWM freq is expensive (you need a much faster µC, to do 1024 things in one PWM cycle for a 10bit control) There are some high frequency PWM generators or controllers, maybe controlling one of those would do the trick. Second choice is as the running it's own PWM generator as the Pye which gives a ton of flexibility. It would take just one oscillator for the whole thing and one comparator for each independent controlled gain. Then you can feed the reference of the comparators with any sluggish as your attack time requirements let's you do it. Good thing about building your own PWM generator, you could use a logarithmic converter after the ramp/sawtooth oscillator and get dB/bit relationship, instead of %PWM, giving a much better use for each bit on your DAC. And as it's only one oscillator to feed a bunch of channels, once you start to increment the channel count that complex thing get's lost in the mess, as long as you can route that high freq signal to all the comparators.

  I also give this a thought some time ago as you see, it went way to complex for the specs and price range we were aiming for. For many channels the filter price start to have weight, but if you want a simpler filter without compromising the signal you need a higher PWM frequency, which gets trickier to work with.

JS
 
joaquins said:
I don't thing a PWM from a µC will cut it, the Arduino mega wont go over 62kHz PWM, probably a DUE would be more suitable. I couldn't find as easily that info as for the MEGA.

http://forum.arduino.cc/index.php?topic=72092.0

  For a PWM modulator to be clean it needs to run few times faster than the bandwidth. Then add filtering or you will have aliasing. We do want to conserve our precious 20kHz intact, we could go for 25kHz filter, which needs to attenuate 48dB at 31kHz. I say that number because it's an 8bit PWM on the MEGA, and that could give a decent range for usability, but not great.

  In any case going up in the PWM freq is expensive (you need a much faster µC, to do 1024 things in one PWM cycle for a 10bit control) There are some high frequency PWM generators or controllers, maybe controlling one of those would do the trick. Second choice is as the running it's own PWM generator as the Pye which gives a ton of flexibility. It would take just one oscillator for the whole thing and one comparator for each independent controlled gain. Then you can feed the reference of the comparators with any sluggish as your attack time requirements let's you do it. Good thing about building your own PWM generator, you could use a logarithmic converter after the ramp/sawtooth oscillator and get dB/bit relationship, instead of %PWM, giving a much better use for each bit on your DAC. And as it's only one oscillator to feed a bunch of channels, once you start to increment the channel count that complex thing get's lost in the mess, as long as you can route that high freq signal to all the comparators.

  I also give this a thought some time ago as you see, it went way to complex for the specs and price range we were aiming for. For many channels the filter price start to have weight, but if you want a simpler filter without compromising the signal you need a higher PWM frequency, which gets trickier to work with.

JS
#1  Cheap micros clock PWM a lot faster than that
#2  An esoteric gain cell does not need to realize 40+ dB of attenuation

Many legacy comp/limiters work satisfactorily with far less than that much gain reduction.

I am not endorsing PWM for gain control...  Perhaps some interesting bench fun.

JR

PS: The side chain control will make a far bigger difference to the perceived quality of any dynamics processor, unless the gain element is so bad you can hear it by itself..
 
JohnRoberts said:
#1  Cheap micros clock PWM a lot faster than that
#2  An esoteric gain cell does not need to realize 40+ dB of attenuation

Many legacy comp/limiters work satisfactorily with far less than that much gain reduction.

I am not endorsing PWM for gain control...  Perhaps some interesting bench fun.

JR

PS: The side chain control will make a far bigger difference to the perceived quality of any dynamics processor, unless the gain element is so bad you can hear it by itself..

#1 I mentioned an Arduino Mega as an example since Ian purposed an Arduino.

#2 I never mentioned any particular attenuation range, only the filter required, still I could be wrong since lower max attenuation will make lower level artifacts requiring less complex filtering. I was actually thinking in a series resistor with the FET to externally limit the range for a 100% duty cycle to get better use of the steps. When I was working on it we were aiming for a very wide dynamic range, looking for 60dB or more IIRC. Lower attenuations makes things much easier.

PWM can be quite predictable way of getting a signal divided, but for audio applications it does have some trade offs. I do agree about the importance of the side chain, what I was pointing is that it would be easy to make such a bad gain element if you are not careful whit this approach.

JS
 
..CraneSong (who makes the "compressor circuit" for Fearn) are also making PWM-under-computer-control compressors..

My favorite pwm is probably the (analogue) Studer comp/limiter in the 961-desk

Jakob E.
 
Hi all

Won't a digital controlled PWM delay the SC due to processing and AD converter ?
IIRC the EMT limiter use a delay line at audio (not SC) to "predict" reduction, allowing more than ultra fast (negative?) attack.
I wondering how this is compatible with // compression (phase problem?)

gyraf said:
My favorite pwm is probably the (analogue) Studer comp/limiter in the 961-desk

Jakob E.

Never ear the 96x version (called PDM VCA "pulse duration modulated")
But I know well the 70' version of Studer PWM comp. So lovely !!!
clock is 300kHz, two LC filter after the FET.

I have in mind since long time to clone it, but never start the work...

Best
Zam
 
zamproject said:
Hi all

Won't a digital controlled PWM delay the SC due to processing and AD converter ?
not appreciably
IIRC the EMT limiter use a delay line at audio (not SC) to "predict" reduction, allowing more than ultra fast (negative?) attack.
IIRC RANE (rip)  made a noise gate with look ahead delay. Adding arbitrary delay to the audio path is generally not an issue as long as the delay is short and same level signals don't arrive via different path delays which can cause combing.
I wondering how this is compatible with // compression (phase problem?)
Don't understand this question.
gyraf said:
My favorite pwm is probably the (analogue) Studer comp/limiter in the 961-desk

Jakob E.

Never ear the 96x version (called PDM VCA "pulse duration modulated")
But I know well the 70' version of Studer PWM comp. So lovely !!!
clock is 300kHz, two LC filter after the FET.

I have in mind since long time to clone it, but never start the work...

Best
Zam
FWIW there is a unique side chain delay associated with PWM, as the duty cycle PWM ratio (attenuation) is generally updated once per PWM period. Generally this PWM period is higher rep rate than the audio bandpass.  In theory you could reset the PWM to update immediately for large level changes but that would introduce a one period artifact from the partial truncated period.

Coincidentally I just had a discussion with a speaker guy touting his new improved speaker protection device with nSec response time... Nothing in audio happens that fast especially with speakers.  ;D

JR

PS: Historically delay paths were not good enough quality to use in critical audio paths (like mastering). Modern digital media could provide transparent delay, and transparent gain changes (using digital multiplier), of course just like with analog dynamics the side chain design is all important.
 
JohnRoberts said:
IIRC the EMT limiter use a delay line at audio (not SC) to "predict" reduction, allowing more than ultra fast (negative?) attack.
IIRC RANE (rip)  made a noise gate with look ahead delay. Adding arbitrary delay to the audio path is generally not an issue as long as the delay is short and same level signals don't arrive via different path delays which can cause combing.
I wondering how this is compatible with // compression (phase problem?)
Don't understand this question.

Hi JR

You reply to the second Q with your first A :)
So no parallel compression with a delayed audio path to achieve look ahead SC

Best
Zam
 
Don't forget the MXR Dual Limiter - PWM on a budget. It's clocked at around 250 KHz, IIRC

Schematic here:
http://elektrotanya.com/mxr_136_dual_limiter.pdf/download.html

Nick Froome
 
There's this guitar stompbox that's based on a PWM chip (TL5001).

https://circuitsalad.com/2013/09/09/updated-squezal-pwm-compressor-schematic-layout-and-demo/
 
zamproject said:
Hi all

Won't a digital controlled PWM delay the SC due to processing and AD converter ?

No, because the sampling and processing time is basically hidden by the time constant you're emulating. The micro models an attack time and a release time, and creates a virtual "control voltage."

Of course, I suppose I'm trying to figure out why PWM from the micro would be better than using the micro's DAC to drive the gain cell control voltage ...
 
Andy Peters said:
Of course, I suppose I'm trying to figure out why PWM from the micro would be better than using the micro's DAC to drive the gain cell control voltage ...

No particualt reason except a PWM gain cell is very repeatable and relatively independent of the actual switching device which makes accurate repeatable compression characteristics easier and is a dream for stereo linking.

Cheers

Ian

Or did you mean use the DAC to drive an external PWM device?

Cheers

IAn
 
gfr said:
There's this guitar stompbox that's based on a PWM chip (TL5001).

https://circuitsalad.com/2013/09/09/updated-squezal-pwm-compressor-schematic-layout-and-demo/

That is an intersting chip. Is there a way to slave the oscillators of a pair of them for a stereo version?

Cheers

Ian
 
Looks like there are umpteen PWM chips operating at hundreds of KHz, many of which can be synced to eachother and they are reasonably priced too.

Cheers

Ian
 
ruffrecords said:
Andy Peters said:
Of course, I suppose I'm trying to figure out why PWM from the micro would be better than using the micro's DAC to drive the gain cell control voltage ...

No particualt reason except a PWM gain cell is very repeatable and relatively independent of the actual switching device which makes accurate repeatable compression characteristics easier and is a dream for stereo linking.

Cheers

Ian

Or did you mean use the DAC to drive an external PWM device?

Cheers

IAn
Stereo tracking is not a problem implementing gain changes with a multiplier inside the digital domain, or using digital controlled pots in the analog domain.

A modern analog VCA is not bad for tracking with well behaved control voltages, and decent component tolerances.

A PWM cell is different but not better (IMO) with extra filtering requirements.

JR

PS: I have done a bunch of work with PWM as a cheap sine wave signal source for my drum tuner. Now that we can get micro's with 16b DACs built in, that would be the obvious winner.
 
JohnRoberts said:
PS: I have done a bunch of work with PWM as a cheap sine wave signal source for my drum tuner. Now that we can get micro's with 16b DACs built in, that would be the obvious winner.

LOL, back in the early 80s I was the project leader for the Dragon 32 home computer (a UK computer based on the same Motorola datasheet as the Tandy CoCo). One of the additions we made was to add two analogue joystick ports.  A crude 4 bit DAC using port outputs and an op amp plus a comparator was used to make a software ADC for the joysticks. The 4 bit DAC was also used to generate the FSK waveforms for saving programs to cassette tape.

Cheers

Ian
 
ruffrecords said:
JohnRoberts said:
PS: I have done a bunch of work with PWM as a cheap sine wave signal source for my drum tuner. Now that we can get micro's with 16b DACs built in, that would be the obvious winner.

LOL, back in the early 80s I was the project leader for the Dragon 32 home computer (a UK computer based on the same Motorola datasheet as the Tandy CoCo). One of the additions we made was to add two analogue joystick ports.  A crude 4 bit DAC using port outputs and an op amp plus a comparator was used to make a software ADC for the joysticks. The 4 bit DAC was also used to generate the FSK waveforms for saving programs to cassette tape.

Cheers

Ian
Yup back in the day you didn't buy a canned A/D but rolled your own from a decent D/A and a successive approximation routine (resolve one bit at a time from MSB to LSB).

When I designed my current tuner platform I knew I didn't need more than 8 Bits of output resolution and they already had 8-12b A/D built in.  They surely had a R-2R ladder built in for that A/D but did not break it out for DAC use which would involve more firmware glue and settling time issues. 

I researched cheap DACs and precision R-2R ladders, but finally decided to use the free internal PWM. In fact I used two PWM outputs together, you can arrange them to shift the PWM period /2 energy from small signals level to be highest at large signals.  A single PWM stream at 0 output looks like a 50% duty cycle with full energy at period/2. Adding two opposite polarity PWM streams at 0 (50%)pretty much cancel each other out reducing PWM related energy at low signal levels. At high signal levels you get the max PWM period energy but it is easier to mask by the larger signal. 

JR
 

Latest posts

Back
Top