-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I was wondering what it would take to write a Pseg equivalent? At the moment I am using the cm interp function like this to achieve more or less the same:
:time (ptime)
:pan (pf (interp (e :time) 0 -1.0 2 1.0 4 0 8 -1.0))The interp function interpolates a number over a series of breakpoints, so that in this example the value will be -1.0 at 0 seconds, 1.0 at 2 seconds, 0 at 4 and -1.0 and -1 again at 8 seconds. I kind of like this better than the env style of doing things in SuperCollider, so maybe I am rather shooting for a pinterp class instead of pseg...? In any case, I would be happy to work on creating this, but I find it a bit hard to understand how to write my own. I have read the writing-your-own document, but I couldn't understand how to do the thing from that. Do you have any kind of step-by-step instruction on how to do this?
Of course, I could do the quick-n-dirty path of defmacro:
(defmacro pinterp (breakpoints &optional duration)
(if (not duration)
(setf duration (second (reverse breakpoints))))
`(pfindur (pf (interp (e :time) ,@breakpoints)) ,duration))but I would love to be able to define my own proper pattern classes...