Re: [PD] To divide a number in random parts

2011-03-10 Thread Caio Barros
Hi guys. As I said before I wanted two complements to the wonderful solution by Matt Barber, and I just did the first! Is a patch that outputs bangs at random delays between them. The user can set the minimum and maximum duration between bangs (all in ms) and a setp size. This last one is easier

Re: [PD] To divide a number in random parts

2011-03-06 Thread Frank Barknecht
On Sat, Mar 05, 2011 at 02:02:09PM -0500, Matt Barber wrote: On Sat, Mar 5, 2011 at 1:06 PM, Mathieu Bouchard ma...@artengine.ca wrote: On Fri, 4 Mar 2011, Matt Barber wrote: This all sounds about right -- I made [list-shellsort] more as a pedagogical exercise for my students So, what

Re: [PD] To divide a number in random parts

2011-03-05 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Matt Barber wrote: This all sounds about right -- I made [list-shellsort] more as a pedagogical exercise for my students So, what is that supposed to teach them ? than as a model of speed or efficiency (I did a quicksort as well that didn't end up in list-abs). How did

Re: [PD] To divide a number in random parts

2011-03-05 Thread Matt Barber
On Sat, Mar 5, 2011 at 1:06 PM, Mathieu Bouchard ma...@artengine.ca wrote: On Fri, 4 Mar 2011, Matt Barber wrote: This all sounds about right -- I made [list-shellsort] more as a pedagogical exercise for my students So, what is that supposed to teach them ? Right, well -- my students are

Re: [PD] To divide a number in random parts

2011-03-04 Thread Markus Demmel
So, then use [randomF], put the values into an list/array and shuffle that. It would still be not fully random, because the numbers won't be bigger than 10, but still it would be quite random :) On 04.03.2011 04:01, Caio Barros wrote: You could try this approach(I also attached a patch

Re: [PD] To divide a number in random parts

2011-03-04 Thread Bastiaan van den Berg
What about this method (actually only works for uneven number of chords, so maybe drop one, or increase to 11 and drop one later( randomly? )) Just pick a random float between 0 and 48, we'll call that X1 Then pick a random float between 0 and X1 , and between X1 and 48, call those Y1 and Y2 Then

Re: [PD] To divide a number in random parts

2011-03-04 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Bastiaan van den Berg wrote: What about this method (actually only works for uneven number of chords, so maybe drop one, or increase to 11 and drop one later( randomly? )) Just pick a random float between 0 and 48, we'll call that X1 Then pick a random float between 0 and

Re: [PD] To divide a number in random parts

2011-03-04 Thread Caio Barros
Until now tim's solution seems best for me, I'll try to build the patch these days. You know what would be really nice? If it were possible for the computer to translate the durations into musical rhythms (in lilypond or musicXML for instance). The user input the total duration, the number of

Re: [PD] To divide a number in random parts

2011-03-04 Thread Matt Barber
I attached an example that will do something like what you want, using list abs. Without much trouble you could make this into an abstraction. It follows the first solution someone posted -- pick a bunch of random numbers and then scale them so the total equals the target. I added a few things,

Re: [PD] To divide a number in random parts

2011-03-04 Thread Caio Barros
Whoa! Nice! It worked very well here. Although sometimes I have to press the Go button more than once to get different results, even when I change the paramethers. Will do some more testing. I need some time to understand this patch but it looks awesome. 2011/3/4 Matt Barber brbrof...@gmail.com

Re: [PD] To divide a number in random parts

2011-03-04 Thread Matt Barber
Sorry for the lack of comments. It's kind of a brute-force method; maybe I'll go through and document it at some point, but I just threw it together today to show the concept. A couple of things: if your max and min durations are restrictive you get an awful lot of values at the max and min

Re: [PD] To divide a number in random parts

2011-03-04 Thread Caio Barros
Sorry for the lack of comments. It's kind of a brute-force method; maybe I'll go through and document it at some point, but I just threw it together today to show the concept. A couple of things: if your max and min durations are restrictive you get an awful lot of values at the max and min

Re: [PD] To divide a number in random parts

2011-03-04 Thread Caio Barros
2011/3/4 Matt Barber brbrof...@gmail.com I'm not shure if I understood that. You mean that if I set the nuber of subdivisions per beat as 10 I can't set the number of beats to, say 8,255? As far as user's responsibility goes, it doesn't make sense to input negative numbers, yet it is

Re: [PD] To divide a number in random parts

2011-03-04 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Matt Barber wrote: I think we're saying the same thing, if you're using the comma the way americans use the dot for indicating decimal; did 8,255 mean 8 + 255/1000? Only if the / doesn't indicate integer division as in [expr] ;)

Re: [PD] To divide a number in random parts

2011-03-04 Thread Matt Barber
Check out [list-sort] for short lists, [list-shellsort] for much longer ones (I don't remember at what point the shellsort starts beating the other one -- maybe if the list has 50 or more entries; but at any rate they do the same thing). Also, if you're going to be doing something like this a ton

Re: [PD] To divide a number in random parts

2011-03-04 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Caio Barros wrote: Oh yes, we are saying the same thing. Sorry for the comma, I always forget that. You shouldn't be sorry about the comma. Be proud about the comma :) Even in pd sometimes I keep trying to write 0,25 in a number box and get angry because it doesn't work.

Re: [PD] To divide a number in random parts

2011-03-04 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Matt Barber wrote: Check out [list-sort] for short lists, [list-shellsort] for much longer ones (I don't remember at what point the shellsort starts beating the other one -- maybe if the list has 50 or more entries; but at any rate they do the same thing). It vastly

Re: [PD] To divide a number in random parts

2011-03-04 Thread Matt Barber
This all sounds about right -- I made [list-shellsort] more as a pedagogical exercise for my students than as a model of speed or efficiency (I did a quicksort as well that didn't end up in list-abs). I'm pretty sure that whatever gains come from the algorithm are obliterated by swapping two

Re: [PD] To divide a number in random parts

2011-03-04 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Caio Barros wrote: Until now tim's solution seems best for me, I'll try to build the patch these days. I just thought about this, if you want a solution with a minimum, but without a maximum, where all possibilities are EQUALLY LIKELY : for two chords, pick a number

Re: [PD] To divide a number in random parts

2011-03-03 Thread Caio Barros
Note that if you sum 1+2+3+4+5+6+7+8+9+10, that's already 55. How many time units do you have per 48 seconds ? (do you have a base tempo at all ?) And then what do you want the distribution to be like ? Is there any maximum duration of a chord, minimum duration of a chord, etc ? It's

Re: [PD] To divide a number in random parts

2011-03-03 Thread Markus Demmel
You could try this approach(I also attached a patch with it): 48 = 4 * 10 + 1 * 8 so you use n1=random(10) n2 = 10 - n1 n3 = random(10) n4 = 10-n3 . . n9 = random(8) n10 = 8 - n9 On 03.03.2011 02:20, Caio Barros wrote: Hey guys, long time since I posted here. I've been trying to think a way

Re: [PD] To divide a number in random parts

2011-03-03 Thread Mathieu Bouchard
On Thu, 3 Mar 2011, Caio Barros wrote: It's funny that you said that. I slept over this problem and yes, I want the chords to have a minimun and maximun duration. Ok. Give every chord the minimum duration, then pick random amounts of extra time to add to each, between zero and the difference

Re: [PD] To divide a number in random parts

2011-03-03 Thread Mathieu Bouchard
On Thu, 3 Mar 2011, Markus Demmel wrote: You could try this approach(I also attached a patch with it): 48 = 4 * 10 + 1 * 8 so you use n1=random(10) n2 = 10 - n1 n3 = random(10) n4 = 10-n3 . . n9 = random(8) n10 = 8 - n9 But this makes the odd-ordered chords to start at every 10 seconds. I

Re: [PD] To divide a number in random parts

2011-03-03 Thread Caio Barros
You could try this approach(I also attached a patch with it): 48 = 4 * 10 + 1 * 8 so you use n1=random(10) n2 = 10 - n1 n3 = random(10) n4 = 10-n3 . . n9 = random(8) n10 = 8 - n9 But this makes the odd-ordered chords to start at every 10 seconds. I believe that Caio wants something

Re: [PD] To divide a number in random parts

2011-03-03 Thread Mathieu Bouchard
On Fri, 4 Mar 2011, Caio Barros wrote: Yes that's right. And another problem is that all the durations are integers. I want something without the feeling of (regular) pulsations. I thought that you had said that the unit of time is the second. That's how I interpreted quarter = 60. If you

Re: [PD] To divide a number in random parts

2011-03-03 Thread Caio Barros
I thought that you had said that the unit of time is the second. That's how I interpreted quarter = 60. If you don't want this nor any other related basis such as 120 divisions or 240 divisions, why did you say quarter = 60 at all ? Yes the tempo is quarter = 60, but this doesn't mean that

[PD] To divide a number in random parts

2011-03-02 Thread Caio Barros
Hey guys, long time since I posted here. I've been trying to think a way to divide a number into random parts. Let me explain myself better: I'm writing a piece where I want 10 chords played during 48 seconds but the duration of each chord should be different. So I'm trying to figure out a way to

Re: [PD] To divide a number in random parts

2011-03-02 Thread Mathieu Bouchard
On Wed, 2 Mar 2011, Caio Barros wrote: I'm writing a piece where I want 10 chords played during 48 seconds but the duration of each chord should be different. So I'm trying to figure out a way to divide 48 into 10 unequal parts, I think using random numbers should be the best way but the

Re: [PD] To divide a number in random parts

2011-03-02 Thread tim vets
2011/3/3 Caio Barros caio.bar...@gmail.com Hey guys, long time since I posted here. I've been trying to think a way to divide a number into random parts. Let me explain myself better: I'm writing a piece where I want 10 chords played during 48 seconds but the duration of each chord should be