DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: Fancy Lime on April 24, 2019, 01:52:23 PM

Title: Digitally controlled analog effects
Post by: Fancy Lime on April 24, 2019, 01:52:23 PM
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
Title: Re: Digitally controlled analog effects
Post by: EBK on April 24, 2019, 02:35:21 PM
Why not use the Arduino to control digital potentiometer chips?
Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on April 24, 2019, 02:57:18 PM
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

Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on April 24, 2019, 03:22:16 PM
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.

Title: Re: Digitally controlled analog effects
Post by: 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.
Title: Re: Digitally controlled analog effects
Post by: 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.
Title: Re: Digitally controlled analog effects
Post by: EBK on April 24, 2019, 05:26:44 PM
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?
Title: Re: Digitally controlled analog effects
Post by: 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.
Title: Re: Digitally controlled analog effects
Post by: Ripthorn on April 24, 2019, 09:04:20 PM
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!
Title: Re: Digitally controlled analog effects
Post by: dschwartz on April 25, 2019, 11:38:07 AM
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.
Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on April 25, 2019, 01:59:17 PM
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
Title: Re: Digitally controlled analog effects
Post by: Ripthorn on April 25, 2019, 02:36:09 PM
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!
Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on April 25, 2019, 02:51:55 PM
Hi Brian,

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

Andy
Title: Re: Digitally controlled analog effects
Post by: R.G. on April 25, 2019, 03:58:16 PM
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.   
Title: Re: Digitally controlled analog effects
Post by: anotherjim on April 25, 2019, 04:48:55 PM
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
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on April 25, 2019, 05:08:31 PM
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.


Title: Re: Digitally controlled analog effects
Post by: amptramp on April 26, 2019, 11:45:18 AM
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.
Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on May 01, 2019, 04:05:36 AM
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
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 01, 2019, 05:01:35 AM
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.

Title: Re: Digitally controlled analog effects
Post by: roseblood11 on May 01, 2019, 06:11:12 AM
You're re-inventing the earliest multi fx units, like the Boss ME-5, which used multiplexers to switch resistors
Title: Re: Digitally controlled analog effects
Post by: Peter Snowberg on May 01, 2019, 06:24:44 AM
I've never been a fan of PWM in general for some reason which may be simple bias, but when you get towards the extremes of the available range PWM shows where it has a tougher time.

If you look at schematics of 1980 synthesizers such as the Prophets from Sequential Circuits for example, you'll find plenty of DACs driving OTAs or VCAs.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 01, 2019, 09:12:54 AM
Quote from: Peter Snowberg on May 01, 2019, 06:24:44 AM
I've never been a fan of PWM in general for some reason which may be simple bias, but when you get towards the extremes of the available range PWM shows where it has a tougher time.

Ironically, it's the centre values that are toughest for the filtering. There's more feedthrough of the PWM frequency close to 50% than at the extremes. PDM reverses this, which is another interesting difference between the two techniques.

Quote
If you look at schematics of 1980 synthesizers such as the Prophets from Sequential Circuits for example, you'll find plenty of DACs driving OTAs or VCAs.

You will indeed. Or at least, plenty of DAC outputs - often there's a single DAC and a lot of demultiplexing to sample-and-hold stages. Lots to be learned from those old schematics. And Stanley Junglieb's service manuals are some of the clearest. I owe that guy a lot.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 01, 2019, 09:26:58 AM
Quote from: roseblood11 on May 01, 2019, 06:11:12 AM
You're re-inventing the earliest multi fx units, like the Boss ME-5, which used multiplexers to switch resistors

Hey, it makes a change from re-inventing the earliest fuzz pedals! :)

Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on May 02, 2019, 02:17:16 PM
Quote from: ElectricDruid on May 01, 2019, 09:26:58 AM
Quote from: roseblood11 on May 01, 2019, 06:11:12 AM
You're re-inventing the earliest multi fx units, like the Boss ME-5, which used multiplexers to switch resistors

Hey, it makes a change from re-inventing the earliest fuzz pedals! :)

@ roseblood11
Well, yes and no. Sure, the basic techniques are nothing new. Show of hands, who here invented something actually new that isn't based on principles that have been around since the 60s? Some people on this forum have, actually, but that is not my ambition for this project. The point is to build something where the hardware is generic enough (and possibly modular) so that a large variability can be achieved by simple reprogramming. PICs provide fairly generic inputs so we can use all kinds of things as control signals for all kinds of effects and even couple effects (or modules) together in more elaborate ways than (hardware) multi effects usually can. Sure, you can do just about anything digitally, but we like analog audio paths, don't we? Another important point is that I want to learn something, not just have a device that no-one else has.

@ Tom
No no no! My fuzz uses two transistors to amplify and distort a guitar in an absolutely new way that no-one has ever thought of before. And it has eight ultra high precision resistors in a circle around both transistors to shield the circuit from ambient bad vibrations and is connected to an orgon accumulator to counteract the unmusical harmonics of chemtrails. So now it sounds EXACTLY like Hendrix. Completely revolutionary, you see.


Andy
Title: Re: Digitally controlled analog effects
Post by: Mark Hammer on May 02, 2019, 03:25:51 PM
It has been MANY a year since I've heard anyone refer to Wilhelm Reich in any capacity.  Boy, does that take me back!  I was reminded of the oddball film "WR: Mysteries of the Organism", which in turn reminded me of the Kate Bush video for "Cloudbusting" in which Donald Sutherland plays Reich, and Bush plays his son, dragging an orgone accumulator up a hill.
Title: Re: Digitally controlled analog effects
Post by: Fancy Lime on May 02, 2019, 03:53:25 PM
The Orgone Accumulator, Ancient Aliens or Hitler riding Velociraptors in the Hollow Earth (entrance at the South Pole) may be relatively harmless examples, but all sorts of hokum from these murky depths is making a major comeback recently. And now children die of the measles again. Does take me back all right but not in a good way. Sorry, off topic, I'll stop rambling.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 12, 2019, 03:33:32 PM
This thread made me go and read the Boss ME-5 schematics. It's an interesting "transitional" design, if we're being charitable. It's a mish-mash of various digital and analog techniques if we're not.

As far as the "digital control of analog" goes, it uses some odd chips which are basic early digital pots (with only 13 steps) and some VCAs controlled by digital-to-analog convertors, and then some multiplexers (4051's, so eight options) switching in different resistor values. Plus a smattering of other analog switches and FETs for routing duties.

So...it's a mixture, and it uses most of the techniques we mentioned above.
Title: Re: Digitally controlled analog effects
Post by: garcho on May 12, 2019, 04:19:49 PM
i love the idea of having more than one function per pot
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 12, 2019, 06:19:10 PM
I agree, as long as that doesn't come at the cost of usability.

It's *far too easy* when designing a digitally-controlled device to fall into the trap of adding more features and saying something like "Well, we'll just have this button you press that selects the mode.." and before you know it you've got an interface where what everything does depends on the settings of everything else. It's ok when you use it all the time, but if you forget about it for a couple of months, you can't operate the bloody thing when you go back to it.

There's a clear risk. But that said, being able to keep the interface simple and still have the features, without having to build a knob-encrusted monstrosity is also good. It's just that it requires some actual good design, not just chucking it together.

Incidentally, the ME-5 doesn't include any pots at all. Since the parameter ranges are so limited (13 steps is a lot on this unit) there isn't much point, so it's all done with buttons. Very 80's.

Title: Re: Digitally controlled analog effects
Post by: garcho on May 12, 2019, 07:17:44 PM
^ yeah, i agree, was thinking more along the lines of replacing concentric pots with digi stuff, maybe 3, 4 functions max, more like 2 and then a pushbutton pot to select which function you're adjusting, no need for extra push buttons. For 1U units and pedals cutting the pots in half could help a lot!
Title: Re: Digitally controlled analog effects
Post by: amptramp on May 13, 2019, 09:34:45 AM
If you do have one pot or input device controlling more than one function, you may need to add displays that show what the parameters are for all the functions you can select from that one input device.

A modern car radio uses shaft encoders (which I recommend but I don't think have been mentioned yet) and the display can be set to show whether you are currently controlling volume, bass or treble and this shows on the display for the mode you have currently selected.  For a stompbox, you would have to have displays showing all the parameters, even the ones you are not currently controlling and an indicator LED showing what parameter the input device is currently controlling.  For example, you may have one control to set both tremolo speed and depth.  If you turn that control, you had better know which parameter you are changing.  You may also want to initialize the settings to either zero or the last position you had set since the shaft encoder does not remember absolute settings, just whether the setting has increased or decreased.  If you are controlling a multiplying DAC like a DAC0808 or DAC1208, you could have hexadecimal displays reading the stored setting for each DAC.  You could have a radio button selector where there is a button above each display and as soon as you push it, the control changes to that parameter and there is a LED showing what parameter you are going to control.

You may want to group the settings so you an just step through preset values for all parameters as you proceed through your playlist at a gig.  You would have settings 1, 2, 3... which you would switch to as you came to another song or even in the middle of a song and the steps would be sequential (with a capability to step backwards if you overshoot a setting).  This would set all parameters to a value from memory and make it as simple as possible to get through a gig - just add the setting to the playlist.  This works best if you never change the order of the songs and never get an encore.
Title: Re: Digitally controlled analog effects
Post by: Ripthorn on May 13, 2019, 05:51:37 PM
I'm working on a project that uses a mini OLED display to display the different parameters for presets. This type of stuff is so cheap now, that we can start to rethink the DIY and single stompbox UI. Nothing wrong with the old ways, but if you want deep editing and larger feature sets, you need to go beyond the 60's. I also have more digi pots, encoders, and uC units to play with.
Title: Re: Digitally controlled analog effects
Post by: Sooner Boomer on May 13, 2019, 06:37:51 PM
A straightforward way to control analog with digital is the R/2R resistance ladder.  You can use your favorite digital switching method to apply a variable voltage (between two values, or between V+ and ground), attenuate an analog signal, or apply a control resistance.

A ladder with 8 elements (1 in 256) gives an acceptable adjustment range, but it's easily expanded because each element is repeated.
Title: Re: Digitally controlled analog effects
Post by: amptramp on May 13, 2019, 07:46:15 PM
Quote from: Sooner Boomer on May 13, 2019, 06:37:51 PM
A straightforward way to control analog with digital is the R/2R resistance ladder.  You can use your favorite digital switching method to apply a variable voltage (between two values, or between V+ and ground), attenuate an analog signal, or apply a control resistance.

A ladder with 8 elements (1 in 256) gives an acceptable adjustment range, but it's easily expanded because each element is repeated.

Your wish is my command:

http://www.ti.com/lit/ds/symlink/dac0808.pdf

Figure 9 shows a programmable gain attenuator using a DAC0808 which has an R/2R resistance ladder and 8 elements giving a 256 element range.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 14, 2019, 09:20:05 AM
Quote from: Sooner Boomer on May 13, 2019, 06:37:51 PM
A straightforward way to control analog with digital is the R/2R resistance ladder.  You can use your favorite digital switching method to apply a variable voltage (between two values, or between V+ and ground), attenuate an analog signal, or apply a control resistance.

A ladder with 8 elements (1 in 256) gives an acceptable adjustment range, but it's easily expanded because each element is repeated.

Agree, but it's worth pointing out that you need to start worrying about the tolerance of the resistors. 1% resistors aren't really close enough for an 8-bit network. You should go to 0.1%. More details/theory here:

https://forums.parallax.com/discussion/download/81061/LADDERNETWORKS.pdf

For this reason, resistor-string or R-2R DACs are a good option, since they've already done this work for you.

(Or sometimes not - MCP4822 is a 12-bit resistor string DAC, but the resistor tolerance is such that the nonlinearity is +/-4LSB or something.)
Title: Re: Digitally controlled analog effects
Post by: Sooner Boomer on May 15, 2019, 03:11:05 AM
I have to respectfully disagree that precision resistors are needed in this case.  We're trying to emulate a potentiometer in a distortion effect (or sommat).  If this were a case of measurement and control for an industrial system, you would need them.  For just music, not so much.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 15, 2019, 05:14:17 AM
It's not a question of accurate control. If it was, I'd agree. With a R-2R DAC, if the resistor accuracy isn't good enough, you get uneven jumps in the value, with the biggest problems caused when the most significant bits switch. That makes the kind of digital stepping that everyone hates.
Resistor strings don't have this problem, since the resistors aren't weighted, so although the steps might vary a bit, they always increase as expected ("guaranteed monotonicity" - https://www.analogictips.com/what-is-monotonicity-and-why-is-it-important/ (https://www.analogictips.com/what-is-monotonicity-and-why-is-it-important/) ).

It might be just music, but we still want smooth controls.
Title: Re: Digitally controlled analog effects
Post by: MetalGuy on May 15, 2019, 04:07:01 PM
0.1% resistors are a MAJOR OVERKILL especially for guitar effects. Also smooth controls are not a must. For practical purposes 20-30 values would be enough. Imagine a pot labeled from 0 to 10 and what is the actual resolution. If you still want smooth, no problem - go for it.
There are many projects for volume controls using relays (or SSRs) and resistor ladders so as usual there's no need to discover the wheel here.
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 16, 2019, 09:25:40 AM
Quote from: MetalGuy on May 15, 2019, 04:07:01 PM
0.1% resistors are a MAJOR OVERKILL especially for guitar effects.
Yes, complete overkill in virtually all situations. Building a R-2R DAC from discrete components is a pretty specific use, and not one that comes up that often in guitar effects in general. If you want to make sure that the voltage you get out of your R-2R DAC for the value "128" is definitely bigger than the value you get out for the value "127" you *need* 0.1%. With even 1% resistors, the value can actually go *down* not up! So 0.1% resistors are *required* to solve specific problems, and a complete waste of money everywhere else!

Quote
Also smooth controls are not a must. For practical purposes 20-30 values would be enough. Imagine labeled from 0 to 10 and what is the actual resolution. If you still want smooth, no problem - go for it.
Agree, imagine how accurately you can set the position of a pot repeatably - it's probably a little better than "on the 0 to 10 marks or half way between them" (e.g. about 20 positions) - but not by much.
Certainly 8-bit resolution is more than adequate, and even 6-bit or 5-bit would be enough (and a R-2R with standard 1% resistor *is* possible at that level). At 4-bit (16 settings) people might start to complain a bit about the limited resolution, but in reality everyone would be able to find a setting they liked - we don't really *need* as much detail as we often get. No-one's knocking the ME-5 for only having 0-7 ranges on a lot of its parameters.

Quote
There are many projects for volume controls using relays (or SSRs) and resistor ladders so as usual there's no need to discover the wheel here.
Absolutely. And there are specific chips for a lot of this stuff nowadays in a way that there weren't when the Boss engineers were working on some of these designs we've been discussing.
Title: Re: Digitally controlled analog effects
Post by: Sooner Boomer on May 18, 2019, 12:01:56 AM
While you *can* buy resistor ladder arrays in chips, you're stuck with whatever value(s) the mfgr wants you to have.  I think that kinda goes against the grain of a DIY Stompbox.  And there's no real reason to spend a pot of money on precision resistors.  Just like people do with many other components, one can buy in bulk and ohm-out the resistors into matched values. 
Title: Re: Digitally controlled analog effects
Post by: R.G. on May 18, 2019, 12:41:15 AM
You can also cut trees, dry the wood, kiln it down to charcoal, boil animal skins down to hide glue, then grind the charcoal to powder and mix up every-so-carefully your own carbon composition mixture, roll up and glue paper straws for body cylinders, then cut out tiny circles of metal and braze or weld lead wires to these to-be end caps (unless you have an interest in finding and smelting metals to mix your own end cap and lead alloys) then made a few zillion trial attempts and measure out your own precision resistors.... hmmm, really ought to construct a moving-coil meter from first principles, then make your own meter from your refined conductor wires.

Did you know that it's entirely feasible to draw your own wire? I've actually done this. Once. Got blisters and broke the wire getting it finer, but my drawing plate worked OK. Rendered hog lard makes a great machining lubricant, btw.

I suppose one could find and refine one's own tin and lead to make solder. Flux is refined pin resin.

By now you're thinking that you didn't want to go that far in the quest to DIY everything. And that is the point. Each person needs to decide what level of stepping back away from manufactured goods is sufficient to scratch their DIY itch. For me, I have a mania to learn the technologies and processes, but at some point, I'll take a moderately manufactured part to craft into my own end result. You may want to go refine your own potassium nitrate, hydrochloric acids, metals, other reagents and work from first principles.

I'm personally good with (ab)using ICs now. When I graduated college in 1973, I was disappointed that circuits would be cased up in every more integrated epoxy packages. I wanted to design the innards right down to transistors. Maybe I've mellowed over the years. Or gotten lazy.
Title: Re: Digitally controlled analog effects
Post by: PRR on May 19, 2019, 01:13:05 PM
> cut trees, dry the wood, kiln it down to charcoal, ...grind the charcoal to powder and mix up... your own carbon composition
> Flux is refined pin resin.


Resistor stuff was powdered coal, not scorched tree-stuff (which was usually burned green). Comes right out of the processes that the Thoreau ("Walden") family developed to make pencils (https://www.amazon.com/Pencil-History-Design-Circumstance/dp/0679734155) after that one deposit of good graphite in England was worked-out.

Pin resin? How hard do you have to squeeze a pin to get resin? Now pine resin, that's easy. I can scrape you a pound on my land. Large parts of Maine and the Carolinas had pines harvested and boiled for "naval stores (https://en.wikipedia.org/wiki/Naval_stores)", not belly-button shops, but turpentine and rosin for sealing wooden ships. Apparently rosin extraction is now done not by steaming but with Zippo fluid.
Title: Re: Digitally controlled analog effects
Post by: Tightpants on May 19, 2019, 02:54:21 PM
I did some work on this a few years ago. Digital pots are the way to go imho. Have a look at this in case you find anything useful: https://www.diystompboxes.com/smfforum/index.php?topic=110976.msg1020197#msg1020197 (https://www.diystompboxes.com/smfforum/index.php?topic=110976.msg1020197#msg1020197)
The original links don't work any more but I posted some more links later in the thread that should be OK. Have fun! :)
Title: Re: Digitally controlled analog effects
Post by: ElectricDruid on May 19, 2019, 05:43:27 PM
Ah yes, I remember it!

Your Design Notes on that pedal are especially good - a nice discussion of some of the problems faced and why you chose the solutions you did. Very topical.

https://www.dropbox.com/s/rlhn4o9w8ignusw/Time%20Lord%20Delay%20Design%20Overview.pdf (https://www.dropbox.com/s/rlhn4o9w8ignusw/Time%20Lord%20Delay%20Design%20Overview.pdf)

Thanks for sharing it.
Title: Re: Digitally controlled analog effects
Post by: Tightpants on June 02, 2019, 06:20:31 AM
Cheers Tom, I used the same approach for a programmable distortion based on a Suhr riot with a Sansamp tone stack grafted on, it performed very well so I will post the design when I get time to write it up.