Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envelope restart point in monophonic play modes #824

Closed
baconpaul opened this issue Apr 10, 2019 · 6 comments · Fixed by #6344
Closed

Envelope restart point in monophonic play modes #824

baconpaul opened this issue Apr 10, 2019 · 6 comments · Fixed by #6344
Labels
Feature Request New feature request Modulation Modulation related issues
Milestone

Comments

@baconpaul
Copy link
Collaborator

As first reported at https://www.kvraudio.com/forum/viewtopic.php?p=7368001#p7368001

In mono modes the envelopes (Amp, Filter and all the LFOs) should have a 'legato' mode which means when they re-trigger rather than retrigger from 0 they re-trigger from current envelope level.

This image explains it clearly

KVRENV

Open questions are

1: Where to put the control in the UI (In the LFO we could put it under bipolar for instance)
2: How to code it up (but should be pretty easy since in the mono modes you are on the same voice so you have all the data structures)

@baconpaul baconpaul added the Feature Request New feature request label Apr 10, 2019
@baconpaul baconpaul added this to the 1.6.n milestone Apr 10, 2019
@mkruselj
Copy link
Collaborator

mkruselj commented Apr 10, 2019

Just as a sidenote, I wouldn't call it "legato" mode, I'd call it Reset mode, and then with options "Zero" and "Analog" (or "Current", but that might sound a bit confusing/ambiguous). Or, maybe best, should just be a single button called "Reset From Zero", which would be enabled by default (to preserve existing behavior).

Also it should work in polyphonic mode as well, whenever an already sounding voice is reached. Say you have 8 voices polyphony, 8 sounding voices in their release stage and you play a new note, it should take whatever the envelope level(s) were for that voice and go from there.

@baconpaul
Copy link
Collaborator Author

The poly mode trick will be hard; poly mode creates new voices and reaps old ones so it the a voice gets re-used it does not have the info about the prior voice playing in that slot. (Poly mode is also not a hard wall in surge remember; you can get to 10 voices in 8 voice poly mode in some situations)

Agree on your rejection of legato mode as name.

@baconpaul baconpaul modified the milestones: 1.6.n, Currently Unscheduled Oct 4, 2019
@mkruselj mkruselj added the Modulation Modulation related issues label Feb 5, 2020
@baconpaul baconpaul modified the milestones: Currently Unscheduled, 1.7.n Jul 11, 2020
@mkruselj
Copy link
Collaborator

@baconpaul What do you think how complicated would this be to add? I was thinking adding this mode on RMB context for Play Mode parameter...

Code hints requested! :)

@mkruselj mkruselj added the Code Hints Requested Someone would like to tackle this but wants a few pointers on how to start label Aug 18, 2020
@VincyZed
Copy link
Collaborator

+1, that'd be sweet!

@baconpaul
Copy link
Collaborator Author

So the way I would do this is

  1. in ADSREnvelope add a method called 'resetLevelAtAttack()' which does that
  2. In SurgeSynthesizer where you get the nvoice stuff and getUnusedVoices, after the new( nvoice ) call if you are set grab the ampeg and call resetLevelAtAttack
  3. Add a toggle

This one is tricky.

@mkruselj mkruselj removed the Code Hints Requested Someone would like to tackle this but wants a few pointers on how to start label Aug 19, 2020
@mkruselj mkruselj modified the milestones: 1.8.n, 1.9.0 Oct 8, 2020
@mkruselj mkruselj changed the title Envelope Starting Point (Legato Mode) in Mono Modes Envelope restart point in monophonic play modes Oct 8, 2020
@mkruselj mkruselj modified the milestones: 1.9.0, Surge XT Jan 24, 2021
@baconpaul
Copy link
Collaborator Author

baconpaul commented Jul 3, 2021

OK a bit more context on exactly how to do this

The action starts

for (iter = voices[scene].begin(); iter != voices[scene].end(); iter++)
and moves out from there

That block is killing the old mono voice (the find and uber_release) and starting the new voice (the (nvoice) constructor call)

So what you want to do is

  1. Add a new type to ADSREnvelope called StateCapture and add a getStateCapture and setToStateCapture method which you know, captures the state and resets the envelope to that captured state
  2. Add a RMB which puts a bool on the scene storage for if you want to restart or recycle envelopes. Add the RMB to the poly menu. etc... and make sure to stream and unstream the bool with the version and son on
  3. In the block linked above add a variable ADSR::StateCapture aeg_sc, feg_sc or what not and a bool which is that storage state
  4. before the v->uber_reelase do aeg_sc = v->aeg.getStateCapture() and so on
  5. After the nvoice initialization do v->aeg.setTOStateCapture and so on
  6. Add a regtest that it works both ways
  7. Debug, commit, win!

@baconpaul baconpaul modified the milestones: Surge XT 2.0, Surge XT 1.1 Jul 10, 2022
baconpaul added a commit to baconpaul/surge that referenced this issue Jul 12, 2022
Add a new mode for the AEG and FEG where in mono modes you
can retrigger the envelope start not from 0 / 0 phase / 0 charge
but from a phase / charge which matches the envelope levels of
the previously playing and stolen voice, if one is present (and
start from 0 otherwise).

Closes surge-synthesizer#824
baconpaul added a commit that referenced this issue Jul 12, 2022
Add a new mode for the AEG and FEG where in mono modes you
can retrigger the envelope start not from 0 / 0 phase / 0 charge
but from a phase / charge which matches the envelope levels of
the previously playing and stolen voice, if one is present (and
start from 0 otherwise).

Closes #824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature request Modulation Modulation related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants