Digitally controlled analog effects

Started by Fancy Lime, April 24, 2019, 01:52:23 PM

Previous topic - Next topic

Fancy Lime

Hi there!

So here is an idea: An Arduino (or some other such nano computer) controlling an effect via switched capacitors as resistors. I am wondering why I haven't seen that, I'm sure that someone must have done it, if it is at all feasible. At the moment this is more of a brain fart of mine than a serious plan. I just want to know if it is worth sinking mental resources into this or if there is some insurmountable problem that I am overlooking.

The potential pros:
Being able to control resistor values with a computer would allow to have saved presets for tone controls, complex predefined tone control changes with the turn of few control pots (by e.g. coupling Q and frequency in a parametric eq), arbitrarily complex LFO wave forms for tremolos or phasers, very complex compressor/limiter/noise gate functions (if the computer also gets fed the audio signal and can analyze it), all kinds of space-wah extravaganzas, using external data from the SETI project to control tremolo frequency...

The potential problems I see:
Switched caps controlled by an Arduino are probably quite limited in their range because we need the lowest switching frequency to be at least ~40kHz and the upper frequency will be limited by the computer and the switches (probably <1MHz, I am guessing based on absolutely nothing at all). Another problem might be interference between different switches operated at different frequencies in the same device, which may lead to audible artifacts. Also: Radio Yerevan.

Any thoughts?
Andy
My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

EBK

Why not use the Arduino to control digital potentiometer chips?
  • SUPPORTER
Technical difficulties.  Please stand by.

Fancy Lime

Quote from: EBK on April 24, 2019, 02:35:21 PM
Why not use the Arduino to control digital potentiometer chips?

Because I had not thought of that. So nothing, really. Sounds worth considering. But the question would remain the same: has someone done that? What are the pitfalls here. A brief googledidoo tells me that wanting to change the settings while there is voltage across the ports may be problematic, which would not be a big problem for static filters but may be un-good for things like tremolos or autowahs. Any suggestions what properties to look for in a digipot or which ones are tried and true?

Andy

My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

ElectricDruid

A "PWM phaser" is basically a switched-resistor application, and that's possible with a processor like an Arduino, so it can be done. Someone here fairly recently did a digitally controlled filter effect done a similar way, if I remember correctly. The thread's probably over on the digital board.

EBK is right to point out other approaches to digital control though. I don't think that there's one solution which is right for all situations. You can use digipots, but stepping can be a problem, and you need to watch the power handling too - they don't cope with much current. You can also use a simple DAC to provide a control voltage to an analog circuit (anything based on the LM13700, for example). Or you can use an Arduino's PWM outputs to control a vactrol, giving you a variable resistance. You can use a multiplying DAC to control an analog level digitally. And sometimes you don't need digital control at all - for example, if you wanted to have digital control of an LFO, you could instead use the Arduino to generate the LFO output directly, and bypass the need to digitally control and external analog LFO. I've probably still missed one or two other ideas.

Go for it. As you said, the possibilities are exciting, so it's definitely worth having a think about it.


Mark Hammer

The Chase Bliss pedals utilize PICs controlling vactrols, as I'm sure other higher-end pedals do too.  Many PICs provide PWM outputs, such that one can control the average brightness of an LED.  An Arduino is simply one particular PIC and standard for impelementing it in a circuit.

dschwartz

 Aren't vactrols too slow for PWM switching?
I'd think of cmos switching for that, like the mxr envelope filter.
----------------------------------------------------------
Tubes are overrated!!

http://www.simplifieramp.com

EBK

Quote from: Mark Hammer on April 24, 2019, 04:00:37 PM
The Chase Bliss pedals utilize PICs controlling vactrols, as I'm sure other higher-end pedals do too.  Many PICs provide PWM outputs, such that one can control the average brightness of an LED.  An Arduino is simply one particular PIC and standard for impelementing it in a circuit.
This makes so much sense.  I have a couple of Arduinos laying around, so I might play around with this sometime. 

Side question that I could probably figure out if I searched:  CdS cells exhibit some hysteresis beyond mere sluggishness, right?  That is, would the steady-state resistance be different for a particular LED current depending on whether you arrived there from below or above?
  • SUPPORTER
Technical difficulties.  Please stand by.

EBK

Quote from: dschwartz on April 24, 2019, 05:25:20 PM
Aren't vactrols too slow for PWM switching?
I'd think of cmos switching for that, like the mxr envelope filter.
The slow part of a vactrol is the photoresistor, not the LED.  LED brightness is easily controlled through modulation.  The photoresistor doesn't care how fast you switch the LED.  It just cares about how bright the result is.
  • SUPPORTER
Technical difficulties.  Please stand by.

Ripthorn

I love digitally controlled analog. You can do digital pots, use relays to switch out components, use a PWM out for various things, and much more. I recently did a DIY version of the Subdecay Proteus and will post a project build once my boards are in and I have a nicely boxed one. It uses a filtered PWM output tied to the random number generator of an ATTINY chip. Sounds fantastic and zero sorting transistors for noise.

I have about a half dozen other digitally controlled effects that I am working on and will continue to post them as I finish. I have a video and full build documentation for a true bypass, MIDI controlled looper using an Arduino nano on my website. We use microcontrollers a lot at work, so this is my way of getting to know them and understand what they can do. Welcome to the future!
Exact science is not an exact science - Nikola Tesla in The Prestige
https://scientificguitarist.wixsite.com/home

dschwartz

Quote from: EBK on April 24, 2019, 05:38:30 PM
Quote from: dschwartz on April 24, 2019, 05:25:20 PM
Aren't vactrols too slow for PWM switching?
I'd think of cmos switching for that, like the mxr envelope filter.
The slow part of a vactrol is the photoresistor, not the LED.  LED brightness is easily controlled through modulation.  The photoresistor doesn't care how fast you switch the LED.  It just cares about how bright the result is.
Yes, I realized that just after i posted...
Still, vactrols sound like an expensive and space consuming option..but zero switching noise is a plus.
----------------------------------------------------------
Tubes are overrated!!

http://www.simplifieramp.com

Fancy Lime

Oh wow, this got way more people excited than I thought it would.

I had NOT thought of PWM. Did I mention I did not think this trough? I'd like to avoid vactrols, though. They are in many ways the ideal solution for controllable resistors but manufacturing tolerances are probably too loose for this project because I would ultimately like to design something that other people can copy 'as is' without tweaking of the software. The reason being that this opens a lot of possibilities for exchanging software to make new weird effects if the physical device is sufficiently versatile (and most likely modular to some degree). I can't say I have the best experience with OTAs. I always found the LM13700 too noisy and lacking headroom, which, in all fairness, may be my fault for bad usage rather than the LM13700's. But PWM controlling a CD4066 á la MXR envelope filter is of course an option for anything where integrators or all-pass filters are involved.

New question: Is there a generic method to replace a floating resistor with a PWM switch? For example for the resonance control of an SVF (although a digipot may work fine here) or for an L-pad to make a compressor, noise gate, or tremolo? That would also make it easier to apply this whole technique to other types of tone control.

Also: does anyone have experience with feeding audio into an Arduino (or whatever) for envelope controlled effects?

Multiplying DACs sound interesting. Had never heard about those before but that may actually fit the bill for volume controlling effects like compressor, noise gate, and tremolo. So maybe it is going to be a combination of techniques. I'll have to read up on that. Any specific recommendations as to what multiplying DAC works for our purposes and is readily available?

Thanks for all the input,
Andy
My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

Ripthorn

I would recommend not feeding audio into an Arduino, as it has very limited resources and only 8 bit data. However, if you search for the STM32 "blue pill", it's comparably sized and priced to the Nano, but is a 32 bit micro with more horsepower and resources in general. I am looking into the bigger brother MCU's for a project that has been rattling around my head for a few years.

With PWM and LPF, you can create a control voltage for all kinds of things: sample/hold, envelope filter, wah, LFO's for tremolo and similar effects. If you only need to switch a couple of things, relays can be used. All kinds of fun!
Exact science is not an exact science - Nikola Tesla in The Prestige
https://scientificguitarist.wixsite.com/home

Fancy Lime

Hi Brian,

thanks for the tip! The blue pill looks interesting, I'll look into that some more.

Andy
My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

R.G.

This topic has been on my mind for a few decades now.   :)  Lots of ways to do it for specific cases, a few ways in some cases, and lots of ways to do it poorly.  The first attempts I remember was in Audio Amateur back in the 1970s, where they used count up/down logic to run a stepped attenuator made out of JFET switches.  The challenges are in general to make the steps between one and another setting quietly and without "zipper noise", that being a zizzzz as the settings move between settings, and without pops and clicks when making a change that steps directly from one setting to another, including but not limited to many-bit steps.

Momentary soft muting while changing is one approach to doing this kind of thing politely, but performers might not like the dropouts. The steps need to be really fine to be imperceptible. eight bits is kind of a minimum. The size of the step changes is a topic too; volume-ish changes probably ought to be log/exponential steps while others need linear steps to give a perception of equal change per step.

Multiplying A-Ds, JFET arrays, CMOS switches, digitally driven vactrols, there are many ways, but there's a lot of footnotes and asterisks that are unique to each version.

One I particularly liked was mounting a dual-shafted stepper motor on the panel, and using the other shaft linked to a real pot shaft away from the panel. With no drive, steppers turn easily with perceptible fine-step cogging, which is nice, and the control is a real, no fooling analog pot, eliminating most of the control noise if you do your wiring to the motors well. So the setup works nicely for manual use. When you drive the steppers, they move in steps according to control logic, and when sitting still are held in place by the motor torque, so you can tell the machine has control now if you touch a knob. Or, you can move to position, release the hold current, and leave it in place for manual use. An even more adept version would use a multisection pot to read the manual position of the stepper and memorize the settings so you can always get back to that one set of controls you loved. The (logic) machine will remember it for you at the touch of a button.

There is a LOT of ground for fruitful experimentation. But lots of work to be done.   
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.

anotherjim

Speaking of Arduino, I saw this the other day...
https://www.bitsbox.co.uk/index.php?main_page=product_info&cPath=140_161_164&products_id=3585
Cheap and has more power than the Atmel powered cards.l

ElectricDruid

Quote from: Fancy Lime on April 25, 2019, 01:59:17 PM
Also: does anyone have experience with feeding audio into an Arduino (or whatever) for envelope controlled effects?

I haven't tried it on Arduino, but I've experimented using a PIC as an envelope follower. It works at least as well as the majority of analog solutions and better than average. The PIC has a 10-bit ADC, so I used nine bits, flipped the most-significant bit to "rectify" the waveform (at this point the DSP guys run from the room at my horribly naive approach screaming "Aliasing! Aliasing!") and then finished up with a convenient 8-bit signal. After that, do some peak-hold and whatever flavour of attack/decay filtering you fancy.

And sorry Ripthorn, but using a 32-bit uP for a envelope follower? Sledgehammer meet nut, much? ;) That said, the damn things are so cheap these days ("cheap as chips" is literally true!) that we probably can afford to sling a 32-bit 72MHz device at even basic tasks. But I'm a purist and I grew up on 8-bit stuff, so I still get a kick out of stretching it as much as I can to see how far I can make it go. YMMV, obviously.



amptramp

If you are concerned about asynchronous switching causing switch pops, in this thread:

https://www.diystompboxes.com/smfforum/index.php?topic=120006.msg1122270#msg1122270

I covered a switching system for CD4066 / CD4053 devices that determines when the signals you are switching between are equal voltage then makes the transfer between one source and another.  This can be triggered by a CPU output that does not have to be synchronized with the signal.  It can also be adapted to switch at the zero crossing or the Vref crossing if you are going from a dead signal to an output.  You might be able to program the same logic functionality in a CPU as I put in the schematic so this could be a very minimal change to the hardware - just a comparator.

Fancy Lime

Hey guys, thanks for all the input!

QuoteAnd sorry Ripthorn, but using a 32-bit uP for a envelope follower? Sledgehammer meet nut, much?
I have to agree with Tom here. As long as we are not doing "proper" digital audio but only digitally controlling an analog audio path, 8 bits seem plenty to me. The more compelling reason to want to have more powerful chips, at least to me, would be speed. If we can get the whole system to react fast enough, we can start thinking about wave shaping, which opens nearly unlimited possibilities for programmable analog overdrives. Nyquist-Shannon says we need somewhere on the order of 25µs or faster for the whole "analyze-process-manipulate" loop of we want to have well defined controllable clipping functions. Very difficult to determine, if that is possible without actual (exhaustive) testing. This would of course require fast control elements, so no vactrols for this one. And phase shifting between the "analysis input" of the PIC and the point in the circuit, where the wave shaping happens would have to be taken into account. Oh boy...

@ Ron
Thanks for the link. Very interesting concept(s) that may indeed be fruitfully applied here as well.

Quote from: R.G. on April 25, 2019, 03:58:16 PM
This topic has been on my mind for a few decades now.   :)  [...]

Multiplying A-Ds, JFET arrays, CMOS switches, digitally driven vactrols, there are many ways, but there's a lot of footnotes and asterisks that are unique to each version.

One I particularly liked was mounting a dual-shafted stepper motor on the panel, and using the other shaft linked to a real pot shaft away from the panel. [...]

There is a LOT of ground for fruitful experimentation. But lots of work to be done.   
It's a somewhat imposing mountain to tackle. So all the more reason to assemble a party instead of trying to free solo it. I'll try and start a list of the mentioned footnotes and asterisks for the plethora of possible control elements:

JFETs:
Fast, not very consistent between devices

CMOS switches:
Fast, consistent, some limits to voltages

vactrols (PWM or voltage controlled):
Slow, not very consistent between devices, may be hard to get in some places and in the future

Multiplying A-Ds:
... [no idea really, if someone could chime in, that'd be great]

Digipots:
Stepped, popping noise (unless dealt with appropriately), suitable for static controls, probably not for dynamic things

Motorized analog pots:
Slow, no noise, probably only useful for static controls

Switched capacitor (implemented with CMOS or JFET switches):
Versatile, floating resistors possible, limited range, controlled by frequency

PWM switches (CMOS or JFET):
Limited applications (mostly integrators), large range


What did I miss? Is there a way to control OTAs or VCAs straight from digital device? Filtering a PWM signal through an integrator may do the trick, no?

Cheers,
Andy
My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

ElectricDruid

Quote from: Fancy Lime on May 01, 2019, 04:05:36 AM
What did I miss? Is there a way to control OTAs or VCAs straight from digital device? Filtering a PWM signal through an integrator may do the trick, no?

A simple DAC is the obvious way to control an OTA or VCA, but maybe it doesn't qualify as "straight from" the processor. But connecting a cheap 12-bit chip like the MCP4822 (dual output) or 4821 (single output) to an Arduino's SPI pins is easy, and there are libraries that do all the nuts and bolts for you.

You _could_ use a filtered PWM out as a "budget DAC" and save the chip. This works well if your modulation signal isn't changing fast, since then you can have a very low filter frequency and a decently high PWM frequency and get very good rejection of the PWM frequency without needing a complicated filter. If you were just trying to get an Arduino/AVR/PIC to memorise pot positions and produce the relevant voltage output, this would definitely be enough. If you want to produce an LFO, I'd probably recommend better filtering.

One other option is Pulse Density Modulation instead of Pulse Width Modulation. Some of the AVRs/PICs include an NCO peripheral that can produce this very simply, and it runs at a much higher frequency than PWM usually does, so the filtering requirement is much less. This is what the StompLFO uses, and I have to say, I'm a convert. But it does require a separate peripheral, and PWM modules are more common.


roseblood11

You're re-inventing the earliest multi fx units, like the Boss ME-5, which used multiplexers to switch resistors