recording output of buffer back into buffer in Gen~ questions.

    Apr 01 2016 | 10:26 pm
    I a working on a looping/glitching/granulation thing in gen~ and it's been going pretty well. I constantly record into a buffer, and can set up a loop, or play back certain segments. I also can record the output of the segment playback into the buffer, and it's worked really well so far. I am running into an issue where if the stuttering playhead is playing back at a speed less than 1 the value of the samples recorded back into the buffer are 0. This happens when the record head passes over the stutter head. I have tried to check when the stutter playhead equals the record head, but haven't had any success doing that either.
    The code is a little bit of a mess, and Id be happy to provide it to you but here's the pertinent bit:
    else if(looping_trigger == 1 && stutter_trigger == 1){ //recording back into the buffer poke(recording, stutter_out_1 * peek(window,window_index,0) + (in1 * thru),record_index, 0); poke(recording, stutter_out_2 * peek(window,window_index,0) + (in2 * thru),record_index, 1); //outputting the stutter playhead out1 = stutter_out_1 * peek(window,window_index,0) + (in1 * thru); out2 = stutter_out_2 * peek(window,window_index,0) + (in2 * thru); }
    I imagine there's something I can do here, but I'm a little lost as to why it only happens at slower speeds. I tried removing the windowing as well, but that made no difference. Thanks in advance for any suggestions!

    • Apr 07 2016 | 2:26 pm
      Well I sorted this, kind of, and was wondering if anyone had a different solution. I just set up another buffer to read from, and then copy the recorded sample of the initial buffer to the separate buffer before playback on each cycle. Here are some examples:
      Example 1 does not resample when the stutter playhead is set to speeds between 0 and 1. There are some instructions in the patch, and it should be pretty straightforward to see where it fails. I've also left out a ton of other stuff to cut down on clutter in the code, so functionality is limited. I tried to comment the code as well to make things a bit more clear.
      And here's one that works as intended: `
      I tried a few different approaches, like offsetting the sample index when the record index is equal to the stutter index, or using a single sample delay to offset the record index whenever the stutter playhead is engaged.
      Also, as an aside, I was wondering if I should be doing some interpolation when I am playing back the buffers at a lower speed, or if the sample operator would be a a better choice. What about recording at half speed? I kind of like how grimy it is, but it would be nice it it could be a bit smoother.
      Thanks in advance for any comments.