PWM Tremolo Experiment and audio clips

Started by Transmogrifox, March 07, 2005, 01:31:34 AM

Previous topic - Next topic

Transmogrifox

Well, Friday I tried to breadboard an EA tremolo, and accidentally connected one of the wires from the JFET to +9V and toasted the poor thing, then I did it again so all my FETs were toasted.

So yesterday, I was dinking with the CA3080 to see if I could make that bad boy do tremolo for me.  It did ok.

So then, I thought I would make a triggered string swell effect and noticed that the CA3080 didn't go completely inaudible in the low gain setting so I went to devising another variable gain amplifier strategy that was more effective:

Thus I thought upon Pulse Width Modulation control using the open collector output of a comparator as an ON/OFF switch to ground.  

With a little tinkering and taming the triangle wave oscillator, I came up with a little tremolo circuit that does just fine:

http://www.geocities.com/transmogrifox/PWMTREM.jpg

and here are some audio clips to compliment it, just to show that it works smoothly:

http://www.geocities.com/transmogrifox/Trem1.mp3
http://www.geocities.com/transmogrifox/Trem2.mp3
http://www.geocities.com/transmogrifox/Trem3.mp3

The only drawback is that the oscillator must operate at 22kHz or less to achieve an acceptable range of quiet resistance change, which means that there must not be much frequency content above 10kHz.  For guitar this is just fine.  Put on a little bit of a low pass filter on the front end, you're good, and probably won't even be the wiser.  I didn't add the filter on the front end, but it won't make a difference unless you're feeding a metal distortion or something into the front end.  

The VR from this little project could easily be adapted into a twin T filter, and probably with excellent results.

Ultimately I would like to find a comparator that is about 5 or 6 times faster than the LM339 (and I know there are many).  Then I could speed the oscillator up to around 50 kHz, and ideally I would like it to be moving along at 100kHz.

Doing the math, the resistance change comes out to be a 1/X relationship.  This has been discussed in a different thread.  I observed this perfectly as I swept the input voltage with a pot and noted the volume swell:  Starts very slowly from 0 on up until about 75%, then it ramps up toward whatever (theoretically infinity) until it exceeds the oscillator amplitude, at which point you hear a "click".  You must use the trim pot to bias the LFO so that you don't hear the click.  This tremolo has no detectable throbbing noise whatsoever to it.  If you hear it, then the control voltage is biased incorrectly.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Marcos - Munky

Thanks for share this schematic. Looks interesting, and sound great to my ears.

petemoore

'Yahoo temp unavailable' [?]...
Convention creates following, following creates convention.

Transmogrifox

Quote from: petemoore'Yahoo temp unavailable' [?]...

Gotta love geocities.  Hit and miss with more emphasis on the miss.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

StephenGiles

"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

Transmogrifox

Ever get a chance to access the page petemore?

It's a perfect case of, "the only cool and unique thing about it is how it does what hundreds of tremolo pedals do".  In other words, I could have recorded audio clips off of an MXR Tremolo, or worse yet, just applied "Tremolo" effect to a clean signal in Audacity and nobody would have been the wiser.

All the same, it excites me because I am quickly seeing how quickly and easily I can build my long sought after string swell effect, and for two, how well this can be applied to filtering.  It just gives me the assurance that all I need is to find faster switches and comparators to make this the holy grail of voltage controlled resistors for building precision voltage controlled filters and VGAs.  I think I will have to try to make a compressor with it at some point, as well.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

GFR

Quote from: TransmogrifoxI think I will have to try to make a compressor with it at some point, as well.

I (and a friend who's co-author) have built a PWM limiter in 1987.

I can mail you the schematic. I haven't met the other author for a long time but I think you can make it public if you want - we presented it in a congress at college, so it's already public anyway.

It's like this:

# the envelope of the input is extracted with an opamp based precision FWR + cap

# the envelope is compared with the ramp using one section of a LM339

# the ramp generator is buit with a BC559 as a current source charging a cap. One section of the LM339 resets the ramp. IIRC it's about 200Khz.

# The variable resistor is done with 4066 switches driven by the PWM signal. There's one switch in series, another shunt, out of phase. Then I filter the high frequency with a simple RC filter.

# The input signal goes to an opamp stage. The Variable resistance is in the feedback loop of the opamp. The filter above can't have many poles or  the opamp stage becomes unstable.

# It works like that: when input is higher, pulse width is wider and more signal is fed back in the opamp stage, so the gain is lower. When input is quieter the pulse width is narrower and less signal is fed back, and gain is higher.

We decided to use this topology of detecting the level from the input and controlling the feedback of a gain stage (instead of say a dynacomp where you sense the output and control the gain directly or some other configurations you may find) because after lots of reading and simulations and math we came to the conclusion that this was the topology that could handle transients and high level signals with less distortion.

It worked really good, it could stand really fast transients. In fact we had to include some resistance in the envelope detector to lower the attack time because it was so fast. The sound was really clean, provided that it was used with a VERY good power supply. Otherwise strange switching noises would bleed to the signal.

Also,

MXR has a pwm limiter.

MXR DUAL LIMITER no.136

I think you can buy one used for U$33 in e-bay.

If someone has the schematic,  that's one I'd like to take a look.

Transmogrifox

That's very interesting.  I would like to see the schematic.  Send me an email:  transmogrifox@yahoo.com

Apparently the 4066 worked out for you.  I have found it to be a bit slow, and the LM339 to be a bit slow, however my only experimentation with them has been on a breadboard.  Perhaps if you had a scope to look at it, you could tell me more about the switching waveforms, but I know this VR works a hell of a lot better when clocked at 22 kHz instead of 200 kHz.  Finite rise times and fall times interfere with a wide change in average resistance-and that's a mathematically sound fact.

So, what was your total range of gain on the amplifier in dB?  Did you ever measure minimum to maximum gains?
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

StephenGiles

Hi GFR, could you please email me your PWM Limiter schematic to
spgstevegiles@yahoo.co.uk

We will be spending 1 hour in San Paulo airport (on the plane!) in 2 weeks time on our flight to Buenos Aires from England. We hope to have a holiday in Brazil one year.
Thanks
Stephen
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

GFR

Quote from: TransmogrifoxThat's very interesting.  I would like to see the schematic.  Send me an email:  transmogrifox@yahoo.com

Apparently the 4066 worked out for you.  I have found it to be a bit slow, and the LM339 to be a bit slow, however my only experimentation with them has been on a breadboard.  Perhaps if you had a scope to look at it, you could tell me more about the switching waveforms, but I know this VR works a hell of a lot better when clocked at 22 kHz instead of 200 kHz.  Finite rise times and fall times interfere with a wide change in average resistance-and that's a mathematically sound fact.

So, what was your total range of gain on the amplifier in dB?  Did you ever measure minimum to maximum gains?

The 4066 is slow, but it's the LM339 that's the bottleneck.

The waveform at very wide or very narrow widths was not perfect - the edges were rounded and so it couldn't reach maximum or minimum amplitude at these settings. In practice, this meant that the gain control was not linear at the extremes of the range, but this was not a concern to us in this application, so we noticed it in the scope but we have not measured it. The minimum end of the range was off all the time, by the time the gain of the opamp stage was set by a big resistor in parallel with the VR. The maximum end of the range was on all the time, by the time the gain was zero (inverting opamp). You can interpret the non-linearity in the range as a built-in noise gate and a soft knee or something like that so the artifacts become features :).

petemoore

Yes I did, they sound cool...very interesting !!
 A little over my head, for starters...what is "PWM"?
Convention creates following, following creates convention.

Transmogrifox

Yes, that makes sense that the artifacts would not be as audibly noticeable for the compressor, as opposed to a filter or tremolo effect.  For a filter or trem, the artifacts at the transition translate to a popping on/off switching noise.  At those extrems on a compressor, any apparent popping would blend into the note attack such that it would not be terribly audible.  That may also explain the fast attack time you observed.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Transmogrifox

petemore:  PWM means "Pulse Width Modulation.

If you looked at the schematic, you'll notice the output of the comparator coupled to a capacitor in shunt to the 100k resistor.  The comparator output is an open-collector BJT.  The output therefore looks like an On/Off switch.  With a triangle oscillator on one input, control voltage (LFO) on the other, the output is switched on and off 22000 per second with varying amounts of time on per cycle (thus pulse-width modulation).

The switch turning on and off at a frequency many times the frequencies in the audio signal looks like a resistor whose resistance changes according to the ratio of how long the switch is on to how much time it is off.  If it's on more time per cycle than off, it looks less resistive, if off more, then more resistive.

The extreme cases are completely off:  looks like the resistance of the collector of a transistor.

Completely on:  very low resistance in this case.

All is variable in between by changing the pulse width.

So in conclusion, we're making a variable gain element by turning the guitar signal on and off at a high frequency.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

petemoore

AHA that explains alot, and as always I sort of understand...I follow what you typed perfectly [thank you for 'splaying' it that way for me]..which raises new questions...of course !!!  :idea:
Convention creates following, following creates convention.

GFR

While searching for the schematic at home I've found these articles that you may find interesting (not about PWM, but about compressors):

"Audio Dynamic Range Compression for Minimum Perceived Distortion"
Barry A. Blesser
IEEE Transactions on Audio and Electroacoustics, vol. AU-17, No. 1, March 1969

"A Review of Automatic Gain Control Theory"
D. V. Mercy
The Radio and Electronic Engineer, Vol. 51, No. 11/12, pp. 579-590, November/December 1981

"On Transient Distortion in Hearing Aids with Volume Compression"
Igor V. Nabelek
IEEE Transactions on Audio and Electroacoustics, vol. AU-21, No. 3, June 1973

GFR

Sorry, it was not 1987, it was 1990:

RIBEIRO, G. F. ; NIGRI, A. M. . Compressor/Limitador de Áudio usando PWM. In: IV CRICTE - UFRJ, 1990, Rio de Janeiro, RJ, 1990.

I've emailed you, Transmogrifox and Stephen.

Transmogrifox

Thanks a bunch for the schematic.  It was very neat to look at it.  Seems like a solid design worth building for myself--especially if it is a relatively crisp sounding unit. Did you ever measure THD?  It would be interesting to know how well it does for distortion specs.  I suspect my tremolo would be pretty abysmal on the distortion specs--just driving an open collector turned completely off like that probably adds a bit of distortion.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

zachary vex

MXR made a PWM compressor (rack-mount) in their black series.  probably 70's, maybe 80's.  pretty amazing technology... i think they used a 4016 or 4066 with it, and operated it at around 250kHz!

GFR

Quote from: TransmogrifoxThanks a bunch for the schematic.  It was very neat to look at it.  Seems like a solid design worth building for myself--especially if it is a relatively crisp sounding unit. Did you ever measure THD?  It would be interesting to know how well it does for distortion specs.  I suspect my tremolo would be pretty abysmal on the distortion specs--just driving an open collector turned completely off like that probably adds a bit of distortion.


We have not measured THD, but whe input a triangular wave to it and there was no visible rounding on the scope. And it sounded very clean with a bass no matter how hard we would slap the strings :)

What you must look for low THD is that for a given width, this width won't be modulated by the signal being chopped itself. I think that's not a problem with CMOS switches. You also want the ripple in the filtered signal to be small - so you need to switch at the highest possible frequency and filter at the lowest possible frequency. This also helps killing switching artifacts like spikes.

Transmogrifox

My intuition is that distortion is minimal from the PWM system itself.  If you have a relatively stable ramp generator, and "ideal" comparator and a ripple-less envelope follower, this would be a very clean, linear system, but-- you still have THD and noise added by the CD4066 itself.  Just because it's switched on and off quickly doesn't mean that it's inherent nonlinear transfer goes away in this configuration.  In addition to that you have op amps adding some distortion.  Not that this is terrible or anything.  I would guess that this is better than an OTA as the OTA compressor generally doesn't use any feedback through the amplifier.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.