| Hi J,
This is one way:
~row = [ 3, 1, 9, 5, 4, 6, 8, 7, 0, 10, 11, 2 ]; ~rowInversion = ~row.invert(~row.first) % 12; ~matrix = ~rowInversion.collect({| t | ~row + (t - ~row.first) % 12 }); ~matrix.printAll; ""
Cheers,
Sergio
Hello,
I am trying to create an algorithm to generate 12-tone matrices, like the one here:
I'm getting stuck, though - processing arrays is still very mysterious to me. I'm not sure what the correct way to do this all is. So far, I think I have the first process in place.. but I'm not sure how to get to the next process.
//starting row; ~row1=[3, 1, 9, 5, 4, 6, 8, 7, 12, 10, 11, 2];
~column1= { arg row, new=Array.new(12); for (0, row.size-1, { arg i=1; var next = row[i-1]; if (prev == nil) {prev=0} //case against nil {|x, b| x=(row[i]-next); //subtract the next row item from the current row item if (x < 0) {b=x.abs} {b=0-x}; //if negative, go positive. if positive, go negative. new.add(b); //add to array. }; }); new.postln; };
~column1.(~row1);
Thank you, J
|