surge-synthesizer / surge

Synthesizer plug-in (previously released as Vember Audio Surge)
https://surge-synthesizer.github.io/
GNU General Public License v3.0
3.14k stars 399 forks source link

Semimodular Envelope Trigger/Gate #4366

Closed selenologist closed 3 years ago

selenologist commented 3 years ago

Basically writing another issue for myself to fulfil. Here to collect thoughts and feedback.

There remain numerous quirks and inflexibilities related to envelopes.

Voice-level step sequencers can retrigger the volume and filter envelopes but:

Additionally, single trigger and mono modes could do with more finesse:

Some other issues which involve more flexible trigger behaviour include:

these could be closed as part of a solution to this issue.

Describe the solution you'd like: Make Surge even more like a modular :sunglasses:

A terminal for accepting modulation is used to control the gate of each envelope (cheat solution: a tiny slider?). Possibly trigger should be a separate signal, The summed modulation crosses a threshold with hysteresis (like a Schmitt trigger), this enables or disables the gate. A trigger signal should probably be highpassed so that a gate may be used as a trigger.

As the gate signal is floating-point, you can do the usual modular tricks of inhibiting positive gate signals by overpowering them with negative signals, or summing a steppy waveform with a slow LFO to get envelopes that trigger 'sometimes'. Mod mappers etc could be used to do rudimentary logic gate operations on gate signals.

Existing behaviour is preserved with a pre-routed connection to a main gate generator. This is applied in the init patches and all old patches. Breaking this connection disables the main gate. The main gate generator gets some additional options in the Play Mode section of the UI. There is also a main gate input, which can be used as a quick way to retrigger everything connected to the main gate.

With this added flexibility, we can fold latch and mono st into a unified mono mode, or use this space to control gate generator features. Fingered portamento can also probably be handled using gate/trigger signals instead of being its own mode. This would also give poly patches control over fingered portamento.

Mono modes preserve the oscillator and filter state forever. This will cause a slight difference to old patches, but one we ought to be able to get away with being "XT".

Each envelope gets an option between return to zero (default) or continuing from current level.

Step sequencers and MSEGs have output gate terminals. In the init patches, all of them are wired to the Main Gate Input, which preserves part of the current Surge behaviour... except now LFO envelopes get retriggered too. Existing patches however directly route all step sequencer gates to the volume and filter envelopes to preserve the existing behaviour.

Step sequencers also advance a step on a rising edge.

Known Design Flaws

Describe alternatives you've considered:

mkruselj commented 3 years ago

Some of my thoughts here after I've actually had breakfast. In no particular order.

Sorry for the wall of text. Also. chuckle at the "go outside" remark 😁

selenologist commented 3 years ago

Re poly portamento, we already appear to have 'bend from latest note' behaviour. Poly FP would be 'bend unless there are no notes held, at all'. That is not the most ideal magic behaviour, but it is a useful behaviour I've hacked in before by using aftertouch -> modmapper trick -> portamento so that it only bends when another note is held. That... is a silly hack and I don't know a simpler way with the current model.

Re different envelope behaviour: wanting things to be different comes up all the time especially when you do things like make drum machine patches, which are an effective pattern we ought to reward as much as possible. Like you don't want your bass drum's volume envelope to reset from zero but you DO want the pitch modulation to reset from zero. Particularly if you wish to increase the scene count. No good if all the scenes are inconveniently locked on certain settings.

Re LFO deform: Agreed, this is particularly an issue for sample and hold which lacks a slew limiter ... but isn't the fix for that the formula modulator? An additional deform mode could be useful anyway from a convenience perspective. This is a little unrelated though.

Re latency: thought about it some more, I was confused, it's chill. We don't have to have a 1-block latency on the main gate signal, it can have the correct value at the start of a block no problem. Like it's actually zero samples additional latency, because there's nothing wrong with discontinuities in the gate signal. I just have to make sure that modulation runs before synthesis (have not looked). However modulation-generated signals have a 1-block delay but that's no problem.

Re "a whole scene should be triggerable at note off", in this model this is "invert gate, send inverted gate to main gate in" but this requires that the trigger be derived from the gate... But in this case the 1-block delay of modulators comes in handy.

Re #1383: agreed, missed that one. LFOs should emit and receive trigger, separate from LFO envelope trigger. Actually, I really do think it would be useful if LFOs and envelopes could be decoupled. Often one of them is just a vestigial organ that could have been repurposed if it weren't attached.

mkruselj commented 3 years ago

Re poly portamento, we already appear to have 'bend from latest note' behaviour. Poly FP would be 'bend unless there are no notes held, at all'. That is not the most ideal magic behaviour, but it is a useful behaviour I've hacked in before by using aftertouch -> modmapper trick -> portamento so that it only bends when another note is held. That... is a silly hack and I don't know a simpler way with the current model.

Ha, I guess that might work. I mean we are getting FP button next to Glide parameter anyways after XT 1.0, so it might as well do something extra in poly mode - but this will require a lot of thought (gotta take MPE and non-MPE into account) and unit testing (of course). However I still see no need to decouple gate/trigger stuff and make a separate UI/UX for it just to offer this feature, when FP button could easily sort that scenario out.

No good if all the scenes are inconveniently locked on certain settings.

Doh did I say RtZ should be global at patch level? What I really meant was global at scene level. Would be just as simple, and a bit more flexible. What a fluke - I really was thinking "scene level" but fingers were typing "patch level", lol.

Re LFO deform: Agreed, this is particularly an issue for sample and hold which lacks a slew limiter ... but isn't the fix for that the formula modulator? An additional deform mode could be useful anyway from a convenience perspective. This is a little unrelated though.

Formula modulator could certainly do all that stuff, but I definitely agree a secondary deform mode for S&H that slews it the same way step seq is slewed would be more than welcome! Ditto secondary deform mode for LFO envelope mode which is not applied to the LFO output, but rather to LFO envelope stage switch-case.

Re #1383: agreed, missed that one. LFOs should emit and receive trigger, separate from LFO envelope trigger. Actually, I really do think it would be useful if LFOs and envelopes could be decoupled. Often one of them is just a vestigial organ that could have been repurposed if it weren't attached.

Yeah but they act as a single unit, so this then creates some problems UX-wise. We already have people not figuring out the "down arrow thing", decoupling LFO EG from LFO would potentially make things even worse.

baconpaul commented 3 years ago

Minor point

Both are always retriggered, not just one

The step sequencer has the ability to trigger both, filter, or amp only. right click or control click or something on the retrigger box and you get half boxes which toggle.

selenologist commented 3 years ago

As this is way overcomplicated I'm going to close this one for now so it doesn't clog up the tracker. Can still revisit in a hypothetical future where this seems more reasonable.