- type Key = String
- type Value = Double
- type Type = String
- 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
- freq :: Event -> Double
- db :: Event -> Value
- dbAmp' :: Floating a => a -> a
- amp :: Event -> Value
- fwd :: Event -> Double
- sustain :: Event -> Double
- 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
- f_merge :: Ord a => [(a, t)] -> [(a, t)] -> [(a, t)]
- type Time = Double
- merge' :: (Time, [Event]) -> (Time, [Event]) -> [(Time, Event)]
- add_fwd :: [(Time, Event)] -> [Event]
- merge :: (Time, [Event]) -> (Time, [Event]) -> [Event]
- to_sc3_osc :: Time -> Int -> Event -> Maybe (OSC, OSC)
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 frequency of the pitch
of e.
freq (event [("degree",5)]) == 440 freq (event [("midinote",69)]) == 440
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
sustain :: Event -> DoubleSource
The sustain value of the duration model at e.
sustain (event [("dur",1),("legato",0.5)]) == 0.5
List of reserved keys for pitch, duration and amplitude models.
("degree" `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.
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')]