ADSR experiment preset

This topic covers an experimental ADSR patch uploaded to patchstorage, giving a few details and describing its current limitations.


Intro
There have been a few requests for native ADSR pipe or similar (mostly recently here and here, I think).
Users like @ahnatek have also wondered about a workaround in the meantime.

This patch is my first attempt to get Midihub to produce an ADSR CC envelope like this:

ASDR_linear

or this:

ASDR_EQZR

UPDATE: skip to here to see details on updated version
(overlapping notes issues described below solved)




It ain’t perfect
There are current limitations, however, which stop it being widely useful in its current form.

These include...



An envelope must ‘complete’ before the next one starts:
Ideally, a new note would behave like this…


…where a new envelope would “cut off” any currently running one.

This is what happens instead:


!


It’s (obviously?) monophonic!
As it outputs one set CC, even if the above issue were solved the envelope would apply to both notes, so amp & filter envelopes wouldn’t behave as we might expect in a polyphonic setting.

LFO output limits resolution
The max LFO resolution is 128Hz. This means that, once a “ramp” is less than a sec, the LFO will have fewer steps and become more “bitty”.
It also means finding the best “threshold” to transition from Attack → Decay is a bit approximate

If you think this limited solution might be for you, read on!

1 Like

Here’s the briefest of details for how the patch (sort of) works:

Inputs

4 CC controls Ch16 77-80: Attack Time, Decay Time, Sustain Level, Release Time to set
(easily changed by CC Remap in Line 3&4)

A note_on, note_off pair to trigger envelope.

Output

CC envelope using Ch1 CC3


pipeline sketch description:

now partly out of date

Modifiers
Equalizer pipes in LFO lines can be enabled/disable/changed to give non-linear ramps
Equalizer pipe in “ADR time” line is critically linked to the “Attack → Decay” threshold value and both will need tweaking if changed!


I’ll give more detail if requested, but won’t bother for now as it takes time…

Feedback welcome!

not least if you come across this bug giving unexpectedly results (think I can fix that)
EDIT: bug since fixed

UPDATE: version1

29/04/24: now replaced by Version2

The patch now should follow the rules with overlapping notes:

Here’s some shots from my DAW…

notes separate

As I said in my patch notes, not tested much yet, but this is moving toward a workable “proof of concept” at least.


the mappings to get this far get pretty nasty

I’ll write a proper explanation if requested, but in the mean-time…

...here's the debug diagram I made for myself...

With the diagram in post 1 it’s possible to figure out what the hell’s going on

See post 5

Version 2.1: Virtual Mappings and feature switches

Below are notes on the new Virtual Mapping version of the 2023 physical loopback ASDR patch

This version uses virtual mappings throughout which (as well as freeing up two ports) brings some extra advantages mentioned below



It keeps all the previous features, such as:

Being able to control ADR times and Sustain Level

and envelopes that behave predictably when…


… either released at different points in the timing…

… or interrupted by new notes:




In addition, existing features such as “curve style” and “scaling-by-velocity” have been made more accessible by adding virtual mapping switching.

This means 3 keys (default: note#124=Attack, 125=Decay, 126=Release) can each be pressed to cycle through the curve styles…



…while the ADSR amplitude can be left at 0-127 or scaled by the note velocity…


…by toggling another key (default: note#127)

Note

The switching additions are quite expensive (21/77 pipes in total) but the live functionality may be worth it.
If pipes need to be saved, this line can just be removed or replaced with a multiple -stage mappings controlled by a 3 knobs)


In the next entry, I’ll discuss aspects of the virtual mapping set-up which I hope make it easier for users to adapt to their own controllers

1 Like

Virtual mapping set-up

there are some aspects of the virtual mappings that maybe worth noting:

“Anonymous Mappings”

In the past, mappings were “hard-wired” (as it were) to external ports and so to specific channels and CC numbers.

Virtual Mappings give us more freedom by letting us change these mapping messages in the patch itself.

This diagram hints how:


(see Note 1 below)

“Cycled State” mapping

The switches for the A/D/R “styles” work from a single key each.
This uses a technique involving Scale Remap where Attack, Decay & Release use up 3 “setting-notes” each.

As Scale Remap has 12 “setting-notes” available, this allows for four EQ settings for each stage should you want to augment the patch
(see Note 2 below)

Everything is self-contained

A brief glance at the patch shows two key aspects:

Firstly, all setting and trigger messages enter pipelines that end in Virtual G-OUT.
( Virtual G-IN is never used in the preset)
Secondly, all lines which create outgoing ADSR CC messages have no inputs (they all start with Generator LFOs).

This means that the preset is entirely self-contained: as long as any other use of Virtual G is either avoided (or filtered with care!), one need not worry about any interplay of CCs within the system.


Notes

Note 1

  • The 4-note range in the 3 Note Range Filters will match the In Low|High values in the Note Remap

  • Change the CC Remap In Low|High values to match your CCs. The second CC Remap refers to the 3rd CC value (this creates the Ch16 CC79 Sustain value.

  • CC Channels are unimportant as they’re remapped to CH16


Note 2

  • Transforms after the Scale Remap are in groups of 3:
    • First a ‘Disable’ + Next Note Ch16 CC,
    • next a Ch15 CC to enable one EQ then
    • finally a Ch14 CC to enable the other EQ

  • As hinted above, there is space for 4 different EQs should users wish. Extras can follow the same pattern.
    (In this patch the ADR generator lines share identical EQs. There may maybe use-cases where different EQs are best)

1 Like