groove~ loop with no clicks

    Jan 02 2011 | 4:25 pm
    Hi All!
    I'm working on a sampler, that plays the first part of a sample and then loops later in the sample. The amplitude is faded out through this loop.
    I'm using the buffer~ and the groove~ objects in the core of the playback. The problem is, that the loop-function in the groove~ object often makes a click, when it loops. Is there a way to avoid this clicking?
    I've checked out these forums and the examples-folder in the Max-folder, but the stuff I've found there is to complicated for me. Is there a rather simpler approach to solving this problem?
    Any suggestions would be very appreciated. :)

    • Jan 02 2011 | 6:08 pm
      Hi there M,
      check this one out;
    • Jan 02 2011 | 9:12 pm
      When the sample values at the end/start of any loop are different, you will hear the discontinuity as a click - it's unavoidable, but there are numerous solutions. One is to ensure that the loop end/start point is always a sample value of zero - I believe this is achievable using the [waveform~] object and its 'snap to zero' message; a second way is to send the [groove~] object a [loopinterp 1] message, which performs a smoothing function on loop end/start points; alternatively you could use the [grooveduck] object which allows user-variable fades on the loop end/start. A third option is to use the right outlet of [groove~] (which gives a signal ramp from 0. to 1. over the duration of any loop) to apply an amplitude 'window' that hides the clicks. The attached patch demonstrates two basic uses of this ramp to avoid clicks:
    • Jan 02 2011 | 10:29 pm
      Thank you so much, both of you! I've been playing around with the different ideas and learned a lot! :)
      JoelisRich (from YouTube), [grooveduck] and the amplitude 'window' works fine with voice samples, etc. - but with instrument tones the ducking/fades becomes as notable as the clicks.
      Sending the [groove~] object a [loopinterp 1] message helps but doesn't avoid clicks (or sudden changes of the tone).
      [waveform~] object and the 'snap to zero' message has made a couple of good results - but it takes a while to adjust it for each sample.
      Maybe the best approach would be a kind of crossfade between two buffers, that plays the same loop? (but I can't figure out exactly how to build it, a little start help would be nice!)
      I've uploaded a sample that I trying to make the sampler eat...
    • Jan 02 2011 | 10:40 pm
      This type of looping sampler is only ever as good as the samples you use; you really need to try to get very clean sustained tones, and tidy them up in an audio editor. Search the forum for "looper", "sampler" or "groove + window" etc for further help. Brendan
    • Jan 03 2011 | 12:47 am
      I love JoelisRich's tutorials. He's got a great sense of humor.
    • Mar 04 2016 | 10:14 am
      @brendan : i like the trapezoid approach, but in your example patch, the fade in/out are relative to the length of the audio sample. Any help for applying a fixed fade in/out to a loop ?
      Thanks !
    • Mar 04 2016 | 11:12 am
      Hi chapelier
      There are three ways I can see: use the [grooveduck] object instead of [groove~] and manually set the fade in/out time; use [groove~] and [trapezoid~] and again manually set the breakpoints for the envelope:
      Or use the method above and do some funky maths operation on the file size value from [info~], to automatically calculate the smallest (or optimum) value for [trapezoid~] breakpoints. Which should be fairly simple but I don't have time at the moment ;)
    • Mar 04 2016 | 11:44 am
      Wonderful. Grooveduck is just perfect for my use. Thanks !!
    • Jun 30 2016 | 12:27 am
      Thanks a lot Brendan, just what I was looking for! :-)