Safe Haskell | None |
---|
- type Key = String
- type Value = Double
- data Type
- data Event = Event {}
- defaultEvent :: Event
- lookup_m :: Key -> Event -> Maybe Value
- lookup_v :: Value -> Key -> Event -> Value
- lookup_t :: t -> (Value -> t) -> Key -> Event -> t
- pitch :: Event -> Pitch Double
- duration :: Event -> Duration Double
- insert :: Key -> Value -> Event -> Event
- db :: Event -> Value
- dbAmp' :: Floating a => a -> a
- amp :: Event -> Value
- fwd :: Event -> Double
- latency :: Event -> Double
- model_keys :: [Key]
- reserved :: [Key]
- parameters' :: (Key, Value) -> Maybe (Key, Value)
- parameters :: Event -> [(Key, Value)]
- edit_v :: Key -> Value -> (Value -> Value) -> Event -> Event
- edit :: Key -> (Value -> Value) -> Event -> Event
- from_list :: Type -> Maybe Int -> Maybe Instrument -> [(Key, Value)] -> Event
- event :: [(Key, Value)] -> Event
- instrument_name :: Event -> String
- instrument_def :: Event -> Maybe Synthdef
- instrument_send_release :: Event -> Bool
- f_merge :: Ord a => [(a, t)] -> [(a, t)] -> [(a, t)]
- type Time = Time
- merge' :: (Time, [Event]) -> (Time, [Event]) -> [(Time, Event)]
- add_fwd :: [(Time, Event)] -> [Event]
- merge :: (Time, [Event]) -> (Time, [Event]) -> [Event]
- is_rest :: Event -> Bool
- to_sc3_bundle :: Time -> Int -> Event -> Maybe (Bundle, Bundle)
Documentation
An Event
has a Type
, possibly an integer identifier, possibly
an Instrument
and a map of (Key
,Value
) pairs.
The default empty event.
lookup_v :: Value -> Key -> Event -> ValueSource
Variant of lookup_m
with a default value v.
lookup_v 1 "k" defaultEvent == 1
lookup_t :: t -> (Value -> t) -> Key -> Event -> tSource
Variant of lookup_v
with a transformation function.
lookup_t 1 negate "k" defaultEvent == 1 lookup_t 1 negate "k" (insert "k" 1 defaultEvent) == -1
insert :: Key -> Value -> Event -> EventSource
Insert (k,v) into e.
lookup_m "k" (insert "k" 1 defaultEvent) == Just 1
The linear amplitude of the amplitude model at e.
amp (event [("db",-20)]) == 0.1
The fwd value of the duration model at e.
fwd (event [("dur",1),("stretch",2)]) == 2
latency :: Event -> DoubleSource
The latency to compensate for when sending messages based on
the event. Defaults to 0.1
.
model_keys :: [Key]Source
List of Key
s used in pitch, duration and amplitude models.
("degree" `elem` model_keys) == True
List of reserved Key
s used in pitch, duration and amplitude
models. These are keys that may be provided explicitly, but if not
will be calculated implicitly.
("freq" `elem` reserved) == True
event :: [(Key, Value)] -> EventSource
Construct an Event
from a list of (key,value) pairs.
lookup_m "k" (event [("k",1)]) == Just 1
instrument_name :: Event -> StringSource
Extract Instrument
name from Event
, or default
.
instrument_def :: Event -> Maybe SynthdefSource
Extract Instrument
definition from Event
if present.
instrument_send_release :: Event -> BoolSource
send_release
of Instrument
at Event
.
f_merge :: Ord a => [(a, t)] -> [(a, t)] -> [(a, t)]Source
Merge two sorted sequence of (location,value) pairs.
let m = f_merge (zip [0,2..6] ['a'..]) (zip [0,3,6] ['A'..]) in m == [(0,'a'),(0,'A'),(2,'b'),(3,'B'),(4,'c'),(6,'d'),(6,'C')]