Tuesday, 21 May 2019

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

My first AUDpiPOde (Ping Pong Delay) M4L device had some problems, and hopefully the savage pruning that I did to go to version 0.03 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 sanded 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.

Getting  AUDpiPOde-A 0v04

You can download AUDpiPOde-A 0v04 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 AUDpiPOde 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.





Thursday, 9 May 2019

Ping Pong Delay re-imagined for Live 10.1 in M4L...

I'm sure that we are about to be swamped by lots of 'homage', 'retro' and 'for compatibility' versions of the classic Ableton Live 'Ping Pong Delay' plug-in effect so that anyone who likes the simple 'about to be deprecated' effect can continue to use it. But rather than just recreate it, why not take the opportunity to re-imagine it, and try to produce something that reflects what it would be like it it was a brand new device made today? Well, I took the re-imagination route, and as usual, the story isn't completely straight-forward...

Let's start with the classic 'Ping Pong Delay' audio effect:


With the input filtering at the top, then the quick 16th note delay time selector buttons, then the Sync, Freeze and 'Adjust' boxes, and finally the Feedback and Dry/Wet rotary controls, it manages to squash a lot into a small space. I've clicked on the '3' and '5' buttons and used the '% tweak' Adjust box more times than I care to think about, and that tiny little 'F' Freeze button is often overlooked as a creative performance tool... (and not to mention the often overlooked 'Control (M)/Right (W)-Click' in the name bar to reveal the 'hidden' context menu with 'Repitch, Fade and Jump' modes - and probably a standard Ableton question to people who think they know Live...)

Ableton Live 10.1 includes the new version that combines Simple Delay and Ping Pong Delay not one device:


(screenshot from live-101-user-wavetables-new-devices-and-workflow-upgrades  https://www.ableton.com/en/blog/live-101-user-wavetables-new-devices-and-workflow-upgrades/ )

There's a lot of interesting additions in the new version: separate delay time buttons for each stereo channel, plus %tweaks, the filter is now 'bypass'able, and the 'F' Freeze button is now made lots more obvious by being labelled as 'Infinite feedback', which I'm sure is going to attract lots more explorative clicks!  All-in-all, it looks cool, and I'm looking forward to it.

Before re-imagining

Back to the classic Ping Pong Delay... What would a modern 'revisited' version include? How about note value based time buttons? How about freezing based on separate stereo channels instead of just the mixed output? How about a 'bypass' for the filters?

First off, I need to look at the structure of just about all of the stereo delay devices that I have programmed in MaxForLive. My preference has always been for stereo in and stereo out, probably because I was raised in an era when not everything that was 'stereo' was actually stereo (and with two flavours of quadraphonic sound fighting it out when I first started reading electronics magazines), and so there's a bit of a common theme (and there's a partial collection from way back in history here, if you are interested...):


This is definitely a 'stereo in, stereo out' delay/echo device, and I have shown only what I tend to call 'Cross feedback', which is feedback that goes to the other channel. So, if you imagine a drum sound on just the left channel input, then assuming that the Dry/Wet mix control is set mid-way and there is some feedback, the output will be the drum sound from the left channel, then the delayed drum sound from the left channel, then the delayed drum sound (double-delayed) from the right channel, then the triple-delayed drum sound from the left channel, followed by the quadruple-delayed drum sound from the right channel, and so on. Each new delayed drum sound bounces back and forth from left to right, and if there's another bit of audio in the right channel, then that will be output (delayed) from the right channel first, then the left, and so on.

I have to say that I'm tempted to go back into some of my older devices and tweak them so that the 'first delay output channel' is selectable. Now that I have been working on ping-pong delays, I'm wondering if being able to decide if a drum that starts on the left should have the first echo from the right, not the left as shown here... It might be interesting to revise those old devices...

Anyway, if you have been following my recent devices you might be thinking that the 'basic' delay shown above is simplified from what I'm currently doing, and you would be right. Here's a more representative delay device - reminiscent of parts of the recent 'hex' series:


In this example, there are two feedback loops: one for the same channel, and one ('cross') for the other channel, which lets you decide if you want the repeat echoes to be in the same stereo channel or to bounce back and forth between the two channels with each successive repeat. The output panning is also controlled by an LFO driving a panner, so the actual stereo field can be animated as well.

What I hadn't done in any depth when I first started was examine the original Ableton Live 'Ping Pong Delay' device. If you are going to 're-imagine' something, then knowing too much about it is going to affect what you do and restrict your creativity, so I just took my usual delay and gave it a UI skin that was strongly influenced by the original device. It turns out that the Ableton device is rather different...


Let's go back to that drum sound on the left channel input - there's a screenshot of the text setup above - I just set the drum sound on the left or right channels using the Utility device, and then used the Dry/Wet mix rotary controls to look at the input and output of the two devices. You need to make sure that you only enable one device at a time, otherwise all those echoes can be very confusing!


If you send the 'left channel' drum sound to the original Ableton Live 'Ping Pong Delay' device, then you get the dry signal first in the left channel, then the delayed version in the left channel,


then a double-delayed version in the right channel, and so on. So far, it behaves just like mine.


But if you then try a drum sound in the right channel input, then you get the delayed version from the left channel first, then the double-elated version from the right channel, and now it is behaving VERY differently from my version.


So, based on this, it seems like the original Ableton 'Ping Pong Delay' device internal structure looks like this:


So the left and right channels are mixed together into a 'mono' single,and this is then delayed and output to the left channel, then that is delayed and output to the right channel, and the feedback goes round both delays. This is why a drum sound on the right channel appears at the left output for the first echo, then the right channel for the second echo, and so on, back and forth between the two channels. Note that with this structure, the first and second echoes are at the same volume in the left and right channels, whereas in my echo devices, the volume of the second echo depends on the 'Feedback' rotary control.

So now I knew the difference between the Ableton device and mine!

Frozen echoes

Let's look at freezing the echo, where the output of the delay is connected directly and solely to the input. Here's what it looks like for the Ableton device:


As you can see, the output will just 'ping-pong' back and forth between the left and right channels with each subsequent echo.

For my device, then there are several ways to do the freezing, and here's one of them:


This behaves in exactly the same way as the Ableton one: the output bounces back and forth from left to right with each successive echo. I have not included the Dry/Wet mix in this diagram because it was originally drawn for the AUDpiPOdePLUS device, where the Dry/Wet mix is inactive when the echoes are frozen.

Anyway, the end result of all of this investigation and looking at how echo devices work is two MaxForLive devices:

1. AUDpiPOde - the first Ping-Pong Delay device that appeared on MaxForLive.com, and which uses my preferred stereo delay to give stereo echoes that bounce back and forth between the left and right channels. This is not a faithful emulation of the original Ableton 'Ping Pong Delay' device - and so the word: 're-imagining' is very apt - this is how I would program a Ping Pong Delay device now.

2. AUDpiPOde_A - which is the second Ping-Pong Delay device that I will post on MaxForLive, and this uses a single tapped delay to give a different ping-pong effect - where the signal that bounces is a mix of both input channels. This is a closer emulation of the original Ableton Ping Pong Delay device in pre 10.1 Ableton Live.

This gives you both double value (which is her to measure for devices that are free!) and a choice: you can have 're-imagined' or 'close'. I hope that you find both variants useful, and don't forget that all of the re-imagining also produced another device: AUDpiPOdePLUS, which (despite the name) is actually a performance-oriented delay device which extends the 'frozen echo' feature into something rather different.

Re-imagining

Anyway, on with the re-imagined delay device:

Here is AUDpiPOde (from the first two characters of ping, pong and delay). I worked on the note value time delay buttons first. I replaced the 1,2,3,4,5... with note values, using the internal M4L time notation: 16d, 16, 16t for dotted 16th, 16th and 16th triplet, etc. I also added more buttons, from 128th note to 1 note (15.62 ms to 2000 ms at 120 bpm).

I also used the '% tweak' Adjust box to automatically switch between 'Sync' and 'Not in Sync'. So when you click a note value button then the delays are in sync, but if you use the '% tweak' Adjust box (with the triangle) then the time delays are not in sync with Live's timing.

Trying to keep the buttons as large as possible, whilst still keeping a small but neat rectangle of buttons meant that the obvious 'three values' of dotted, note and triplet organisation was awkward, and so I opted for a more free-form set where 2, 4, 8 and 16 are on a diagonal, and 32 and 64 have their own tiny diagonal. It isn't perfect, but it keeps the button grid small and neat.






For the freezing, then I added two extra buttons. The 'F' button is as before, and loops the output of the delay back to the input, thus giving the infinite delay that the new 10.1 makes much more explicit. Note that when the delay is frozen, then the feedback rotary control has no effect.










The new 'P' button loops around the stereo channel reversed audio signal, so if the input is just in the left hand channel, then the first delayed repeat will be in the right hand channel, then the second delayed repeat will be in the left hand channel again. being able to ping-pong in a frozen loop is very cool!









The final freeze button is labelled 'P+F' and combines the two previous buttons into one. For this delay, where both channels have the same delay time, then it makes no difference, but if this was available in the 10.1 delay, where each channel can have different delay times, then some very interesting results would be available. Now although you can do exactly the same effect in my AUDhexECHO effect with appropriate settings of the controls, this seemed like something for a 'Plus' version of this effect, and so expect exactly that very soon!





The filters were a challenge. Max For Live provides a lot of filters, and some very sophisticated tools to help you design specific special-purpose filters, but there are two problems. Firstly, the Ping Pong Delay filter is a band-pass filter - the two controls that are provided are the centre frequency and the bandwidth. But for a wide bandwidth, then a combination of a high-pass and a low-pass is easier to make, but then the controls are more complicated - you need to send the centre frequency to both filters, and then add or subtract half of the bandwidth setting. To complicate things even more, the frequency axis is logarithmic, where the frequency goes up by 10 times for each 'decade' block as you move across from left to right (you can see this in the spacing of the lines in each 'decade' block).


In the filter response plot for a band-pass filter shown above, the major lines at the end of each 'decade' block are 100 Hz, 1 kHz, an 10kHz - so the final vertical line on the right hand side is 20kHz, and zero Hertz is way off the the left somewhere. So the band-pass filter shown has a pass-band between just under 100 Hz to just over 3kHz.

The display in Ping Pong Delay is much smaller, of course:


But notice that each of the decade blocks have the same pattern as the first plot, where the vertical lines get closer and closer together as the frequency goes up, and (by implication) the far right edge is 20 kHz. The yellow dot is kind of centred on 1 kHz, and the centre frequency is 949 Hz, with a Q or resonance of 6.17 (which controls the bandwidth of the filter). Now, having the centre of the display at 1 kHz may not be what  you expected, but look at the right hand side - the narrow vertical strip from 10 kHz to 20 kHz is the same frequency range as the whole of the left hand side of the graph, from the 10 kHz vertical line leftwards.

So if we are going to use a simple x/y controller object from Max to control a band-pass filter, with centre frequency on the horizontal axis, then a pictslider output goes from 0 to 127 horizontally. If 0 represents 0 Hz, and 127 represents 20 kHz, then 1 kHz is going to be a value of about 63 or so, and 10 kHz is going to be at about 110 or so. To convert a linear controller value into a logarithmic value requires that we use an exponentiation function: using the 'pow' object in Max. Using the 'pow' object can be quite tricky, because small changes of input values can have large effects on the outputs. My usual technique is to transform the 'pow' into a 'domain' where figuring out what is happening is easier, and then to transform back once the settings are known. Here are two examples which illustrate this:


Box 1 shows a simple way to use 'pow', whilst Box 2 shows the 'transform' method. At first sight, Box 2 seems to add complexity, so we need to look at the inputs and outputs of the two boxes.

Box 1 first:


When n = 0.5, the output only goes to 11, and so the integer 'multislider' object that I'm using to do the plots quantises the outputs, but you can see that the curve goes from 0,0 to 127,11 and is gradually tailing off (just imagine a smooth curve!). When n=1, then the output is a straight diagonal line from 0,0 to 127,127.


When n=1.5 then the curve looks like a classic exponential, and goes up to 127,1431. When n=2 ('y=x squared' is how you would say it) then the max is 127,16129 (127 squared, of course).


  For n=2.5, then the rightist point is 127,181754, and for n cubed (n=3), then it is 127, 2048383.

In order to use these curves, then you would need to scale the maximum output, but this changes for each value of n:

n       maximum output
0.5             11
1.0           127
1.5         1431
2.0       16129
2.5     181754
3.0   2048383

You can auto scale by dividing by 127 to the power n, but this means that we are doing two 'pow' operations every time, which seems inefficient.

Alternatively, the 'transform' method adds scaling (divide by 127) around the 'pow' function so that it always has inputs between 0,0 and 1,1, and then multiply it by 127 to get the same output as the original UI object. The graphs now look like this:


The 'pow' object is now getting floating point inputs, and so we can see what the actual curve looks like without the accidental quantisation! Notice that each curve goes from 0,0 to 127,127.


And again for n=1.5 and n=2, the output is from 0,0 to 127,127.


And finally, exactly the same output range again!

Putting a transformed 'pow' object inside my filter testing gave this max patch:


This time, Box 1 contains a transformed pow function (I was testing out n=3 in this screenshot), and Box 2 contains the max objects to try and turn the horizontal movement in the pictslider into the correct centre frequency for the band-pass filter, and for vertical movement in the pictslider to control the Q, resonance or bandwidth of the filter - which I implemented as a plain butterworth type. Unfortunately, I couldn't get the mouse interface with the pictslider to feel anything like the Ping Pong Delay original, and having a 'difficult to use' filter section in a re-imagining f a classic Ableton Live device seemed like a bad move. So I reverted to two simple filters instead:


So, in this version, there are two pictsliders: one for the high-pass filter, and one for the low-pass filter. in both of them, horizontal movement controls the centre frequency, whilst vertical movement controls the Q, resonance or bandwidth of the band-pass filter. This simplicity felt much better than the previous complexity, and this is what is implemented in the current device.

Note that the high-pass filters are made from low-pass filters by subtracting the original input from the low-pass filter output. This turns a 'lores' object into a kind of 'hires' object. (although there isn't a 'hires' object in Max, of course!)

The filters can be bypassed by using the Filter/Thru button, and this is important because one of the disadvantages of using the 'lores' filter object is that it has a maximum frequency of the sampling rate divided by 4, and so for the usual 44.1 kHz sampling rate in Ableton Live, this means that the highest cut-off frequency for the two filters is 11 kHz.  I'm also cautious about putting filters inside feedback loops, and so the filtering is only on the input, so you don't get the classic 'tape echo' low-pass filtering that gets more and more noticeable with each repeat.

All of this is different to the original Ping Pong Delay device, and means that I should probably persist in trying to get the UI to feel right for the next version.



Commentary

I need to make it clear that I'm really looking forward to using the new '10.1' Delay effect in Ableton Live. It looks like it combines a lot of functionality in a single device, although I do wonder if the 'minimal UI and size' design approach that was used in the older devices has kind of been abandoned and we now have a more 'designed' expansive look. But in these days of larger and higher resolution screens where effects plug-ins (and most VSTs) are one of the last bastions of skeuomorphic design in UI design (as per the iPhone's iOS before it went 'flat'), then maybe some loosening of the stark minimalism of the older Ableton Live is timely. Personally, removing that minimalism and replacing it with pseudo-realism would negate one of the defining differences between Ableton Live/M4L and other DAWs/Reaktor. (And apart from a few notable inverted examples, and one stand-out (the Studiologic Sledge Black Edition), then I'm still waiting for brightly coloured keyboards to become fashionable instead of custom 'stage' specials...)


Another investigation


blortblort reported in the blog comments that the Feedback control was not working correctly. It turned out that I had made a mistake and had cross-connected the two delays, and got the 'freeze's witching wiring wrong. All of this makes AUpiPOde 0v02 a bit weird, and not the re-imagining that I intended. So I went back through the design, fixing things, re-assessing things, and what came out at the other end was AUDpiPOde 0v03, which should fix the reported problems (I also realised that I should do something less re-imagining and more 'homage' to the original, so that's what the AUDpiPOde-A 0v04 device is all about!



AUDpiPOde 0v03 removes the filters, adds the 'Left First' or 'Right First' LD selection button (as in the -A variant), and provides a 'panic' clear button - the red circle. If the echo starts runaway feedback, then the red button clears the contents of the delay. My recommendation is that you should delete version 0v02, and should only use version 0v03.

Getting  AUDpiPOde 0v03

You can download AUDpiPOde 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 AUDpiPOde would require two band-pass filters, two delays, some utility switches, and two mixers, giving a total of about 5 ME.




Monday, 15 April 2019

Spectral auto-panning in MaxForLive for Ableton Live

My two recent MaxForLive audio devices have both been based around having 6 processing sections - hence the 'hex' in their names. But I realised that there was a much simpler device that uses the hex pan section, which could be used in many ways, and this blog post is devoted to it: a hex spatializer!

AUDhexSPATIAL 


AUDhexSPATIAL moves parts of sounds around in the stereo field. That's all. It is quite straightforward, but don't let that fool you into thinking that you can't do much with it.

The input audio is passed through three parallel filters, and then the outputs are auto-panned across the stereo image. The three filters can be used in several ways, but the most obvious way is to use them to split the audio into three separate bands: The high-pass filter outputs the high frequencies, the low-pass filter outputs the low frequencies, and the band-pass filter outputs the middle frequencies.

Each filter output can be panned to hard left or hard right, or can be Auto-panned - controlled by a three position switch: L/Auto/R. But the frequencies of each filter are independent, so there's nothing to stop you putting the high-pass filter below the low-pass, or the band-pass anywhere from low to high.

The filters are there just to provide different blocks of frequencies to the output section where the panning happens. And the three [X] toggle switches allow you to turn the outputs on and off, so if you want to have just the high-pass filter output, then just enable that toggle switch and turn off the others. The two stereo channels are separate, so if you want different filters and pans for left and right, then that is completely possible.

Naming

After a lot of agonising, I have finally decided to use a new and consistent naming scheme for my M4L plug-ins. From now onwards, and if I update anything, then I will strive to use three prefixes:

- AUD for Audio processing devices (aka effects)
- MIDI for MIDI devices (this took ages to figure out!)
- GEN for devices that generate audio

Of course, in an imperfect world, I may not always succeed in trying to be consistent, but I will try. Please let me know if I falter!

Applications

OK, so your imagination is probably your main limitation here. If you want to have the left channel quickly auto-panning the top end of a piano sound, whilst the right channel slowly pans the bass around and both channels have two different resonant filters panning at different speeds, then that's fine.

But there's more. Try putting AUDhexSPATIAL in front of a Ping-Pong Echo, or put it in between two Ping-Pong Echoes... It is very interesting to experience just how complex a simple sequence can sound when it goes through this sort of processing.

Limitations

You can't adjust the panning width directly - adding two extra rotary controls would make the centre section way too big, I reckon. (But let me know if you really want this, and I might schedule a '+' version...) You get full left-to-right panning, or else hard left or hard right. Of course, you could make a rack and use the Utility object to restrict the pan width of multiple AUDhexSPATIALs...

There are only 3 filters and three panners per channel. Making a version with more channels is not in my current plans, and my main concern would be trying to find a way to fit everything into the user interface...

Oh, and the filters are not animated - they are fixed graphics! Sorry...

MaxForLive

Recent blog posts have included details of what is happening inside my M4L devices, and this is no exception. This time, I'm going to look at the three-position switch that has been added to the output section.

Max and MaxForLive have a lot of ways of routing numbers, messages and signals around. There are lots of objects, with names like Gate, Switch, Route, Selector, Matrix, and more. Sometimes the objects that route signals around have different names, and work slightly differently to the objects that route numbers or messages, and they can work slightly differently. It's quite a lot to get your head around, and one of these days, I'm going to try to do a guide (a bit like the one I did on squeezing controls into limited spaces!). But in the meantime, here's the first of a little mini-series where I look at a few interesting ways to route stuff.

The three-position switch does two things simultaneously: it allows you to select between hard left and hard right pan positions, or it selects the auto-pan. These are very different things, although if you look at AUDhexECHO or AUDhexFrequencyShifter then you will see that by slowing the LFO to 'stopped' then the result is fixed pan positions. But that isn't a very practical approach for a three position switch. There is also the complication that the output of the LFO that does the auto-panning is a signal (so it has the yellow-striped connections in Max), whilst the more usual way to control a panner is with numbers, so there's going to be a conversion somewhere.

First off, let's look at the context. Here's the relevant part of the Max code for the audio output of  AUDhexSPATIAL:


And here's the 'pan_mr' object expanded out (this is a cheat to make things clear - in reality, you don't see the controls that are connected to the input ports, but I have removed the ports and added the rotary control and the 3-position switch control to make it obvious how things are connected):


The main audio processing is on the left hand side. Input port 1 (the square box with '1' in it) is the audio signal that is going to be 'panned'. It goes to two signal multipliers (notice the '~' after the '*') that are driven in anti-phase using the '!- 1.' inverter shorthand that I've mentioned before. (The formula inside the object just subtracts whatever you feed into the object from 1, so it really means '1-the_number', and so it inverts the value, so if you put 0 in then you get 1 out, and if you put 1 in, then you get 0 out, and linearly for all other values...). The pan value goes from 0 to 1 to pan from left to right, and so centre is a value of 0.5.

On the far right hand side, you can see how the left and right values re stored in message boxes that are triggered every time that the switch is changed. The 'LED" object with the round circle is a useful way to convert changes into 'bangs' that also shows you what is happening when you are debugging. The '0' and '1' messages that the message boxes output when they receive a bang are converted into signals using the 'sig~' objects.    

In the middle, starting from the rotary control, there is a 'cycle~' object that does the sine-wave LFO function, followed by a bit of maths to get the output into the 0<->1 range that is required by the multipliers that do the panning. The 'scaled and offset' sine-wave is then connected to the middle input of a 'selector~' object, which is a special switch for routing signals. The other two inputs are from the signals from the message boxes. So the selector switch can output:
- a signal representing 'left'
- a signal that is an LFO sine-wave
- a signal representing 'right'


And that's how you can make a three-position switch that has fixed values on two of the settings, and an LFO signal on the other.

Getting AUDhexSPATIAL

You can download AUDhexSPATIAL 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 AUDhexSPATIAL requires six filters, six LFOs, six VCAs, and a mixer, plus some switching for the fixed pan positions, giving a total of about 20 ME.