In the code cited afterwards I'm getting a "memory exhausted" error on line 28. Can't figure out why. I tried to wrap what ever I could ...
Any help would be appreciated.
Code: Select all
$subrollTOjitmatrix =($subroll->(
$sub_rll = sort(left(flat($subroll,1),-1));
## checking the list for changes
$addrs;
for $i $a in 1 ... length($sub_rll) collect(
$current_onset = ($sub_rll:($i:(1 1)));
$previous_onset = ($sub_rll:(($i-1):(1 1)));
if $current_onset != $previous_onset then $addrs _= $a
);
## sorting by regrouping all notes with the same onset
$grouped = for $i $ad in 1 ... length($addrs) collect(
$index_start = ($addrs:$i);
$index_end = ($addrs:($i+1))-1 ;
if $ad < length($addrs) then
$note = [$sub_rll:[[$index_start $index_end]]]
else [$sub_rll:[[($index_start -1)]]]
);
## get the y-dimension of the plane by the chord with the biggest number of notes
## get the x-dimension of the plane by accumulating the length of the subsets
$grouped_len = length($grouped);
$xdim = $grouped_len ;
$ydim;
for $i in 1 ... $grouped_len collect(
$ydim _= length(flat(($grouped:($i)),1))
);
$ydim = maximum($ydim);
## avoid empty outputs
if $xdim != 0 then(
## set the dimension of the plane
directout(2,'dim' $xdim $ydim);
## fill the matrix
for $i in 1 ... $grouped_len do(
$chord = flat(($grouped:$i),1);
$chord_len = length($chord);
for $f in 1 ... $chord_len do(
$freq = mc2f(($chord:($f:(1 2 1)))) ;
$dur = ($chord:($f:(1 2 2)));
$velocity = ($chord:($f:(1 2 3))) / 127.; ##
directout(1, 'setcell2d' ($i-1) ($f-1) $freq $dur $velocity)
)
);
directout(2,'bang') ## bang the jitter matrix
)
)
)