| Safe Haskell | None |
|---|
Csound.Control.Mix
Documentation
data Mix a
Special type that represents a scores of sound signals. If an instrument is triggered with the scores the result is wrapped in the value of this type.
sco :: (CsdSco f, Arg a, Out b) => (a -> b) -> f a -> f (Mix (NoSE b))
Play a bunch of notes with the given instrument.
res = sco instrument scores
-
instrumentis a function that takes notes and produces a tuple of signals (maybe with some side effect) -
scoresare some notes (see the type classCsdSco)
Let's try to understand the type of the output. It's CsdSco f => f (Mix (NoSE a)).
What does it mean? Let's look at the different parts of this type:
-
CsdSco f => f a- you can think of it as a container of some values of typea(every value of typeastarts at some time and lasts for some time in seconds) -
Mix a- is an output of Csound instrument it can be one or several signals (SigorCsdTuple). - NoSE a* - it's a tricky part of the output.
NoSEmeans literaly 'no SE'. It tells to the type checker that it can skip theSEwrapper from the typeaso thatSE abecomes justaorSE (a, SE b, c)becomes(a, b, c). Why should it be? We needSEto deduce the order of the opcodes that have side effects. We need it within one instrument. But when instrument is rendered we no longer needSEtype. SoNoSElets me drop it from the output type.
mix :: (Out (NoSE a), Out a, CsdSco f) => f (Mix a) -> NoSE a
Renders a scores to global variable that contains a resulting sound signals.
eff :: (CsdSco f, Out a, Out b) => (a -> b) -> f (Mix a) -> f (Mix b)
Applies an effect to the sound. Effect is applied to the sound on the give track.
res = eff effect sco
-
effect- a function that takes a tuple of signals and produces a tuple of signals. -
sco- something that is constructed withscooreff.
With the function eff you can apply a reverb or adjust the
level of the signal. It functions like a mixing board but unlike mixing
board it produces the value that you can arrange with functions from your
favorite Score-generation library. You can delay it or mix with some other track and
apply some another effect on top of it!