Randomizing start and end selections in waveform~

    Jul 02 2009 | 6:57 pm
    Hello everyone. One thing that I liked in Reaktor was a built in feature of many sample based macros to slightly randomize the start and ends of looped selections in a sample over time by a variable amount. This was also a feature applicable to things like pan position, pitch and grain length and some others I can't remember off the top of my head. In the Reaktor world this is called "Jitter" which I will not use here because it would sort of be confusing. What I'm trying to do is to add a little something similar to the waveform~ object which will slightly nudge the start and end selections by whatever amount when Randomization is turned on. For proof of concept I've begun with Waveform Help File and just the start selection to keep things neat for now and I think that I'm pretty much on the right track except for a slight problem. For some reason the start selection can not be changed by selecting within the waveform object. I've got the output of the third outlet connected to a float number box which is connected to some math from the Random and then send to the Select start inlet at the top. Now, changing the start point in waveform changes the number in the box but it's not passed on. However, clicking in the box and changing the number IS passed. Any ideas?
    As always I am very grateful for any help. Thanks! -B

    • Jul 02 2009 | 7:53 pm
      i think you are just setting the number box, not causing it to output.
      try this
    • Jul 02 2009 | 9:26 pm
      Thank you Mike for your reply. The thing is that when this is connected to the Selection Start it causes a stack overflow. I had left it going through the "set$1" message as in the Help File patch in my post before because it seemed to avoid this.
      Perhaps I am not understanding how I should implement your suggestion.
      Thanks again.
    • Jul 02 2009 | 9:42 pm
      it will do, because you connect the outlet to the inlet causing a loop.
      you don't really need the two number boxes to show the same number, one just updates the display, use this to go to whatever object you need to use it in conjunction with
      e.g. groove~
    • Jul 02 2009 | 11:29 pm
      Cool, thank you. I like your idea for generating the random movements of the start and end selections. I still don't understand though how to be able to select parts of the waveform (within the waveform object) to loop around. I'd like to select a section of the waveform and either have it loop straight or turn on the randomizer to have it futz with the start and end points. Being able to do this within the waveform object would be nice because one could move the selected range around. That's why I had all the output values from the waveform feeding back in to the input.
      I've done a quick version though with your cool random selection generator and using an rslider to select a part of the waveform. You can't move a selection that you've made around (maybe there is a way) but it's a start. I'll mess with it some more a little later tonight when I have more time.
      Thanks again!
    • Jul 03 2009 | 12:07 am
      this should do the trick for now i think?
    • Jul 03 2009 | 9:39 am
      You could even use the loop time to clock the [snapshot~] object so you're not processing the random data in max all the time, only once per loop.
    • Jul 04 2009 | 2:38 pm
      Blazorge wrote on Thu, 02 July 2009 20:57One thing that I liked in Reaktor was a built in feature of many sample based macros to slightly randomize the start and ends of looped selections in a sample over time by a variable amount.
      You might want to look at the "Instable Oscillator" patch included with the Litter Power examples. It does exactly what you describe, adapted to the frequency of a cycle~ object (giving you your grandfather's wonky VCO).
      The thing is that you typically want values from a Gaussian (normal) distribution around your nominal start and end points. This is also known as the "bell-curve", because values close to the midpoint are more frequent than values distant from the midpoint.
      There is no built-in object in Max that will give you a Gaussian distribution. Nor, the last time I looked, in Reaktor.
      The object lp.norm in the (free) Litter Starter Pack gives you that all-important Gaussian distribution.
      Please note that the free Litter Starter Pack is much more friendly in a Max-4 world. The objects actually do work with Max 5, but there are a large number of cosmetic warnings and some issues with the help files. The Pro Bundle is fully Max 5-compatible.
      The Starter Pack is available at the URI below. If you're serious about noise and random numbers, you really owe it to yourself to look at Litter Power.
      Here's the Instable Oscillator patch. As it stands it requires lp.norm, but can be edited to use other random number generators.
    • Jul 04 2009 | 8:16 pm
      Hey everyone thanks for all the help. I've made a version here which is to be used in a bpatcher. I'm using two waveform objects which are linked to the same buffer. The top one is for selecting and moving looped sections which are sent to a patcher object containing the random stuff which is then sent to groove~ for playback. The second waveform object on the bottom is only for displaying the resulting randomized loop points. The only problem that I'm having is getting the bottom waveform object to correctly display the whole length of the buffer. Sometimes it works and other times it doesn't with varying degrees of disagreement between what is shown in the bottom waveform and the top one. I'd imagine that since both waveform objects are getting the same set message that there would be no problem but for some reason it's not working. Thanks again for all your help.