PWM Envelope Phaser

Started by nelson, May 27, 2009, 04:41:01 PM

Previous topic - Next topic

StephenGiles

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

amptramp

Quote from: StephenGiles on December 22, 2024, 11:55:17 AM
Quote from: amptramp on December 22, 2024, 09:01:28 AMHere is another one:


Aha, one of my drawings in excel!!

You can do drawings in Microsoft Excel or is this some other software?

StephenGiles

Quote from: amptramp on December 23, 2024, 08:03:01 AM
Quote from: StephenGiles on December 22, 2024, 11:55:17 AM
Quote from: amptramp on December 22, 2024, 09:01:28 AMHere is another one:


Aha, one of my drawings in excel!!

You can do drawings in Microsoft Excel or is this some other software?

Yes, you have to make you own component shapes. I don't do them now because of Arthritis pain in my thumb!
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

amz-fx

Not sure if it has been posted, but here is one that might be interesting for you:

https://circuitsalad.com/2014/11/19/pwm-phaser-re-design-almost-complete/

regards, Jack

R.G.

One difficulty with all PWM schemes as related to human auditory effects is that PWM has a limited and linear scale. Human frequency and loudness sensing is logarithmic, so a very wide range of frequencies and loudness is mapped onto a limited range of perception. PWM as normally practiced is fundamentally linear - 0 to 100% duty cycle is usually done with a division into 2 to the 10th to 2 to the 12th duty cycles. This is too many steps on the low end and not enough on the high end to preserve the appearance of seam-less-ness in some cases.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

> This is too many steps on the low end and not enough on the high end to preserve the appearance of seam-less-ness in some cases.

OR-- ratios like 0.01% can be gotten with precise extremely fast switching. To hit -60dB in a 20+kHz system is like 50 Megacycle time resolution.

  • SUPPORTER

diffeq

Quote from: R.G. on December 23, 2024, 07:46:23 PMOne difficulty with all PWM schemes as related to human auditory effects is that PWM has a limited and linear scale. Human frequency and loudness sensing is logarithmic, so a very wide range of frequencies and loudness is mapped onto a limited range of perception. PWM as normally practiced is fundamentally linear - 0 to 100% duty cycle is usually done with a division into 2 to the 10th to 2 to the 12th duty cycles. This is too many steps on the low end and not enough on the high end to preserve the appearance of seam-less-ness in some cases.

Would 16 bit pwm resolution be able to solve it though? :icon_lol:

R.G.

Quote from: diffeq on December 25, 2024, 05:38:10 AMWould 16 bit pwm resolution be able to solve it though? :icon_lol:
As Paul notes, with extremely fast and precise switching yeah, you can handle the end cases. 16 bits is probably enough, as witness CDs' resolution. There are still people who complain that CD resolution is not good enough.Then there's speed. CD equivalent at 44kHz is a good place to start. The rise and fall times have to be "fast" compared to the basic 44kHz and 16 bit resolution, so the edges of the PWM on and off times need to make the pulse edges trivial compared to a 1/2^16 of 44kHz. This gets you to - if my mental math is not fooling me - into the tens of nS rise and fall rate.

It's all do-able, especially with something like today's uC chips and DSPs. It gets tricky if you're trying to hack something together with a few CMOS gates. So would 16 bit pwm resolution do it? It's a step in the right direction, but not necessarily a slm dunk.   :icon_lol:
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

StephenGiles

Why on earth would they worry that CD resolution in a gig volume battle with drums, other guitars and even keyboards, is not enough - Now it's an entirely different kettle of fish if you are trying to impress your girlfriend!!!
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

Mark Hammer

Having dickered with envelope control of speed on a basic FET-based Phase 90, I will say that the time constants are tricky to nail down, and may well be the finickiest part of such potential circuits.  The rise and fall times of the envelope shaping modulation rate, may not necessarily be those optimal for direct envelope-control of phase-shift, or envelope control of resonance or offset, or any other parameter.  The "musicality" of the change, prompted by the intensity of one's picking, seems to depend very much on what sort of sonic change one is aiming for.  One doesn't want it too sensitive and abrupt, but one also doesn't want it too sluggish.

amptramp

I am not sure you need the entire audio spectrum.

After all, most analog delay / chorus / echo pedals have a limited frequency range and the album "No Jacket Required" certainly didn't suffer from only having content up to 5000 Hz and nothing above that.  You are looking at a restriction that doesn't really exist for a guitar - even if the rest of the music is full range, the guitar content does not need high frequency content.

R.G.

Quote from: StephenGiles on December 25, 2024, 12:42:09 PMWhy on earth would they worry that CD resolution in a gig volume battle with drums, other guitars and even keyboards, is not enough - Now it's an entirely different kettle of fish if you are trying to impress your girlfriend!!!
I was just using that as a handy comparison metric for "how much is enough". No, CD resolution is not needed in the sound at a gig.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

ElectricDruid

Quote from: R.G. on December 23, 2024, 07:46:23 PMPWM as normally practiced is fundamentally linear - 0 to 100% duty cycle is usually done with a division into 2 to the 10th to 2 to the 12th duty cycles.
RG is completely correct about this in my experience. 10-bit PWM is common, and 12-bit PWM would be pretty good going. That's 1024 steps or 4096 steps.

QuoteThis is too many steps on the low end and not enough on the high end to preserve the appearance of seam-less-ness in some cases.
Yes, this is the critical question. *How exactly* are those steps mapped to whatever parameter we're controlling?
If it was entirely linear, and we're looking at something that humans hear in a logarithmic way, like pitch, then we've maybe got problems. Let's "back of the envelope" that:

Say we have 1024 steps. The first 512 steps cover one octave. The next 256 steps cover the next octave, and then the next 128 steps after that cover the next octave, etc etc. How many octaves do we get before this is unacceptable?
512 steps per octave is 512/12 = 42.66 steps per semitone, about 2.3 cents, less than the 6 cents generally regarded as perceptible. The next octave knocks that to 256/12 = 21.33 steps per semitone, 4.68 cents, still good. Next octave, we're going to hit 9 cents, which is certainly potentially perceptible. That's not to say it always will be - if things are moving about about and the frequency is particularly high or particularly low, you *still* won't notice, unless you're the first violin in the something-or-other philharmonic orchestra ;). But it's not looking good - at 10-bit, we've got maybe two-and-a-bit octaves at best. Clearly, for 12-bit, you can extend that: four and a bit octaves of pitch sweep without steps being audible would be actually pretty good, given that the whole range of human hearing is only ten octaves or so. 16-bit would therefore definitely cover everything you might need.

However, this is assuming the worst case. If the response is entirely linear, we finish up wasting a lot of our resolution in the lower octaves, and then don't have much left further up. If we were able to get a more "V/Oct" style response from whatever our PWM is controlling, the situation would be much better. We already know 512 steps per octave is fine, so if 4096 steps (12 bit PWM) were spread equally, we could cover eight octaves with better than 2.5cent resolution. That's basically twice as good as the than the four-and-some octaves we get the other way, and it's more consistent into the bargain.

How would we do this? Well, it turns out that putting a resistor in parallel with the 4066 CMOS switch is pretty effective. If we have a resistor setting the minimum resistance, and a resistor in parallel and the resistance of the switch itself, we have the following situation:



Now, I did a graph with this situation, using Rmin=2K, Rmax=22K, Rswitch=50R, and with a capacitor value of 4n7 (typical is often 10n, with a 10K resistor, so I've kept things in the same ballpark). Here's the result:



The red line is a "theoretical" 1V/oct response. The green line is what we actually get. It covers a roughly 1:10 range from 1400Hz to 16KHz (2K to 22K, following the resistor values used). This is probably a bit high, and could do with getting pushed down a bit, but the point is that the added resistors tweak the response from something linear into something much more like the curve we need, and that can help our PWM resolution *a lot*. Ok, it's not perfect, but when were effects *ever* perfect?!? All that happens is the ones that sound good become classics, and then everyone spends the next several decades trying to copy those imperfections to get the same sound! So I'm saying this is probably close enough for rock'n'roll, and that if you're working on something like this, certainly look at adding the parallel resistor and see what it can do for you. Do the sums (not personally - that's why we have computers), plot the graphs.

HTH,
Tom

PRR

Quote from: ElectricDruid on December 27, 2024, 05:31:49 PMsomething that humans hear in a logarithmic way, like pitch, then we've maybe got problems.

Prior Art: When Moog-like synths lived or fell flat on their LOG converters, PAiA built a whole synth system on LINear converters (instead of 1V/0ct, 1V/1kHz). Then used a very early microprocessor to make it music scale. JonBoy said it tracked beautifully, mostly. As kits it was vastly cheaper than any loggy plan, didn't bite the pot budget. It might be a natural on PWM? I ferget all the technical details but the company is around.
  • SUPPORTER

amptramp

#54
Quote from: ElectricDruid on December 27, 2024, 05:31:49 PM
Quote from: R.G. on December 23, 2024, 07:46:23 PMPWM as normally practiced is fundamentally linear - 0 to 100% duty cycle is usually done with a division into 2 to the 10th to 2 to the 12th duty cycles.
RG is completely correct about this in my experience. 10-bit PWM is common, and 12-bit PWM would be pretty good going. That's 1024 steps or 4096 steps.

QuoteThis is too many steps on the low end and not enough on the high end to preserve the appearance of seam-less-ness in some cases.
Yes, this is the critical question. *How exactly* are those steps mapped to whatever parameter we're controlling?
If it was entirely linear, and we're looking at something that humans hear in a logarithmic way, like pitch, then we've maybe got problems. Let's "back of the envelope" that:

Say we have 1024 steps. The first 512 steps cover one octave. The next 256 steps cover the next octave, and then the next 128 steps after that cover the next octave, etc etc. How many octaves do we get before this is unacceptable?
512 steps per octave is 512/12 = 42.66 steps per semitone, about 2.3 cents, less than the 6 cents generally regarded as perceptible. The next octave knocks that to 256/12 = 21.33 steps per semitone, 4.68 cents, still good. Next octave, we're going to hit 9 cents, which is certainly potentially perceptible. That's not to say it always will be - if things are moving about about and the frequency is particularly high or particularly low, you *still* won't notice, unless you're the first violin in the something-or-other philharmonic orchestra ;). But it's not looking good - at 10-bit, we've got maybe two-and-a-bit octaves at best. Clearly, for 12-bit, you can extend that: four and a bit octaves of pitch sweep without steps being audible would be actually pretty good, given that the whole range of human hearing is only ten octaves or so. 16-bit would therefore definitely cover everything you might need.

However, this is assuming the worst case. If the response is entirely linear, we finish up wasting a lot of our resolution in the lower octaves, and then don't have much left further up. If we were able to get a more "V/Oct" style response from whatever our PWM is controlling, the situation would be much better. We already know 512 steps per octave is fine, so if 4096 steps (12 bit PWM) were spread equally, we could cover eight octaves with better than 2.5cent resolution. That's basically twice as good as the than the four-and-some octaves we get the other way, and it's more consistent into the bargain.

How would we do this? Well, it turns out that putting a resistor in parallel with the 4066 CMOS switch is pretty effective. If we have a resistor setting the minimum resistance, and a resistor in parallel and the resistance of the switch itself, we have the following situation:



Now, I did a graph with this situation, using Rmin=2K, Rmax=22K, Rswitch=50R, and with a capacitor value of 4n7 (typical is often 10n, with a 10K resistor, so I've kept things in the same ballpark). Here's the result:



The red line is a "theoretical" 1V/oct response. The green line is what we actually get. It covers a roughly 1:10 range from 1400Hz to 16KHz (2K to 22K, following the resistor values used). This is probably a bit high, and could do with getting pushed down a bit, but the point is that the added resistors tweak the response from something linear into something much more like the curve we need, and that can help our PWM resolution *a lot*. Ok, it's not perfect, but when were effects *ever* perfect?!? All that happens is the ones that sound good become classics, and then everyone spends the next several decades trying to copy those imperfections to get the same sound! So I'm saying this is probably close enough for rock'n'roll, and that if you're working on something like this, certainly look at adding the parallel resistor and see what it can do for you. Do the sums (not personally - that's why we have computers), plot the graphs.

HTH,
Tom


The Paul Nelson design in the schematic at the top of the page (#40) shows 1 Megohm in parallel and what looks like 47E ohms in series.  This may be a reasonable starting point, whatever 47E means.

ElectricDruid

Quote from: amptramp on December 27, 2024, 11:32:15 PMThe Paul Nelson design in the schematic at the top of the page (#40) shows 1 Megohm in parallel and what looks like 47E ohms in series.  This may be a reasonable starting point, whatever 47E means.

Assuming another 50R or so as the switch on resisance, that's about 100R total. 100R to 1M is a 10,000:1 range, extremely wide. That would be from 2Hz to 20KHz! We don't need quite so much! I'm quite sure no FET phaser covers anything like such a range.

My experience with PWM in other situations has been that it's best to stay away from the most extreme settings, so (say) only use 5% to 95% pulse widths, instead of going all the way. It's possible this is the idea in Paul's schematic, and the LFO modulates the pulse width over some middle part of the entire range.

Although perhaps my example with only 10:1 is too narrow, I think there might be some useful middle ground to be found here!