Safe Haskell | None |
---|
The Csound types.
There are several primitive types:
-
Sig
- signals -
D
- numbers -
Str
- strings -
Tab
- 1-dimensional arrays -
Spec
andWspec
- sound spectrums
A signal is a stream of numbers. Signals carry sound or time varied control values. Numbers are constants. 1-dimensional arrays contain some useful data which is calculated at the initial run of the program.
There is only one compound type. It's a tuple of Csound values. The empty tuple
is signified with special type called Unit
.
- data Sig
- data D
- data Tab
- data Str
- data Spec
- data Wspec
- data BoolSig
- data BoolD
- class Val a where
- class Val a => SigOrD a
- double :: Double -> D
- int :: Int -> D
- text :: String -> Str
- idur :: D
- getSampleRate :: D
- getControlRate :: D
- getBlockSize :: D
- ar :: Sig -> Sig
- kr :: Sig -> Sig
- ir :: Sig -> D
- sig :: D -> Sig
- withInits :: (Tuple a, Tuple b) => a -> b -> a
- withDs :: Tuple a => a -> [D] -> a
- withSigs :: Tuple a => a -> [Sig] -> a
- withTabs :: Tuple a => a -> [Tab] -> a
- withD :: Tuple a => a -> D -> a
- withSig :: Tuple a => a -> Sig -> a
- withTab :: Tuple a => a -> Tab -> a
- withSeed :: SE Sig -> D -> Sig
- quot' :: SigOrD a => a -> a -> a
- rem' :: SigOrD a => a -> a -> a
- div' :: SigOrD a => a -> a -> a
- mod' :: SigOrD a => a -> a -> a
- ceil' :: SigOrD a => a -> a
- floor' :: SigOrD a => a -> a
- round' :: SigOrD a => a -> a
- int' :: SigOrD a => a -> a
- frac' :: SigOrD a => a -> a
- boolSig :: BoolD -> BoolSig
- when1 :: BoolSig -> SE () -> SE ()
- whens :: [(BoolSig, SE ())] -> SE () -> SE ()
- type Sig2 = (Sig, Sig)
- type Sig4 = (Sig, Sig, Sig, Sig)
- type Sig6 = (Sig, Sig, Sig, Sig, Sig, Sig)
- type Sig8 = (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
- ar1 :: Sig -> Sig
- ar2 :: (Sig, Sig) -> (Sig, Sig)
- ar4 :: (Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig)
- ar6 :: (Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig)
- ar8 :: (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) -> (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)
- class Tuple a where
- tupleMethods :: TupleMethods a
- makeTupleMethods :: Tuple a => (a -> b) -> (b -> a) -> TupleMethods b
- data Unit
- unit :: Unit
- ifTuple :: Tuple a => BoolSig -> a -> a -> a
- guardedTuple :: Tuple b => [(BoolSig, b)] -> b -> b
- caseTuple :: Tuple b => a -> [(a -> BoolSig, b)] -> b -> b
- class Tuple a => Arg a
- ifArg :: (Arg a, Tuple a) => BoolD -> a -> a -> a
- guardedArg :: (Tuple b, Arg b) => [(BoolD, b)] -> b -> b
- caseArg :: (Tuple b, Arg b) => a -> [(a -> BoolD, b)] -> b -> b
- class Tuple a => Sigs a
Primitive types
data Sig
Signals
data D
Constant numbers
class Val a where
Contains all Csound values.
Constructors
Constants
getSampleRate :: D
getControlRate :: D
getBlockSize :: D
Converters
Init values
withInits :: (Tuple a, Tuple b) => a -> b -> a
Appends initialisation arguments. It's up to user to supply arguments with the right types. For example:
oscil 0.5 440 sinWave `withInits` (0.5 :: D)
withSeed :: SE Sig -> D -> Sig
Applies a seed to the random value.
It's equivalent to the withD
but it has a special
meaning of canceling the side effect. When random
opcode is provided with seed value it's no longer
contains a side effect so we don't need to restrict it.
Numeric functions
Logic functions
whens :: [(BoolSig, SE ())] -> SE () -> SE ()
The chain of when1
s. Tests all the conditions in sequence
if everything is false it invokes the procedure given in the second argument.
Aliases
Handy for functions that return tuples to specify the utput type
(aleft, aright) = ar2 $ diskin2 "file.wav" 1
or
asig = ar1 $ diskin2 "file.wav" 1
Tuples
class Tuple a where
A tuple of Csound values.
tupleMethods :: TupleMethods a
Tuple Sig | |
Tuple D | |
Tuple Str | |
Tuple Spec | |
Tuple Unit | |
Tuple Tab | |
(Tuple a, Tuple b) => Tuple (a, b) | |
(Tuple a, Tuple b, Tuple c) => Tuple (a, b, c) | |
(Tuple a, Tuple b, Tuple c, Tuple d) => Tuple (a, b, c, d) | |
(Tuple a, Tuple b, Tuple c, Tuple d, Tuple e) => Tuple (a, b, c, d, e) | |
(Tuple a, Tuple b, Tuple c, Tuple d, Tuple e, Tuple f) => Tuple (a, b, c, d, e, f) | |
(Tuple a, Tuple b, Tuple c, Tuple d, Tuple e, Tuple f, Tuple g) => Tuple (a, b, c, d, e, f, g) | |
(Tuple a, Tuple b, Tuple c, Tuple d, Tuple e, Tuple f, Tuple g, Tuple h) => Tuple (a, b, c, d, e, f, g, h) |
makeTupleMethods :: Tuple a => (a -> b) -> (b -> a) -> TupleMethods b
Defines instance of type class Tuple
for a new type in terms of an already defined one.
Logic functions
guardedTuple :: Tuple b => [(BoolSig, b)] -> b -> b
guardedB
for tuples of csound values.
Instruments
An instrument is a function that takes a tpule of csound values as an argument and returns a tuple of signals as an output. The type of the instrument is:
(Arg a, Out b) => a -> b
Arguments
Arg D | |
Arg Str | |
Arg Unit | |
Arg Tab | |
(Arg a, Arg b) => Arg (a, b) | |
(Arg a, Arg b, Arg c) => Arg (a, b, c) | |
(Arg a, Arg b, Arg c, Arg d) => Arg (a, b, c, d) | |
(Arg a, Arg b, Arg c, Arg d, Arg e) => Arg (a, b, c, d, e) | |
(Arg a, Arg b, Arg c, Arg d, Arg e, Arg f) => Arg (a, b, c, d, e, f) | |
(Arg a, Arg b, Arg c, Arg d, Arg e, Arg f, Arg h) => Arg (a, b, c, d, e, f, h) | |
(Arg a, Arg b, Arg c, Arg d, Arg e, Arg f, Arg h, Arg g) => Arg (a, b, c, d, e, f, h, g) |
Logic functions
guardedArg :: (Tuple b, Arg b) => [(BoolD, b)] -> b -> b
guardedB
for constants.
Outputs
The tuples of signals.
Sigs Sig | |
Sigs ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) | |
Sigs (Sig, Sig) | |
Sigs ((Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig), (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig)) | |
Sigs (Sig, Sig, Sig, Sig) | |
Sigs (Sig, Sig, Sig, Sig, Sig, Sig) | |
Sigs (Sig, Sig, Sig, Sig, Sig, Sig, Sig, Sig) |