Dynamically generating windows in gen~

    Gen

    Evan's icon
    Evan's icon
    Evan
    Nov 01 2016 | 6:09 pm
    Hey all,
    I'm reworking a patch that I'm trying to dynamically generate a window of a changing length. I ran into a roadblock when trying to do this, and tried to simplify the it in the attached patch. Can someone explain why the gen code on the left doesn't give increasing values from 0 -1?
    Max Patcher
    In Max, select New From Clipboard.
    Show Text
    Thanks in advance!

    • ak's icon
      ak's icon
      ak
      Nov 01 2016 | 7:55 pm
      The order of arguments - first value, then index. Try: poke(window, i/127, i, 0);
      Share
    • Evan's icon
      Evan's icon
      Evan
      Nov 01 2016 | 8:29 pm
      wow. Thanks for that. I wonder how long that would've taken me to sort out on my own...
    • ak's icon
      ak's icon
      ak
      Nov 01 2016 | 9:37 pm
      I was just a fresh pair of eyes. Cheers:)
    • jo geisler's icon
      jo geisler's icon
      jo geisler
      Sep 27 2017 | 8:53 am
      Hello Evan,
      as I understood (hope ;-)) you solved the problem with click less loops with windowing I would love to get your insights / code about implementing that into my solution.
      I have a simple gen buffer peek poke counter combination as a loop recorder / player. I would like to avoid the clicks at the beginning and the end. I see different combinations possible, please comment based on your experiences if possible and I would also be very happy if you could give me some advice how to code that into gen.
      Possible way (like to hear your comments / experiences):
      - Envelope Following & Ramping down / up: Recording a ramp beginning with 0 amplitude over a period of e.g 64, 128 samples, following the current input signal, until the ramp reaches the current signal amplitude from the input. The same happens when I stop recording. A ramp down from the current signal amplitude to 0 is being recorded over a period of e.g 64, 128 samples. With this I would suppose no clicks are there any more when playing this loop.
      Here is my current patch (pretty basic).
      BR
      Example.maxpat
      maxpat 10.10 KB
      Example
      Jo
    • Evan's icon
      Evan's icon
      Evan
      Sep 27 2017 | 1:38 pm
      I would forget about envelope following, as I don't really see the benefits in this case, and its xtra calculations. You could scale the input amplitude with a ramp going from 0 -1 and 1-0 over the defined amount of samples. Or you could scale the output, and this might give you more accurate looping (the extra 64 /128 samples at the end could add up over time).
    • jo geisler's icon
      jo geisler's icon
      jo geisler
      Sep 27 2017 | 5:49 pm
      Thanks Evan for your POV. I will try out.
    • jo geisler's icon
      jo geisler's icon
      jo geisler
      Oct 02 2017 | 6:03 pm
      Evan, tried out and you were right: it got perfect results with scaling the output - no clicks at all when I am looping any sound source. So there is no need to go down the path of zero crossing or envelope following to get a click free looper :-)
    • Evan's icon
      Evan's icon
      Evan
      Oct 02 2017 | 7:23 pm
      Great to hear!