zyn-fusion-issues icon indicating copy to clipboard operation
zyn-fusion-issues copied to clipboard

Legato (and monophonic) woes

Open polluxsynth opened this issue 4 years ago • 0 comments
trafficstars

Halfway through this issue https://github.com/zynaddsubfx/zyn-fusion-issues/issues/303 the discussion diverted to how the monophonic (now labelled mono) and legato modes work. I thought it better to continue the discussion here in a thread with an appropriate title.

To summarize, both mono and legato modes aren't really monophonic in the sense that a monosynth is. It's true that only one voice is in the 'playing' state at one time, but the non-playing voices are set to the 'release' state rather then being silenced ("entombed" or killed). This means that when playing in mono or legato with long release times, there can be a lot of voices actually sounding at once.

This could easily be fixed, on the other hand, by setting the newly introduced Voice limit parameter to 1, the intended behavior can be accomplished, as the Voice limit function will then allow a maximum of 1 voices to be in the playing state, with all other voices entombed (silenced).

I discovered a bug in the legato mode with portamento, whereby if portmento is switched off, the filter tracking is still "portamentoed" even though the pitch is not.

In legato mode, two voices are actually used for each note sounding. (One immediate consequence of this is that with long release times, twice as much DSP is used compared to other key modes). One voice is muted while the other one is sounding, alternately. The intention behind this seems to be that when playing a new note, the silent voice receives new waveform parameters (which are calculated on the basis of the pitch), in order to get a smooth transition from the harmonic properties of one pitch to the harmonic properties of the other pitch. In order to accomplish this, a quick crossfade is done from the sounding to the once-silent voice,

However, when testing with an ADsynth patch, it seems that the old waveform parameters are in fact retained. In this case, playing a note at low pitch and holding it while playing one at high pitch exhibits as sound which is noisier than if the high note was played on its own. I experimented removing the alternating voice paradigm (gory details here: https://github.com/polluxsynth/zynaddsubfx/tree/legato-debug), and to my ears it sounds the same as before. In fact, if the waveform were recalculated as per the original intention, if playing with portamento, there'd be a marked change in harmonic behavior at the start of the portamento which would probably be (mildly) disruptive, which is possibly why it is the way it is now. (Have not tested SUB- or PADsynth behavior so will look at that to see what the story is there).

As Mark remarked in the original thread:

Certainly if the discontinuity is too audible the current incorrect behavior would be preferable to something popping and hissing at the user though.

and also

There's some ongoing work to convert add synth into a precomputed wavetable configuration like pad synth, though it hasn't been merged yet. In those cases then there'd be a more natural sliding across multiple wavetables (each wavetable built for a target frequency+antialiasing cutoff). Somewhat expensive, but it would be effectively the right solution and perhaps the complexity would be avoidable if run in a 2x or 4x oversampling mode.

I agree, better not try to fix the waveform parameter calculations in any other way, but finalize work on the precomputed wavetable stuff instead.

One question here is, would it be worth while removing the alternating-voice code already? It doesn't to seem to be doing any good, and just complicates things. (ADD- and SUBsynth investigation might reveal a different story though). I don't really like removing large portions of code which has taken a lot of effort to bring to force though.

One final legato / portamento observation for now: Assume a patch with fairly long portamento. If a high note is pressed, then a low note briefly, the pitch first heads down towards the low note when it is pressed, but upon releasing the low note, the pitch jumps down to that pitch before gliding up to the high note again. If the intent were to simulate a monosynth, the pitch should just revert to gliding back up from whatever point it happened to be at when gliding down. The existing behavior is not useless though, just ... interesting. I don't know if this behavior on any way relates to the alternating voice paradigm. (This seems similar to this issue :https://github.com/zynaddsubfx/zyn-fusion-issues/issues/304).

So to summarize:

  • Stolen voices in mono and legato modes should be entombed rather than released: could fix, but can also be achieved by setting voice limit to 1, so perhaps better just leave it as it is for backward compatibility?
  • Filter control signal exhibits portamento even when portamento disabled: needs to be fixed (minor issue)
  • Pitch jumping to previously note played in legato mode when using portamento: fix ? (coordinate with https://github.com/zynaddsubfx/zyn-fusion-issues/issues/304)
  • Modify harmonic parameter recalculation to match target pitch in legato mode: no specific action, wait for future merge of precomputed waveform feature
  • Alternatng-voice paradigm in legato mode: More tests are needed, but if doesn't do anything useful, suggest removing it, simplifying the code. Or wait until precomputed waveform stuff is ready.

polluxsynth avatar Oct 02 '21 10:10 polluxsynth