Here I am again!!!
This time with a list problem! Or at least I think it's a list problem!
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
I don't know if was very clear!!! I hope so! Thanks guys!
If I understand you correctly, you basically need a table of the size 18. Then you can use [tabwrite] to set any of the IDs (0-17) on or off (respectively: 1 or 0). Use [tabread] to check the state of a certain ID.
Roman
On Tue, 2010-08-17 at 16:30 +0100, João de Brito Rocha Reis Vidigal wrote:
Here I am again!!!
This time with a list problem! Or at least I think it's a list problem!
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
I don't know if was very clear!!! I hope so! Thanks guys! _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
you could also use [list-find] and a list of 1's and 0's gr, Tim
2010/8/17 Roman Haefeli reduzent@gmail.com
If I understand you correctly, you basically need a table of the size 18. Then you can use [tabwrite] to set any of the IDs (0-17) on or off (respectively: 1 or 0). Use [tabread] to check the state of a certain ID.
Roman
On Tue, 2010-08-17 at 16:30 +0100, João de Brito Rocha Reis Vidigal wrote:
Here I am again!!!
This time with a list problem! Or at least I think it's a list problem!
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing,
none or even um to the 18.
These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered?
Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?).
Why do I need this? Because after triggering a random slot ON I want to
trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on!
As well I need to know witch ones are OFF to randomly select and turn one
on.
I don't know if was very clear!!! I hope so! Thanks guys! _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Ok... I was correct... I didn't make myself clear.
Imagine I have the table (0-17). I want to turn the ID of a random index to 1. Lets say I randomly turn 3 indexes to 1: index 3, 7 and 14. All good until here!!! Now I need to turn one of these off. The issue is how do I know that these are the ones that have an ID 1? The same to the other way around: How do I know that the other ones have an ID 0? Because I want to randomly turn to 1 one of the 0's and/or turn to 0 one of the 1's.
João Vidigal
On 17 Aug 2010, at 16:57, tim vets wrote:
you could also use [list-find] and a list of 1's and 0's gr, Tim
2010/8/17 Roman Haefeli reduzent@gmail.com If I understand you correctly, you basically need a table of the size 18. Then you can use [tabwrite] to set any of the IDs (0-17) on or off (respectively: 1 or 0). Use [tabread] to check the state of a certain ID.
Roman
On Tue, 2010-08-17 at 16:30 +0100, João de Brito Rocha Reis Vidigal wrote:
Here I am again!!!
This time with a list problem! Or at least I think it's a list problem!
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
I don't know if was very clear!!! I hope so! Thanks guys! _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Tue, 17 Aug 2010, João de Brito Rocha Reis Vidigal wrote:
Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
Send 18 to configure an [urn]. then banging it 18 times will give you the numbers from 0 to 17 in random order. If you bang it one more time it will produce a bang that you can use to reset it with a 18.
If you actually need more than that (e.g. see the actual list of remaining numbers), [urn] doesn't provide that, so, you will have to make your own [urn], or make your own special patching around a plain [urn].
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Sorry guys... It seems I'm not getting all the responses to the threads. I know this because I'm receiving the "packs" of daily threads and in them I'm seeing messages I'm not getting... Some of those messages have attachments that I can't access! For the case being discussed, I missed Frank Barknecht's attachment! Could you please resend it!?
Thanks! Joao Vidigal
On 17 Aug 2010, at 17:07, Mathieu Bouchard wrote:
On Tue, 17 Aug 2010, João de Brito Rocha Reis Vidigal wrote:
Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
Send 18 to configure an [urn]. then banging it 18 times will give you the numbers from 0 to 17 in random order. If you bang it one more time it will produce a bang that you can use to reset it with a 18.
If you actually need more than that (e.g. see the actual list of remaining numbers), [urn] doesn't provide that, so, you will have to make your own [urn], or make your own special patching around a plain [urn].
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
On Wed, Aug 18, 2010 at 12:33:16AM +0100, João de Brito Rocha Reis Vidigal wrote:
Sorry guys... It seems I'm not getting all the responses to the threads. I know this because I'm receiving the "packs" of daily threads and in them I'm seeing messages I'm not getting... Some of those messages have attachments that I can't access! For the case being discussed, I missed Frank Barknecht's attachment! Could you please resend it!?
I deleted it. You probably can get it from the archives: http://lists.puredata.info/pipermail/pd-list/2010-08/081730.html
Frank
Hi João,
On Tue, Aug 17, 2010 at 04:30:00PM +0100, João de Brito Rocha Reis Vidigal wrote:
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
A brute-force approach to your problem is attached: It uses [select] to re-trigger the random selection if you get a slot-value that already is off. If instead you get a usable slot-value, it stores this in a [f] object by using the cold, right inlet, so it can be switched off later, then also updates the [select] via its right inlet to watch for the new "ON" slot.
There is a small risk to get a lot of the same values from [random] but this is very, very unlikely.
You should remember the
[t f b]
/
/
[f ]
idiom to delay the output of a float value by one execution step. It's often useful, and also the use of [select] to filter out unwanted values.
You can also do all this without storing the OFF value by transferring the logic of switching off or on into your "slot" abstractions. The c_tgl.pd abstractions shows how to do that. It compares an incoming slot-number with [== $1] where $1 is the slot-id passed as argument. It has a global receiver in it to simplify patching a bit.
Frank
Hi,
ah, I misunderstood you a bit: I thought, you wanted only a single slot active all the time, never more or less. This won't be able with the simple select-solution I provided. As Matju wrote, you either need an urn (there is one called urne.pd in purepd, or two incompatible ones as externals called [urn] in Cyclone and zexy).
Frank
On Tue, Aug 17, 2010 at 06:28:06PM +0200, Frank Barknecht wrote:
Hi João,
On Tue, Aug 17, 2010 at 04:30:00PM +0100, João de Brito Rocha Reis Vidigal wrote:
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
A brute-force approach to your problem is attached: It uses [select] to re-trigger the random selection if you get a slot-value that already is off. If instead you get a usable slot-value, it stores this in a [f] object by using the cold, right inlet, so it can be switched off later, then also updates the [select] via its right inlet to watch for the new "ON" slot.
There is a small risk to get a lot of the same values from [random] but this is very, very unlikely.
You should remember the
[t f b] / /
[f ]idiom to delay the output of a float value by one execution step. It's often useful, and also the use of [select] to filter out unwanted values.
You can also do all this without storing the OFF value by transferring the logic of switching off or on into your "slot" abstractions. The c_tgl.pd abstractions shows how to do that. It compares an incoming slot-number with [== $1] where $1 is the slot-id passed as argument. It has a global receiver in it to simplify patching a bit.
Ciao
Frank
#N canvas 84 0 1114 648 10; #X obj 180 170 select 0; #X obj 210 141 random 18; #X floatatom 293 288 5 0 0 0 ON - -; #X floatatom 231 288 5 0 0 0 OFF - -; #X floatatom 252 166 5 0 0 0 - - -; #X obj 293 315 hradio 15 1 0 18 empty empty empty 0 -8 0 10 -262144 -1 -1 13; #X obj 294 339 hradio 15 1 0 18 empty empty empty 0 -8 0 10 -262144 -1 -1 5; #X msg 210 112 bang; #X obj 151 215 bng 15 250 50 0 empty empty duplicate 17 7 0 10 -262144 -1 -1; #X floatatom 270 112 5 0 0 0 - - -; #X obj 231 240 f; #X obj 233 202 t f b f f; #X obj 783 47 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 47 r 1003-in1-0; #X obj 783 77 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 77 r 1003-in1-1; #X obj 783 107 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 107 r 1003-in1-2; #X obj 783 137 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 137 r 1003-in1-3; #X obj 783 167 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 167 r 1003-in1-4; #X obj 783 197 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 197 r 1003-in1-5; #X obj 783 227 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 227 r 1003-in1-6; #X obj 783 257 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 257 r 1003-in1-7; #X obj 783 287 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 287 r 1003-in1-8; #X obj 783 317 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 317 r 1003-in1-9; #X obj 783 347 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 347 r 1003-in1-10; #X obj 783 377 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 377 r 1003-in1-11; #X obj 783 407 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 407 r 1003-in1-12; #X obj 783 437 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 683 437 r 1003-in1-13; #X obj 783 467 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 467 r 1003-in1-14; #X obj 783 497 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 497 r 1003-in1-15; #X obj 783 527 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 527 r 1003-in1-16; #X obj 783 557 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 683 557 r 1003-in1-17; #X msg 231 394 0 1003-in1-$1; #X msg 340 391 1 1003-in1-$1; #X obj 231 429 unpack 0 s; #X obj 231 455 send; #X obj 376 107 u_robinpoly 18 c_tgl; #X obj 888 45 c_tgl 0; #X obj 888 75 c_tgl 1; #X obj 888 105 c_tgl 2; #X obj 888 135 c_tgl 3; #X obj 888 165 c_tgl 4; #X obj 888 195 c_tgl 5; #X obj 888 225 c_tgl 6; #X obj 888 255 c_tgl 7; #X obj 888 285 c_tgl 8; #X obj 888 315 c_tgl 9; #X obj 888 345 c_tgl 10; #X obj 888 375 c_tgl 11; #X obj 888 405 c_tgl 12; #X obj 888 435 c_tgl 13; #X obj 888 465 c_tgl 14; #X obj 888 495 c_tgl 15; #X obj 888 525 c_tgl 16; #X obj 888 555 c_tgl 17; #X obj 363 286 send TOGGLE; #X text 447 288 in c_tgl!!; #X connect 0 0 1 0; #X connect 0 0 8 0; #X connect 0 1 11 0; #X connect 1 0 0 0; #X connect 1 0 4 0; #X connect 2 0 5 0; #X connect 2 0 49 0; #X connect 2 0 71 0; #X connect 3 0 6 0; #X connect 3 0 48 0; #X connect 7 0 1 0; #X connect 9 0 1 1; #X connect 10 0 3 0; #X connect 11 0 10 1; #X connect 11 1 10 0; #X connect 11 2 0 1; #X connect 11 3 2 0; #X connect 13 0 12 0; #X connect 15 0 14 0; #X connect 17 0 16 0; #X connect 19 0 18 0; #X connect 21 0 20 0; #X connect 23 0 22 0; #X connect 25 0 24 0; #X connect 27 0 26 0; #X connect 29 0 28 0; #X connect 31 0 30 0; #X connect 33 0 32 0; #X connect 35 0 34 0; #X connect 37 0 36 0; #X connect 39 0 38 0; #X connect 41 0 40 0; #X connect 43 0 42 0; #X connect 45 0 44 0; #X connect 47 0 46 0; #X connect 48 0 50 0; #X connect 49 0 50 0; #X connect 50 0 51 0; #X connect 50 1 51 1;
#N canvas 0 0 453 340 10; #X obj 130 113 tgl 15 0 0 0 empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 130 45 r TOGGLE; #X obj 130 72 == $1; #X connect 1 0 2 0; #X connect 2 0 0 0; #X coords 0 -1 1 1 85 30 1 100 100;
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
see attachment uses tabdumb and list-idx chooses one of 18 'onn/off states' in a table randomly and flips it gr, Tim
2010/8/17 Frank Barknecht fbar@footils.org
Hi João,
On Tue, Aug 17, 2010 at 04:30:00PM +0100, João de Brito Rocha Reis Vidigal wrote:
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing,
none or even um to the 18.
These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered?
Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?).
Why do I need this? Because after triggering a random slot ON I want to
trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on!
As well I need to know witch ones are OFF to randomly select and turn one
on.
A brute-force approach to your problem is attached: It uses [select] to re-trigger the random selection if you get a slot-value that already is off. If instead you get a usable slot-value, it stores this in a [f] object by using the cold, right inlet, so it can be switched off later, then also updates the [select] via its right inlet to watch for the new "ON" slot.
There is a small risk to get a lot of the same values from [random] but this is very, very unlikely.
You should remember the
[t f b] / /
[f ]idiom to delay the output of a float value by one execution step. It's often useful, and also the use of [select] to filter out unwanted values.
You can also do all this without storing the OFF value by transferring the logic of switching off or on into your "slot" abstractions. The c_tgl.pd abstractions shows how to do that. It compares an incoming slot-number with [== $1] where $1 is the slot-id passed as argument. It has a global receiver in it to simplify patching a bit.
Ciao
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
i mean 'tabdump' not 'tabdumB' :)
2010/8/17 tim vets timvets@gmail.com
see attachment uses tabdumb and list-idx chooses one of 18 'onn/off states' in a table randomly and flips it gr, Tim
2010/8/17 Frank Barknecht fbar@footils.org
Hi João,
On Tue, Aug 17, 2010 at 04:30:00PM +0100, João de Brito Rocha Reis Vidigal wrote:
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing,
none or even um to the 18.
These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered?
Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?).
Why do I need this? Because after triggering a random slot ON I want to
trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on!
As well I need to know witch ones are OFF to randomly select and turn
one on.
A brute-force approach to your problem is attached: It uses [select] to re-trigger the random selection if you get a slot-value that already is off. If instead you get a usable slot-value, it stores this in a [f] object by using the cold, right inlet, so it can be switched off later, then also updates the [select] via its right inlet to watch for the new "ON" slot.
There is a small risk to get a lot of the same values from [random] but this is very, very unlikely.
You should remember the
[t f b] / /
[f ]idiom to delay the output of a float value by one execution step. It's often useful, and also the use of [select] to filter out unwanted values.
You can also do all this without storing the OFF value by transferring the logic of switching off or on into your "slot" abstractions. The c_tgl.pd abstractions shows how to do that. It compares an incoming slot-number with [== $1] where $1 is the slot-id passed as argument. It has a global receiver in it to simplify patching a bit.
Ciao
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi,
On Tue, Aug 17, 2010 at 06:40:16PM +0200, tim vets wrote:
see attachment uses tabdumb and list-idx chooses one of 18 'onn/off states' in a table randomly and flips it
I think, this also isn't wat Joao wanted, but there is a more direct approach to flipping, see attm.
Frank
Ok... Once again, thanks a lot Frank!
We are getting there So, here's the thing! I think the solution lies within the attachments Frank sent! Just don't know how to connect it!! 1st - In the "toggle-with-memory.pd" there is a great principle I need! The OFF only goes off on a ON! Now... how can we split the bangs so that I only trigger an OFF when I want to!? Besides, as Mathieu said (thanks a lot Mathieu), the [urn] is, for this case, better than the random. Great, because I didn't even new about [urn]'s existence.
2nd - However, in "flipper.pd", the way the values are stored is better because it allows several 1's and (obviously) several 0's (on/off).
3rd - Despite the [urn] being better because it doesn't repeat a number within the amount it counts through, it would then need the same [select] system Frank used, but not just for the OFF, also for the ON! Imagine this: the 18 slots are on. through the [select] mode, we randomly turn off the 8,3,18 when we re-run the ON bang, it will have those 3 available again! so it will have to select one of those before re-triggering one already on!
Do I sound insane!? Can you help me with it!?
Thanks guys!
On 17 Aug 2010, at 17:28, Frank Barknecht wrote:
Hi João,
On Tue, Aug 17, 2010 at 04:30:00PM +0100, João de Brito Rocha Reis Vidigal wrote:
Here's what I wanna do:
I have 18 slot for audio and video to play. There can be one playing, none or even um to the 18. These slots are to be triggered randomly. Is there a possibility of storing the ID of the slots already triggered? Like a list? The thing is that if it is a list it would have to have a variable number of floats (wouldn't it?). Why do I need this? Because after triggering a random slot ON I want to trigger a random slot OFF. So, I have to know what are the slots triggered on in order to trigger one of these OFF and not one 18. Otherwise I could end up triggering off a slot that was never on! As well I need to know witch ones are OFF to randomly select and turn one on.
A brute-force approach to your problem is attached: It uses [select] to re-trigger the random selection if you get a slot-value that already is off. If instead you get a usable slot-value, it stores this in a [f] object by using the cold, right inlet, so it can be switched off later, then also updates the [select] via its right inlet to watch for the new "ON" slot.
There is a small risk to get a lot of the same values from [random] but this is very, very unlikely.
You should remember the
[t f b]
/
/
[f ]
idiom to delay the output of a float value by one execution step. It's often useful, and also the use of [select] to filter out unwanted values.
You can also do all this without storing the OFF value by transferring the logic of switching off or on into your "slot" abstractions. The c_tgl.pd abstractions shows how to do that. It compares an incoming slot-number with [== $1] where $1 is the slot-id passed as argument. It has a global receiver in it to simplify patching a bit.
Frank <toggle-with-memory.pd><c_tgl.pd>_______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list