[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Ppar select random array from array of arrays
- To: sc-users@xxxxxxxxxxxxxxxx
- Subject: Re: [sc-users] Ppar select random array from array of arrays
- From: kennethflak@xxxxxxxxxxxxxx
- Date: Fri, 06 Dec 2019 12:48:33 +0000
- Feedback-id: GfYd5XBWe32cJJnFveNymifEndH4inSSUS5CasDUHRk-Xw5wJx3Jb5iKMoiGYzw1J9ratHhlGOphwFg-cjqjHA==:Ext:ProtonMail
- In-reply-to: <CAP89kDm=xQixYRBF+-8_8HQ3GPfqrd+Do5GqU1HBEj5v_GWYWQ@mail.gmail.com>
- List-id: SuperCollider users mailing list <sc-users.create.ucsb.edu>
- References: <20191205202815.xxljgday66ahgwd5@t480s-arch.localdomain> <CAP89kDm=xQixYRBF+-8_8HQ3GPfqrd+Do5GqU1HBEj5v_GWYWQ@mail.gmail.com>
- Reply-to: sc-users@xxxxxxxxxxxxxxxx
- Sender: owner-sc-users@xxxxxxxxxxxxxxxx
Thanks for the tip! Unfortunately this doesn't work either, getting an 'The preceding error dump is for ERROR: ListPattern (Ppar) requires a non-empty collection; received a Pfunc.'
In the end, I managed to make it work by creating an array of Ppars instead and playing them with a Pseq:
patterns = [bass, treeperc, lead, lead2, kick, bubbles].powerset.reject({|i| i.size < 2}).scramble;
ppar = patterns.collect{|i| Ppar(i)};
pseq = Pseq([Pfindur(2, Prand(ppar))], inf).play;
K
--
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @kf@vis.social
On 5 Dec 2019 17:37, lavaramano@xxxxxxxxx wrote:
>
>On 12/5/19, kennethflak@xxxxxxxxxxxxxx <kennethflak@xxxxxxxxxxxxxx> wrote:
>> Hi list,
>>
>> Unexpectedly sticky little problem: how do I make a Ppar select a random
>> array from an array of arrays?
>>
>
>Off the top of my head, I think this might work (haven't actually tested it)
>
>`Ppar(Pfunc{ [array, of, pbinds].reject { |x| [true, false].choose } }, inf)`
>
>Pfunc should reject _some_ of the pbind-arrays inside of the array,
>and return them for Ppar to play them.
>
>hope this helps :-)
>
>> Code:
>>
>> patterns = [bass, treeperc, lead, lead2, kick, bubbles].powerset.reject({|i|
>> i.size < 2}); // a bunch of pbinds
>> ppar = Ppar([Prand(patterns, inf)]).play; //doesn't work
>> ppar = Ppar(Prand(patterns, inf)).play; //nor does this
>>
>> I'm stumped and it's getting late. Maybe brain will start working tomorrow,
>> but since these things are not guaranteed, I send a call for help...
>>
>> Best,
>> Kenneth
>>
>> --
>> Roosna & Flak - Contemporary Dance & Music
>> Web: roosnaflak.com
>> Code: {github,gitlab}.com/kflak
>> Mastodon: @kf@vis.social
>>
>>
>> _______________________________________________
>> sc-users mailing list
>>
>> info (subscription, etc.):
>> http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
>> archive: https://listarc.bham.ac.uk/marchives/sc-users/
>> search: https://listarc.bham.ac.uk/lists/sc-users/search/
>>
>
>_______________________________________________
>sc-users mailing list
>
>info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
>archive: https://listarc.bham.ac.uk/marchives/sc-users/
>search: https://listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/