Sunday, 7 March 2021

Emulating Turning a Circuit On and Off...

On the Discord channel of the Music Hackspace, @MeLlamanHokage asked about simulating power failure in a circuit using Max. I replied:

For audio circuitry then you would need to implement things like: a low-pass filter with a falling cut-off frequency, an increasing noise floor, rising (or falling) gain, falling clipping levels (eventually to zero volts), rising intermodulation distortion, a changing dc offset...

(Here's a sneak peak of what was in my head - scroll down for more details):


And so I idly wondered if it would be possible to do this in Max - actually MaxForLive, because I realised that this might be a perfect addition to the Synthesizerwriter M4L Tape (etc.) Suite. In much the same way as you record release 'tails' or 'triggers' on a piano, so that you capture the sound made when a key is released and returns to its 'resting' position, then I realised that an M4L emulation of a circuit turning off (and on again) could be used to add in the sound of Guitar Effects Pedals being switched in and out of circuit, or having their power removed. 

This was hugely reinforced when Christian Henson @chensonmusic (of Pianobook and Spitfire Audio fame) did a performance using just a piano sample loop and his pedal board with 23-ish pedals in a recent YouTube video (there are three Moog pedals off to the right of the screenshot, btw):

https://www.youtube.com/watch?v=yF6VKqpC-nA

Imagine @chensonmusic Christian Henson's head and arm hovering over a massed array of guitar pedal goodness...
Christian Henson @chensonmusic 'plays' his pedal-board...

That's two nudges in the same direction, so I stopped dithering, and started coding...

Now I know that the Effect/Bypass switches in guitar effect pedals are designed to not introduce any glitches or noise into the audio stream, and I know that they don't turn the power on and off to the pedal (well, not usually)! But not all of them will function perfectly, and power supplies do fail! I have had several synths, groove boxes and drum machines that made interesting sounds as you turned them off, and I would venture that this may be an obscure and under-utilised area of sampling. See the 'Reminder...' section near the end of this blog post for more thoughts on this...

Are the sounds made by foot-switches on guitar pedals part of a performance? That's an interesting question... So how can I make it easier for everyone to explore this aspect as well?

Free Samples...

Whilst there may be little actual sonic effect on audio signals from a modern foot-switch, there's also the very characteristic sound that guitar pedal foot-switches make in the real world: definitely something to sample and use as a drum sound. (I notice that the BBC overdubbed the sound of a gun being cocked to replace the sound of a seat belt clicking in a recent 'edgy' trail...) So I did some sampling of switches from a variety of sources*, and this turned into an editing session, and you can get the results here for free:


These samples were created by me, and are released into the public domain with a CC0 licence. There are the sounds of foot-switches, and lots more. 'Footswitch14' and 'Footswitch Toggle 14' are what I think of as the classic guitar pedal foot-switch sound, but you may have your own preference...

As always, let me know if you want more of this type of content.

*Sources: Eventide H9 Dark, EHX Oceans 12, EHX SuperEgo+, Poly Digit, Donner DT-1, MIDI Fighter Twister, Rebel Technology OWL, and some other obscure stuff...

ON Off Emulation

But back to the main topic! I hasten to say that my original reply wasn't based on having already seen something that emulated a circuit being turned on and off. Instead it was me quickly thinking about what happens when you remove power from a circuit. So now that Christian Henson had inspired me to  actually design something, I jotted down some more concrete ideas about what 'turning something on and off' actually meant, as well as what sorts of things would happen to the circuits.

The first thing I thought about was a state diagram. At first sight, this is obvious. There are only two states: On and Off. Duh! (And there's the trap, sprung...)

But, with a little more analytical thinking, it is slightly more complex than this. There are actually four states: Off, Turning On, On, and Turning Off. The 'Turning On' and 'Turning Off' states normally happen so quickly that we don't notice them, but the longer they are, the more you notice them. One example where I've done this type of thing before was in a few MaxForLive devices that I programmed where the volume can be set to rise or fall slowly. The 'generic' version is called '3rd Hand' because it almost gives you a third (and very steady) hand to control rising or falling volume...

http://blog.synthesizerwriter.com/2018/07/slow-fades-in-live-performance.html - 3rd Hand

What was really interesting was that when I included an automatic volume control in a device: https://maxforlive.com/library/device/5258/instsineatmosphere then the only feedback comment that I received was that it didn't make any sound, which was exactly what happened with an earlier 'Generator' device where you had to click on a button to get a sound, so since then I have not included this feature in many devices. Please let me know if you would like it to be included!

But back to 'states'...

This '4 states' approach is very useful for live performance where you want something to evolve slowly: like an audio drone that gradually evolves over minutes, or tens of minutes, or longer. If you've ever gone to a 'Drone' performance by William Basinski (there are other audio drone specialists) then you will know the power of a slow rising, changing sound. I saw/heard him when he performed at Ableton Loop 2017...there's something about live performance!

In a drone performance, then there's a lot of slow evolution of sounds, timbres, volume... (the 'Turning On' and 'Turning Off' states) and very little time when the soundscape is static ('the 'On' or 'Off' states). To revisit the old saying about music typically being made up of 'sound and silence', then a better recipe might be that music is effective when it contains interesting/evolving/changing sounds seasoned with  sprinkles of silence.

In this case, the change was all about what happens when circuits get turned on or off. And so I jotted down as my first proper approximations:

- Mains breakthrough from PSU

- Clicks, Crackle and Crunches

- Noise (Rising then falling?)

- Clipping of audio

- Loss of high frequencies in audio

And then I programmed a custom 'synthesizer' in MaxForLive, that used a 4-state slow On and Off generator to drive 5 sections producing each of the 5 features that I had noted. I'm sure there are more things happening, but this was a first attempt, and I'd never seen anything like this before... Now when I say 'I programmed' then that can make it sound like something trivial and rapid, but that isn't quite how the process works... Anyway, some hours later...

OnOff Emulation mr 0v01


There are five processing sections, plus a sixth 'control etc.' section on the right hand side. The layout is much the same as the Ironic Distortion and the Ferrous Modulation M4L devices:

Ironic Distortion - blog post.                   Ironic Distortion - M4L.com

Ferrous Modulation - blog post.              Ferrous Modulation - M4L.com

Each section has a 'Mix' slider, which sets the level of the output of that section, with a big 'Mute' button.


But because this device is all about controlling the 'Turning On' and 'Turning Off' states, then there are extra controls in each section which are devoted to setting how time affects each section. The big grey bar is the current On/Off stare: 100 (all of the bar is grey) is On, whilst 0 (all of the bar is black) is Off. The movement of the bar (up or down) shows how things change during the 'Turning On' or 'Turning Off' states. To the right of the bar are four rotary controls, plus an 8-button switch selector.  The screenshot above is for the I (Impulse) section, and so each starts with that letter. So I-On is the time for the bar to move from Off to On (the 'Turning On' time), whilst I-Off is the time for the bar to move from On to Off (the 'Turning Off' time). 

The 8 position switch in the middle controls how the bar moves. L is for Linear, and so the bar just moves steadily from top to bottom (a straight line graph). S is for Sine, so the bar slows down as it gets to On. Z is Sine-squared, so the slow-down is sharper. P is for Power, so the bar slows down as it gets to Off. Q is for Power-squared, so the slow-down is more abrupt. B is for Bipolar, so the bar slows down as it gets to On and Off. D is for Bipolar-squared, so the slow-down is more abrupt. Finally, the light purple S that is linked to the two rotary controls on the right is for 'Smooth' (or Log) and this provides two additional controls that let you change the time of a logarithmic slow-down as the bar gets near to  the On or the Off. 


The best thing to do is to listen to the effect that the controls have! It is a bit like the Flutter waveforms in Ferrous Modulation: sine sounds boring, whilst the narrow spikes sound jerky... You may find that the Smooth setting gives good control, but remember that the S, Z, P and B positions don't have the slow-down at one extreme, and so have a very different effect. If you find yourself over-using the Smooth setting, then deliberately choose one of the more abrupt options. 

Separate controls are provided for each sections because the final sound works best when each of the sections has different timing! If you have the same timing for all of the sections than it will sound boring... One of the settings that I like is to have the Clip section happen last, so that you last thing you hear is the distorted audio...

The Sections

From the left hand side, the sections are in two parts. The first two sections process the incoming audio signal: 

Freq. 

This section just applies a low-pass filter to the audio input, and lowers the cut-off frequency as the bar moves from On to Off.  (Or raises it as the bar moves from Off to On). This emulates that way that some audio circuitry loses high frequencies as the power supply is reduced.

Clip.

This section has optional Compression and Filtering, but the main effect is to apply clipping to the audio input, where the clip limits reduce with the bar, so there is no Clipping when the device state is On, but more and more clipping as the state approaches Off. Note that the volume drops to zero when the state is Off... so you don't hear the effect of extreme clipping when the limits are zero! 

The next three sections are generators, and so do not process the incoming audio:

Noise

White noise filtered to give it various colours. The 'Gain' control and the mixer slider are effectively the same control...

Impulse

Crackles, pops, crunches, and other 'Impulse'-type sounds are generated in this section. Because the source is random noise, then these will not repeat - every time a new and different sound will be produced. 

Mains

This is slightly strange - it introduces the sound of mains hum, which is weird if the power supply has been removed. But, curiously, as with many sound effects, nonsensical often seems to work. It seems that having mains hum fade in and out implies something happening with the power - a bit like the way that sparks always seem to jump out of control panels on spaceships and submarines in the movies whenever there's an explosion or a collision. 

None of these sections is particularly complicated. Each does just one generation or processing function. Feel free to look into the code to see how each works - there's no magic used. 

The Big Button

One the far right hand side is the Control section. This has the big 'On/Off' button, text that shows the current state (1 of 4 possible states), and a generous set of memories for your own creations - just shift-click to store, click to recall. 

Reminder...

It is probably worth noting that although this might appear to be just a generator of On/Off sounds, it is also a processor - the Freq and Clip sections process audio, so if you don't input anything then they won't produce any output. The ideal setup is to have a sound that you want as the basis of the final result, and then use OnOff Emulation as a way of 'bracketing' it with an On and Off emulation.

This is slightly different to what the Release Trigger or Release Tail samples are doing in a piano sample - they deliberately do not include the piano note itself. (You press down on a key, and then release it, so you get the sound made by the key itself and the associated 'action' mechanics, but you don't do this with a string vibrating. ) OnOff Emulation processes any audio that is sent to it, and then layers the mains, impulse and noise sections on top of it. 

And this set me thinking... What about a release trigger/tail generator? I've never seen a dedicated one, because all of the release triggers/tails that I've ever used have been just samples that are part of the sample set of a sampled piano... The only exception that I can think of is for Harpsichord-type sounds on a DX7 (or other FM synths,  etc.), where the sound of the jack hitting the string when the note is released, is synthesized separately using an envelope where the attack and decay are short, the sustain level is zero, and the release rises to the final/initial level to give an envelope that only affects the release segment of the note. Oh, and acoustic guitar sounds, where string buzz is also synthesized this way... There's probably more now that I'm thinking about it this topic...

So a release trigger/tail generator would have different sections, and actually might have some aspects in common with a 'Riser' synthesizer, although they don't seem to be as 'in vogue' as they were a few years ago. I remember suggesting that a custom riser could be made by processing a 'reverb'ed section of a track in an Ableton Loop Studio Session back in 2015, and got a tumbleweed reaction from the room, and the 'Name' Producer then made one using filtered noise and everyone else nodded their heads. I have always swum against the tide, by the way...

I have added this task to my 'ever-expanding' (as Loopop says on YouTube) list of 'things to do'.  Don't hold your breath, though: it's a long list and I'm very busy. 

And Finally...

I haven't really seen a device like this before. Well, actually, that's not exactly right, because I have - this is just a synthesizer, but not your common variety. This is a purpose-built 'custom' synthesizer made to produce just one type of sound.  What I haven't seen before is a synthesizer that is dedicated to making the sound of a circuit being turned on or off. But now I have. And so do you, now! I think it shows the power of Max that you can use it to make arbitrary sounds and sounds that haven't been made before (or maybe sounds that I think might not have been made before...).

My grateful thanks to @MeLlamanHokage for the original question about turning circuits on and off, and to Christian Henson for using a pedal board as a performance instrument at exactly the right moment to get me to turn speculation into reality. Thank you, sirs!

---

Getting ONOff Emulation

You can get OnOff Emulation here:

    https://maxforlive.com/library/device/7074/onoff-emulation

And yes, I realise that it should be called AUDonOFFemulation if I was to use my own naming scheme, but that just reads crazy!

Here are the instructions for what to do with the .amxd file that you download from MaxforLive.com:

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(In Live 10, you can also just double-click on the .amxd file, but this puts the device in the same folder as all of the factory devices...)

Oh, yes, and sometimes last-minute fixes do get added, which is why sometimes a blog post is behind the version number of MaxForLive.com...

And no, I haven't had a chance to test it in Live 11 yet... To much to do, so little time...

Modular Equivalents

In terms of basic modular equivalents, then implementing OnOff Emulation is a mixer plus a VCF plus a Clipper plus a noise source, an envelope follower and a State-Variable Filter, plus a trigger and 10 AR envelopes. Nothing is complex, but there's quite a lot of separate bits to deal with, which can be tricky on a modular... 

Overall, I reckon that OnOff Emulation would require an ME of about 20. Alternatively, you could just take any modular patch and see what happens when you power it down and up. (Caution: Turn your amplifier volume down, and use a limiter on the input. Increase the volume slowly and carefully - with caution. Not recommended with headphones! Do not turn modulars on and off repeatedly and quickly!) 

---

If you find my writing helpful, informative or entertaining, then please consider visiting this link:

Buy me a coffeeBuy me a coffee (Encourage me to write more posts like this one!)


Synthesizerwriter's Store
 (New 'Modular thinking' designs now available!)

 



 













No comments:

Post a Comment