prev (22) slide 23 / 33 next (24)
signals
newtype Signal y = Signal { sig_vec :: SignalBase.SigVec Y }
-- The Eq instance is only for tests, since it may be quite expensive on
-- a real signal.
deriving (Eq)
type X = SignalBase.X
type Y = Double
instance SignalBase.Signal Y
-- | This is the type of performer-interpreted controls that go into the
-- event's control map.
type Control = Signal ControlSig
data ControlSig
... -- many more
instance Storable.Storable (X, Y) where
...
at, at_linear :: X → Signal y → Y
sig_add, sig_subtract, sig_multiply :: Control → Control → Control
integrate :: X → Tempo → Warp
compose :: Warp → Warp → Warp
- Fun with phantom types!
- Not lazy yet :(
- Space and simplicity trade-offs: initially linear (x, y) segments,
currently (x, y) flat segments, except Warp which is a constant sampling
rate.
- Variable sampling rate: accurate (infinite sampling rate), space efficient
(many flat segments).
- Constant sampling rate: simple implementation (therefore fast, no
resampling), space efficient for dense signals. Also 1 minute of 1024hz
signal is only 480k, 240k for floats. Intermediate signals can be GCed as
they are used (once lazy), but the original ones are retained for multiple
passes.
- Possible compromise: blocks with constant sampling rate but each with its
own rate.
prev (22) slide 23 / 33 next (24)