melody, inverse and permutation

Oct 6, 2010 at 2:26pm

melody, inverse and permutation

Hi,

I’m trying to experiment with random melody creation, so I built a very very simple patch to create a melody and replay it as it was, inverted and permutated. I have two things not clear in my mind:
1) is there a way to make it simpler? i mean… it works but it looks complicated to me, no?
2) i don’t know why when playing computer MIDI instr it works, but if i send those messages to an external sampler inverse and permutated play on channel 16. always.

Any idea?
thanks

– Pasted Max Patch, click to expand. –
#52606
Oct 6, 2010 at 4:21pm

i cant look at max5 code, but this seems a lot of code for inversion … something
like [map 60 72 72 60] should perform a (very simple) melody inversion already.

#189171
Oct 6, 2010 at 9:10pm

I don’t have the [vs.between] abstraction/external, could you post/link to it?

lh

#189172
Oct 6, 2010 at 10:21pm

ops, here it is.

Attachments:
  1. vs.between.pat
#189173
Mar 20, 2011 at 8:29am

hi,
you probably found your way already, but i wanted to do similar things and found a little snippet of code online and put in a js object. maybe helpful?

patch:

– Pasted Max Patch, click to expand. –

code for js:
var arr = new Array();
var output = new Array();

permute = function(v, m){
for(var p = -1, j, k, f, r, l = v.length, q = 1, i = l + 1; –i; q *= i);
for(x = [new Array(l), new Array(l), new Array(l), new Array(l)], j = q, k = l + 1, i = -1;
++i < l; x[2][i] = i, x[1][i] = x[0][i] = j /= --k);
for(r = new Array(q); ++p < q;)
for(r[p] = new Array(l), i = -1; ++i < l; !--x[1][i] && (x[1][i] = x[0][i],
x[2][i] = (x[2][i] + 1) % l), r[p][i] = m ? x[3][i] : v[x[3][i]])
for(x[3][i] = x[2][i], f = 0; !f; f = !f)
for(j = i; j; x[3][--j] == x[2][i] && (x[3][i] = x[2][i] = (x[2][i] + 1) % l, f = 1));
return r;
};

function list(){
arr = permute( arrayfromargs(arguments), 0);
for(i=0;i

#189174
Mar 20, 2011 at 9:41am

Hi.
You might want to try bach ( http://www.bachproject.net ), a library of objects and patches for algorithmic composition. There are several tutorials dealing with melodics transformations.

best
aa

#189175
Mar 20, 2011 at 6:14pm

Hi,

I just had a look, didn’t know about it. Nice work!
Since a while I’m using FTM a lot, doesn’t seem to integrate nicely though, because of several reasons (data issues, ftm_object doesn’t go through unharmed). But it implements lots of things I would like to have at my disposal in FTM, so I’ll probably use it for these little things that you wanna do sometimes (like calculating all permutations of a series of five notes, see the above).

Thanks,

l.

#189176

You must be logged in to reply to this topic.