Smoothing a change of signal inside gen~ (pingpong delay)


    Mar 07 2021 | 8:27 am
    I made this simple pingpong delay inside gen~ I'm getting a lot of clicks when changing the delay time. how can I solve it within inside gen~ ? I prefer not to use line~ outside the gen~ patch for the reason I might will mc that gen~ patch and the line object will make it more complicated for me.
    Thanks

    • Mar 07 2021 | 8:49 am
      i added this 2-pole smoother from Graham Wakefield's 'Oopsy' stuff, seems to work:
      (could probably also use the 'onepole' option shown in the "gen~.filters" example file, with same low cutoff freq used in this 2-pole version)
    • Mar 07 2021 | 8:51 am
      What is this Oopsy? I can't find this object
    • Mar 07 2021 | 9:00 am
      it's the special environment made with gen~ to program the Electrosmith Daisy hardware more easily: https://cycling74.com/tutorials/oopsydaisy-patch-an-introduction
      (but you don't really need it, i just noticed there was a smoothing option in there.... the gen~ examples that come standard with Max have "gen~.filters"('onepole' can be used for smoothing) and also "gen~.slide" which can also help)
    • Mar 07 2021 | 9:12 am
      great! I will take a look on that. Thanks
    • Mar 07 2021 | 9:21 am
      I made a mistake in the connection of the audio input to the delay inside gen~. now it is working as it should!
      Thanks for your filtering advice. it is working great!
      Any ideas for improvement of that delay? perhups controlling the time between one delay value to another? adding a hp /lp filter to the delay chain?
      edit: here is my try to control the time between old to new value of the delay time
    • Mar 07 2021 | 5:29 pm
      made a mistake in the connection of the audio input to the delay inside gen~
      ha, i thought maybe this was an intended part of the design :) (the right channel only used to register feedback...) but you're probably better off with the newer change as it's more instantly stereo... on that note: you could make it more ping-pong by having separate delay-time and feedback-level for both channels(left and right can be controlled differently, will add more possibilities for changes in rhythm... and by having different feedback levels, too, you can keep longer delay times from being overwhelmed by the feedback of shorter ones) and yes, filtering is great for fedback echoes(you can even add distortion, maybe bit-crush, right before the filter... then the filter right before the feedback loop: the distortion will accentuate the filtering in different ways, and the feedback will make the overall effects 'rinse out' more gradually so the listener will hear a change over time in the effected portions because it's in the path of the feedback loop) you can also add a little noise~ or even an LFO to modulate the delay-time a bit(this is one way to mimic the 'wow and flutter' of analog equipment: https://en.wikipedia.org/wiki/Wow_and_flutter_measurement) i do something similar here: https://cycling74.com/forums/sharing-is-for-asswipes-anaechowat-a-unique-delay-made-in-gen/ (but my design there might be too complicated, over time i've come back to it and simplified it because it's a bit inefficient(i used a 'butterworth' filter algorithm there for the lo-hi pass filter... and although i like the sound, it's not totally necessary... and also the de-click/windowing technique i used there is strange, like a combination of groove-duck but with sine-curvature, not quite necessary to make it like that))
      one thing you might try, is use a sampling op instead of 'delay'. if you build your delay with 'sample'/'wave'/'peek', you can change the internal '@interp' to be something smoother like 'cubic' or 'spline' and it will make the modulation of the delay-time even smoother(but using delay the way you do is fine, too, just requires a different way of working with smoothing/interpolation). also, if you build your delay with one of the sampling ops, you'll be learning to create a recording looper as well(makes it easier to 'freeze' the delay without having to balance feedback). anyways, just to give you ideas, hope it helps 🍻
    • Mar 07 2021 | 6:06 pm
      wow thanks for your detailed answer and the links! I will take a look and definitely will try your ideas!
    • Mar 07 2021 | 7:45 pm
      happy to help :) and i've discovered further holes in my understanding: turns out 'delay' op has an @interp attribute, anyways, so you could try 'cubic', etc. for that and it would smooth even more...
      also, i'm sorry i didn't listen thoroughly enough, was mainly going by visual of the patch and i've not used the 'delay' op enough to be completely honest(you might want to stick to using it.. especially for echo or delay it's what it's intended for, sorry if i was misleading above, just mentioning different options). ... but now as i look more deeply, 'delay' also has @feedback attribute.. and you need to set it to '1' for everything to work as you intend:
      (on Mac, option-click(Win: 'Alt'+click) on gen~ op to see arguments and attributes.. same as text in reference doc)
      (on Mac, option-click(Win: 'Alt'+click) on gen~ op to see arguments and attributes.. same as text in reference doc)
      here's a rework of your patch with some starting suggestions, except i'd replace the 'sortafilter' with whatever you like from the gen~ examples, i also added a 'dry' param so you can turn that down and hear the full effect for debugging/testing:
      you could also do it this way to have the filter mostly in the feedback loop alone, and leaves you open to process the output differently, basically, if you try things out with different arrangements and ordering, you can color the signals differently, depends on what you want:
    • Mar 07 2021 | 8:19 pm
      This is great thank you! I manage to replace the filter in your patch to the lores filter from the gen~ filter examples and it sounds great! I encounter a much difficulty to do the same with the svf~ gen filter.
      here is my try:
      I get terrible feedback so who ever try it - be careful on your ears!
      I guess my mistake is somewhere with the Q and Freq param of the filter. I'm not sure how I should control them from the outside main patch.
      Any help regarding the above?
      Many thanks! edit: I found a solution! I changed to code inside the gen~ of the svf. it is working good for the moment!
    • Mar 07 2021 | 9:34 pm
      nice one! ... and actually, i don't know why i set up 'dry' as a param, you should change that to be a full signal inlet, too.... from there, you could even add smoothing to those, too, if needed. it's funny, i think i might be working on something similar(making a small-stutter looper for my Daisy Petal using Oopsy...), and i'm using the svf from gen~ examples, too... but for the feedback path, i simplify to just lo/hi pass:
      the 'mix' op is the most basic form of linear interpolation/smoothing, so you can add that everywhere you need if ever you're unsure( ... out1 = (in1 * (1 - mixamount)) + (in2 * mixamount)... that's my guess as to the math behind the 'mix' op... using '0.5' for the mixamount will give you exact 'linear interpolation' smoothing when applied to current-sample mixed with 1 sample of history... but in the above pic, i just use 'mix' op to crossfade between lo/hi quickly, can be used for that too :D).
    • Mar 08 2021 | 12:58 pm
      You can also use [slide] inside gen to filter signal changes logarithmically with a separate up and down slide time in samples.