Module
Hylograph.Music.Interpreter.WebAudio
- Package
- purescript-hylograph-music
- Repository
- afcondon/purescript-hylograph-music
WebAudio Interpreter for HATS
Interprets a HATS Tree as audio events using the Web Audio API.
Each Elem node in the tree is interpreted as a note, with attributes
mapping to audio parameters (time, pitch, duration, volume, timbre).
Fold nodes iterate over data, scheduling one note per datum.
Follows the same interpreter pattern as English.purs and Mermaid.purs, but produces audio output instead of text.
#interpretAudio Source
interpretAudio :: Tree -> MusicM UnitInterpret a HATS tree as audio events
Walks the tree, scheduling a note for each Elem node.
Attributes are interpreted as audio parameters:
time→ note start time (seconds)pitch→ frequency (Hz)duration→ note length (seconds)volume→ amplitude (0.0 to 1.0)timbre→ waveform type ("sine", "square", "sawtooth", "triangle")
For Fold nodes, iterates over the enumeration and interprets
each template result, using the iteration index for default timing.