Help ! Logical problem for randomly playing

Feb 11, 2006 at 6:15pm

Help ! Logical problem for randomly playing

Not clear at all,

Could you send an example patch with the problem pointed out?

Or is this a scalability problem?

#24383
Feb 11, 2006 at 7:41pm

oh xcuse.
i understand that’s not clear.

in fact:

- drop folder of sounds on each player
- dac -> on
- open the patcher called mapping.
- press key 136 (0 on my keyboard)
- press key 141 (9)

and see what’s happen…

you can also change “Number to play” -> 0 = nothing, 1 = one sample of the 8 only play, 2 samples…

#70408
Feb 11, 2006 at 10:49pm

your patch is missing. If the problem is that you can’t use 2 of the same
numbers at one time:

- keep track of the sample numbers playing (if there are only 8 choices this
shouldn’t be that difficult). Check the playing numbers with the random
choice. If it’s already playing -> choose again, until you have one that’s
not. You can use a 0/1 flag for each choice using [value] or something.

- use a random generator that doesn’t output a value that has already been
chosen. you can check the Litter library, although I don’t know if there is
one included in the free version. lp.ernie would be perfect but it’s not
free i think.

hope this helps,

T_

#70409
Feb 12, 2006 at 1:15am

no patch ?
all the text is here. on the first post.
but i’ve noticed i had to convert to simple text to read it in max.

i’ve finally found a method.
not perfect.
i’ll post here to have your suggest…

#70410
Feb 12, 2006 at 2:07am

here’s the patch (a part of…)

http://www.pan-etc.net/dev/Perf8rnd8C.zip

it’s working as long as you don’t play to fast between random and direct playing. i don’t find the reason and so the solution.

random only is always ok.

#70411
Feb 12, 2006 at 12:28pm

I haven’t seen any patches either. This may be (yet another) forum vs.
maillist thing. I’m starting to really dislike the forum, but that’s
another issue…

On around Feb 11, 2006, at 23:49, Thijs Koerselman said something like:
> – use a random generator that doesn’t output a value that has already
> been chosen. you can check the Litter library, although I don’t know
> if there is one included in the free version. lp.ernie would be
> perfect but it’s not free i think.

Yes, lp.ernie is a Litter Pro object. Like its simpler cousin, urn, you
have the issue that when you’ve finished all the N different items in
the urn and have to refill, there is a 1:(N-1) chance that the next
item will be a repeat of the last. For instance, if you have an urn
with {0, 1, 2} in it, you could get the sequence

1 0 2 0 2 1 1

A non-repeating RNG is incredibly easy to build as an abstraction,
which is only one reason why I’ve never coded an external object for
this in C/C++/Java/anything else. If you want non-repeating random
numbers in the range [0 .. n], generate a simple random value in the
range [1..n] and add it (modulo n) to the previous value.

Try the following, save it as lp.abs.wimpy

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 106 86 38 196617 int $1;
#P newex 106 64 48 196617 loadbang;
#P newex 58 45 27 196617 – 1;
#P inlet 57 25 15 0;
#P outlet 12 135 15 0;
#P newex 12 110 35 196617 % $1;
#P newex 12 89 27 196617 +;
#P inlet 12 25 15 0;
#P newex 12 66 57 196617 lp.tata 1 1;
#P window linecount 2;
#P comment 95 25 289 196617 Generate random numbers in the range 0..#1
(initialization argument , right inlet) without repeats;
#P comment 11 161 381 196617 This version of a non-repeating RNG
(lp.abs.wimpy) was written by Peter Castine. Modify for your own needs
, give it to your friends , give credit as credit is due.;
#P connect 9 0 10 0;
#P connect 8 0 2 2;
#P fasten 10 0 8 0 111 107 91 107 91 41 63 41;
#P connect 7 0 8 0;
#P fasten 7 0 5 1 62 43 86 43 86 105 42 105;
#P fasten 5 0 4 1 17 131 56 131 56 86 34 86;
#P connect 5 0 6 0;
#P connect 4 0 5 0;
#P connect 2 0 4 0;
#P connect 3 0 2 0;
#P window clipboard copycount 11;

Here’s an example of using it:

#P window setfont “Sans Serif” 9.;
#P number 189 93 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 121 161 32 196617 print;
#P newex 121 112 40 196617 Uzi 50;
#P newex 121 135 78 196617 lp.abs.wimpy 3;
#P button 121 93 15 0;
#P connect 4 0 1 1;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P connect 0 0 2 0;
#P window clipboard copycount 5;

The version above uses lp.tata from the Litter Starter Pack. If you
care about randomness you will want to use Litter. The RNGs are much
more robust and, well, *random* than the objects bundled with Max/MSP.
If you’re determined to stick with stock random object, the requisite
modification is left as an exercise for the reader, as is more robust
error handling.

Hope this helps,
Peter

————– http://www.bek.no/~pcastine/Litter/ ————–
Peter Castine | ^
| Litter Power & Litter Bundle for Jitter
pcastine@gmx.net |
pcastine@bek.no | iCE: Sequencing, Recording, and Interface Building
4-15@kagi.com | for Max/MSP
| Extremely cool
| http://www.dspaudio.com
| http://www.dspaudio.com/software/software.html

#70412
Feb 12, 2006 at 1:54pm

thx very much, i’ll have a look at the litter package.

for now (i’m beginner) i try to do my patches with the max bundle.

but your help is very precious.

strange this missing of patch. don’t you see it in the thread (first post).

anyway, it’s the link on on the last post.

thx again.

#70413

You must be logged in to reply to this topic.