[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] A method.chaining idiom for livecoding?



Nothing wrong with that idea so far as I can tell, that kind of nesting via convenience functions is done all over the place with Ugens already (lag, binary ops, etc..). Although more debatable is whether it's a candidate feature for SuperCollider's core?


Here's a simple example of how you could add such a method to ArrayedCollection. Put this in a class file (.sc) in your extensions directory.

+ ArrayedCollection {
    seq {|repeats=inf, offset=0|
        ^Pseq(this, repeats, offset);
    }
}



On 30/12/2018 11:58, tedthetrumpet@xxxxxxxxx wrote:
I recently stumbled upon a couple of methods that save time nicely when livecoding, particularly in terms of messing with matching brackets:

Pseq([2,6,4,7],inf).stutter(32)

instead of

Pstutter(32, Pseq([2,6,4,7],inf))

and

Plazy({Pseq((0..15).scramble,4)}).repeat

instead of:

Pn(Plazy({Pseq((0..15).scramble,4)}))

This got me thinking. I have to type 'Pseq([some array or other])' *a lot*. Would there be any way it would be possible to get to something like a .seq method? So you could just write:

Pbindef(\a, \notes, [3,5,6].seq)

Repeat would default to 'inf', or I guess for consistency [3,5,6].seq(inf).

Then, how about {[3,5,6].scramble.seq(4)}.lazy.stutter(2)

I'm not a programmer, so probably something fundamentally wrong with this… just an idea…

--
J. Simon van der Walt - Composer
www.jsimonvanderwalt.com
+44 (0) 7905 270 198
--
JC Reus

WEB: jonathanreus.com