More concise way of splitting signal?

Here’s a little synthdef i’m working on, I’m wondering if there’s a more efficient way of getting the signals panned how I want them to be?

Specifically, this is the line that seems a bit unwieldy - it’d be cool to find a way that was more flexible so that I could change the size of the freqs array a bit quicker:

    sig = [[sig[0], sig[2], sig[4], sig[6]], [sig[1], sig[3], sig[5], sig[7]]];                                          
(                                                                                                                        
SynthDef(\organ, { |freq|                                                                                             
    var sig;                                                                                                             
    var phases, freqs;                                                                                                   
    freqs = freq * [0.5, 1, 2, 3] +.x (LFNoise2.kr(3) ! 2);                                                              
    phases = freqs.size.collect { LFNoise2.kr(3).linlin(-1, 1, 0, 2pi) };                                                
    sig = LFPar.ar(freqs, phases) * [-10, 0, -8, -10].dbamp * (LFNoise2.kr(3).linlin(-1, 1, -1, 1).dbamp ! freqs.size);  
    sig = [[sig[0], sig[2], sig[4], sig[6]], [sig[1], sig[3], sig[5], sig[7]]];                                          
    sig = sig + (sig * PinkNoise.ar(-22.dbamp));                                                                         
    sig = (sig * 1.5).tanh;                                                                                              
    sig = sig + GVerb.ar(sig * -35.dbamp);                                                                               
    sig = sig * Env.asr(0.5, 1, 1.5).ar(Done.freeSelf, \gate.kr(1));                                                     
    sig = sig * -33.dbamp;                                                                                               
    Out.ar(0, sig);                                                                                                      
}).add;                                                                                                                  
)        

Thanks for any help,
Jordan

There is probably a shorter way of doing this, but I think this is readable.

a = (0..7);
[a.select{ |x, i| i.even }, a.select{ |x, i| i.odd }]
1 Like

How about:

~size = 8;
~clumpSize = 2;
~sig = Array.series(~size);
~sigSorted = ~sig.clump(~clumpSize).flop.flatten;
2 Likes

After posting I remembered having seen this once in a video by @nathan - spent half an hour looking around and found this pretty handy trick:

sig = [sig[0, 2..].sum, sig[1, 3..].sum] 
1 Like