zynaddsubfx icon indicating copy to clipboard operation
zynaddsubfx copied to clipboard

Implement a sequenced "Reverter/Delay" effect

Open JohannesLorenz opened this issue 1 year ago • 5 comments

Motivation:

  • We have no reverter at all right now. Reverters can popular in many cases: They allow extending drumkits by fading-in counterparts, which is often used for snares and cymbals. Also, in electronic music, reversing any kind of output is quite popular, especially after Echos/Reverbs.
  • The reverter effect can easily be used as a Delay with a single boolean.

Function:

  • The effect works with time slices, specified by nominator and denominator
  • Two buffers, one records the current input, the other buffer writes its content (the previous record). At the end, both buffers are swapped. A boolean allows reverting the "write" phase.
  • Discontinuities must be resolved properly
    • Only relevant if the reverter boolean is being used
    • The fade-out might be easy, since we can continue the wave, as we knew what was before the (original, non-reverted) wave -> We can simply fade out this part
    • The fade-in: Unlike fading in notes in e.g. ADsynth, where punch at the beginning is crucial, this is not the case here, so we can go with a rather slow fade-in to avoid clicks in all cases. Also note, the fade-in is the fade-out of the original wave, so it is never punchy. Suggestion: Take the slowest fade in time that we use for ADnote notes: ~256 samples at 44100 Hz = ~5ms.
    • Probably we must try out good solutions here

JohannesLorenz avatar Jun 25 '23 11:06 JohannesLorenz

Btw, it's not urgent, but @friedolino78 @fundamental feel free to review this concept.

JohannesLorenz avatar Jun 26 '23 18:06 JohannesLorenz

it seems to me that this is technically quite similar to the comb filter

at the first look only two line has to be changed: smp[i] = smp[i]*gain + tanhX( gainfwd * sampleLerp( input, pos) - gainbwd * sampleLerp(output, pos)); would be: smp[i] = sampleLerp( input, pos);

and: float pos = float(mem_size-buffersize+i)-delay; would be: float pos = float(mem_size-offset-(n*offset+i)%delay);

with n++ for every buffer.

friedolino78 avatar Jul 03 '23 13:07 friedolino78

the idea seems to work roughly: https://github.com/zynaddsubfx/zynaddsubfx/pull/255 now there is an reverse effect. but no audio out, yet. maybe some bad copy-paste-naming jumping off from echo effect

friedolino78 avatar Jul 05 '23 21:07 friedolino78

effect gui: https://github.com/mruby-zest/mruby-zest-build/pull/105 the effect is present in the code

friedolino78 avatar Jul 06 '23 20:07 friedolino78

whit the latest commits everything should be working as intended.

  • [x] crossfade is now implemented
  • [x] phase parameter is now implemented

friedolino78 avatar Jul 09 '23 12:07 friedolino78