Showing posts with label Frozen Echo. Show all posts
Showing posts with label Frozen Echo. Show all posts

Tuesday, 21 May 2019

Ping Pong Delay - Re-imagined differently! (Plus M4L Audio switches)

My first AUDpiPOde (Ping Pong Delay) M4L device had some protracted problems, and hopefully the additional tweaks for version 0.04 should fix them. But in the course of learning more about how the original (and soon to be deprecated) Ableton Live Ping Pong Delay actually worked, I realised that I had re-imagined it along the wrong vector, and that my 'all stereo' approach had too many differences to the original. The band-pass filter also proved to be a significant challenge, and dropping it again restricted the flexibility. (...Now, I'm not the greatest fan of 'muddy' echoes, but they are a defining characteristic of some vintage tape echo units...)


So, here's almost the opposite of AUDpiPOde - it uses a tapped delay line, mixes the channels into a mono signal for the echoes, and puts back the 'far-from-perfect' band-pass filter emulation made up from a high-pass and low-pass filter (and I need to learn more about filters in Max!). It uses a different 'freeze' method (as well as the ones I added), and it provides a 'Thru' button to bypass the filters. I also tweaked the delay routing so that you can have 'Echo in the Left channel first, then the Right channel' or 'Right channel first, then the Left channel' - which is quite striking if you are used to the 'feel' of the original!

And the name? AUDpiPOde-A, of course!

Making audio switches

One of the traps for people who are trying to learn Max are the large variety of switches. There are simple switches, complex matrix switches, routers and the names are sometimes different if audio is being switched. I'm still gathering information for a guide, but in the meantime, here's what I've been doing to build custom audio switches...

LR 'Left first' 'crossover' toggle switch

The 'Echo in the Left channel first, then the Right channel' or 'Right channel first, then the Left channel' switch functionality is a good example. All that needs to happen is that the two outputs from the delay (the middle tap and the end) need to be routed to the Left and Right channels, in the two possible combinations.


This is the output stages of the AUDdiPOde 'Ping Pong Delay' device, with, from top downwards, the feedback rotary control, the 'LR' echo order control, and the Dry/Wet rotary control. For the Feedback control, you can see how the line~ object is fed with pairs of '<new value> 50ms' values for each new line segment, so that the multiplier that does the feedback only gets values that change reliably slowly (each new value takes 50ms to happen) and so the amplitude of the feedback signal doesn't jump suddenly.

Just below the feedback code, the 'LR' box is where the interesting switching takes place. The 'p cross_mr' object has two stereo inputs (from the tap and the final output of the tapped delay line) and two stereo outputs (which go to the Dry/Wet' balance control library object. The 'LR' toggle switch controls the 'p cross_mr' object, and all it does is change between the default 'Left In to Left Out, Right In to Right Out' switch setting to the alternate 'Left In to Right Out, Right In to Left Out' which reverses the channel ordering. So in the default 'Left first' position, the 'LR' switch controls the 'p cross_mr' object so that the tap output of the delay line goes to the Left In of the 'cross' switch and comes out of the Left Out, which means that the tap output is heard in the Left channel first, whilst the final output of the delay is routed to the Right channel and so is heard later. When the 'LR' toggle is in the 'Right first' position, then the 'cross' switch routes the tap output of the delay to the Right channel where it is heard first, and the final delay output is routed to the Left channel, where it is heard later. So the 'cross' switch connections are either straight-through, or crossed-over - hence the name.

I don't think there is a standard MaxForLive switch that does this 'out of the box', so I made the 'cross' switch:

  
There are only two objects used inside the 'cross' switch - gate~ objects, which are just on/off switches for audio signals, and one of those arcane 'not quite obvious' special-purpose modifier objects: '!- 1', which inverts a 0 or 1 control value. So 0 becomes 1, and 1 becomes 0 - it is an 'inverter' for  control values. If you replace the two left-hand gates with through connections (closed switches) then you can see that A goes to X, and B goes to Y. Whereas if you replace the two right-hand gates with throughs then A goes to Y and B goes to X, and so achieves the straight-through or
crossover switching.


In physical hardware, then crossover switches like this are very easy to spot when you look at the rear  wiring of a front panel - the inputs go to the centre common part of the switch, whilst the outputs come from one of the outer pairs, and two wires cross over the outer pairs - so you can see at a glance that it is a crossover switch!

Fade switches

If you just switch from one audio signal to another, then you get sudden changes in the value of the signal, and these can cause clicks in the audio. To avoid this happening, one technique is to 'dip' the audio volume as you do the switching, and then restore it afterwards. This approach is used in AUDpiPOdePLUS, the 'performance-oriented' freeze echo device.

For this technique to work, then a sequence of operations need to happen in the right order, and at the right times. Here's the sequence:

1. The volume is at maximum.
2. trigger for the switching occurs. In the AUDpiPOdePLUS device, this happens when one of the 'Freeze' mode buttons is clicked.
3. The volume starts the fade downwards to zero.
4. The volume stays at zero for a few milliseconds, whilst the switching takes place.
5. The volume starts to fade back up.
6. The volume reaches maximum level again.

Once again, there wasn't a standard pre-prepped switch for the 'Freeze' mode button signal routing, so I made my own. It uses the 'constant volume' technique from a previous blog post, plus the 'gate~' switching describes earlier, with added 'fading' to dip the audio signals in and out at the right moments.


The three 'Freeze' modes are A, A+B, and B, which correspond to 'Tap', 'Final output', and 'Tap and Final output' being fed back to the input of the delay. the volume compensation is done using a 1/n multiplier, so that the final multipliers multiply by 1 for single inputs, or by half for two inputs. The fading is done by the 'p dip_mr' objects, whilst the gate~ objects do the switching, and the 'pipe' objects just delay th switching so that it happens when the volume is zero. But the really interesting stuff is in the 'dip' object:


Unfortunately, once you have seen it, then it isn't quite a magical as you might have expected. The line falls to zero in 50 milliseconds (ms), then stays there for 10 ms, then rises back to 1 in 50 ms again. The 0to 1 values of this 'fat' or 'dip' envelope are the multiplier value used in the multipliers, so there's no complicated conversions required. Here's the same thing expressed as a timing diagram:


So the trigger happens when one of the 'Freeze' buttons is clicked. The fade envelope starts to fall, and when it reaches zero, then the multiplier is zero, which means that no audio gets through the multiplier. The switch control has been delayed from when the trigger happened, and the audio signal is switched whilst the envelope is at zero and there is no audio signal getting through. Once the switching has happened, then the fade envelope returns back to 1, and the audio has been switched without any click happening.

This 'dip' fade envelope technique can be used whenever you want to switch from one audio signal to another without having a click. There are other ways to do it, including some that don't have any 'dip' in the audio, but this is a simple starting point for further explorations.

Filtering

I have struggled with the filtering all the way through the two 'AUDpiPOde' devices. In this 'A' version, I have revised the filtering again, so there is now only a single low-pass filter instead of two in cascade, and the high-pass filter is now a State Variable design because the 'subtracted low-pass' technique didn't seem to work very well (but then inside a feedback loop is always a bad place for any filter!). This is far from a perfect design, and full credit to the Ableton coders who have a far superior filter in the original Ping Pong Delay, and in the new 10.1 Delay devices. If only such a filter was available in MaxForLive...

Getting  AUDpiPOde-A 0v05

You can download AUDpiPOde-A 0v0for free from MaxForLive.com.

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 the blog post is behind the version number of MaxForLive.com...

Version 0.05 gives some idea of the development problems that I have had with these 'ping pong delay' devices! It seems that having ping pong delay plus several freeze modes is a good way to get confused about single routing, and I have made more mistakes than I want to think about. So my normal 'Work In Progress' label definitely applies to this device!

Modular Equivalents

In terms of basic modular equivalents, then AUDpiPOde-A would require two band-pass filters, two delays, some utility switches, and two mixers, giving a total of about 5 ME.






Sunday, 12 May 2019

Frozen Echoes - a sneak peak inside my M4L development pipeline...

I'm going to break my usual routine this time. Instead of a finished MaxForLive device, I'm posting an early prototype so that you get to see something before I have smoothed any rough edges.

For a long time, I've been fascinated by syncopation, and so the '3' and '5' buttons in Ableton Live's Ping Pong Delay have always been my defaults. Whilst working on my re-inagining of that device, I realised that the extended 'Freeze' buttons that I had added could also be pushed further - into territory that my AUDhexECHO partly covers, but with a different, more rhythmic, more performance-oriented slant. The result is a 'Plus' version of AUDpiPOde, but there's a lot of extras in that 'Plus'! (I also removed the input filtering, but I think the additions make up for that!)

AUDpiPOdePLUS

Here's the basic device: AUDpiPOde split into two separate channels, and without the common time and feedback controls - so just an echo effect.


The left half of each to the channel panels is just taken from AUDpiPOde, and in this mode, you get two different delay times for each channel, so the ping-pong echoes just bounce back and forth in stereo, as you would expect - but because the time delays are different, the timing is more... interesting.

The two buttons marked 'Free' mean that the two channels are separate. If you click on the one above the 'ms' time setting in the Right channel then it changes to 'Anti', which indicates that the two time delays work in opposition. So the time delay for one channel goes up as the other channel goes down.


So 1750 ms in the Left channel equates to 2250 ms in the Right channel, and notice that the time delay adjuster is greyed out in the Right channel - using the 'Anti' button just makes syncopated echoes easier to set up for 120 ppm (at the moment), but it is a good starting point for the next stage.

The panel on the far right contains common controls, including 7 'performance' controls. The largest three are just common versions of the three 'Freeze' buttons: Freeze (Ping), Freeze (Ping and Pong) and Freeze (Pong), where 'Ping' is a 'same channel' echo, and 'Pong' is an 'other channel' echo. The Dry/Wet rotary control controls the mix between the straight-through audio and the processed audio, and the 'MakeUp' slider/indicator is only active when 'freezing' is happening. The final four buttons are connected to the 'freeze' loop processing...

The right half of each of the channel panels contains two processors: a limiter; and a frequency shifter. These two audio processing effects are not inside the feedback loop that is associated with the 'Feedback' rotary control. Instead they are inside what I will call the 'freeze' loop - because this echo effect breaks two of the 'rules' that people often apply to echo units:

1. 100% feedback will cause the delay to oscillate, which is generally considered to be bad.
2. Don't put any audio processing in the feedback loop, because it will affect the feedback and might cause it to exceed 100%, in which case the first rule applies.

Luckily, inside the 'freeze' loop, things are slightly different, and this design has 100% feedback plus audio processing, and it is much harder to get it to oscillate than you might expect. In fact, the freeze loop is specifically designed to avoid the usual runaway feedback, although nothing is perfect! When the 'freeze' mode is selected, the input is switched from the audio input to the output of the freeze loop processing, so the delay is looped around itself, and only outputs audio signals. The Dry/Wet balance control shifts the all 'Wet' when 'freeze' mode is active, so that only the frozen audio is output.

One of the major changes between the plain and the 'Plus' versions of AUDpiPOde is hidden away in the Max code, and it is the audio switching. The Plus version fades in and out smoothly between audio signals, whereas the plain version just switches immediately. The freeze mode only works when the transitions in and out are as smooth as possible, and the fades help to minimise them. This design does to use cross-fades - I'm still trying to get my head around a way to do this, and it remains one of those 'one day I will figure it out' aspects of my programming.

And so to 'freeze' mode:


The selected button is 'P' , which is 'Freeze Pong', so the output goes round each delay in series, and with the 'Anti' time delay setting, this means that the audio will be delayed by 1000 ms, then 3000 ms, the 1000 ms, etc. The frozen output is thus 4 seconds (4000 ms) long in total, and so it repeats every 4 seconds. And because it is frozen, it can repeat indefinitely - although if you activate the Limiter or Frequency Shifters then this isn't true! (because they alter the audio) And when you want to stop the repeats of the frozen echoes, then you just click the 'P' button again and the Dry/Wet control will return to the previous setting, smoothly restoring the echo effect as before the freeze was activated.

So the performance process goes like this:
1. Set up the echo timings in 'Anti', so that the echoes stay in sync (or alternatively, you could just abandon sync!)
2. Click on one of the three 'Freeze' buttons.
3. Let the frozen echoes repeat...
4. Click on the highlighted 'Freeze' button to return to echo mode.

Things to fix

There's quite a lot of extra text needed here to describe the operation of the Limiter and Frequency Shifter effects. The timings in the time delay selection tabs aren't in the right order! I need to fix this. Also, there's that cross-fade that has so far defeated me! (Which means that the frozen echo loop is not quite perfect...) Finally, I'm wondering if I should put filtering inside the 'freeze' loop, which might be quite interesting...

Anyway. Enjoy!

Getting AUDpiPOdePLUS 0v03

You can download AUDpiPOdePLUS 0v03 for free from MaxForLive.com.

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 the blog post is behind the version number of MaxForLive.com...

Modular Equivalents

In terms of basic modular equivalents, then AUDpiPOdePLUS would require two delays, two limiters, two frequency shifters, some utility switches, and two mixers, giving a total of about 9 ME.