Sample Accurate peek/poke problems (involving gen) Help needed!

LiamCormacGould's icon

Hi there,

So I have been really struggling with this buffer shuffler type thing I have been building. I made a version that did what I wanted in MAX but then decided it might be a good exercise to try and create something similar at signal rate....foolishness it seems. Whilst I have already learned a lot about signal rate coding from this I have reached an empasse.

Essentially the patch runs off buffer 'sliceposition' containing scrambled values from 1 to (no. of slices). It reads these sequentially playing back that slice of the audiofile.

What I want to do:

peek at those values,
work out if they are the same as their index i.e. being played at the right time,
if not replace them with a random number in the range 1 to (no. of slices)
if they are the same leave them in place.
These new values being stored in a buffer 'slicepositionnext' which is a duplicate (initially) of the values in buffer 'sliceposition'.

I hope this makes some sense and the patch is in someway clear...The gen~ patch in the bottom right is where I am trying to do this stuff, I feel like I'm close but I'm not sure.

Thanks very to anyfolk who help or chip in in advance!

LiamCormacGould's icon

hmmm I cant post the patch for some reason....attached

problempatchLCG.maxpat
Max Patch
woyteg's icon

Do you have a more concrete problem?
What gen patch in the bottom right?
Sorry just had a only quick peek at your patch..

LiamCormacGould's icon

Crapsticks I posted the wrong patch, no wonder.....it should be the one below

lcg.RanSlice.forumpost.maxpat
Max Patch
Rodrigo's icon

So you want an audio-rate urn?

LiamCormacGould's icon

Yes essentially something like urn. The non signal rate version of the patch re scrambles the list of slices each complete play through but it doesnt scramble the ones that are in the right place. Essentially it gradually sorts the list each complete play so that after many plays the scrambled slices play in order.

with the patch above I was just trying to get towards that. I am trying to just write any random value over slices that are in the wrong place while leaving the ones in the right place alone. The urn type part would come later but my brain told me that would be much more difficult. Also that it would take longer and longer as the number of slices increased because it would presumably have to check a table of already chosen numbers.

Rodrigo's icon

No need to do any of that in audio rate. As long as your playback is happening audio rate, producing, comparing, and managing the lists is MUCH easier done in Max.

Since managing these lists isn't 'triggering' anything, there's no benefit from doing it in audio rate.