Hey all!
I’m thrilled to announce purescript-wags
, the successor project to purescript-audio-behaviors
. WAGS is short for “Web Audio Graphs as a Stream.”
The impetus for the project was solving three interrelated problems:
- Missed rendering deadlines causing janky audio
- Slow responsiveness to MIDI instruments
- An error-prone stringly-typed slot system for web audio generators
The result is a library with…
- Up to 2x speed improvement on web audio graph rendering
- An industry-grade MIDI keyboard in the browser (see the tweet above!)
- No more stringly-typed audio units
The library still has a long way to go in terms of documentation and examples to get up-to-par with purescript-audio-behaviors
. I will likely spend the next 2-3 months improving purescript-wags
and then eventually putting purescript-audio-behaviors
in read-only mode.
If anyone would like to contribute, there are lots of odds and ends for the FP enthusiast, including:
- a
MemoizedState
monad that is conceptually close to theEnv
comonad - simulated linear types using a
proof
system - inductive types using typelevel Peanos to efficiently represent changing audio
- the use of @natefaubion 's https://github.com/natefaubion/purescript-convertable-options
- type-level lenses into audio graphs (ie creating audio, [connecting audio] (https://github.com/mikesol/purescript-wags/blob/main/src/WAGS/Connect.purs), [disconnecting audio] (https://github.com/mikesol/purescript-wags/blob/main/src/WAGS/Disconnect.purs), etc).
- indexed applicative functors
- indexed cofree comonads
- bitwise arithmetic in the type system
- type-level loops using rebasing
- Using events and behaviors for JIT scheduling
- the Well-Typed Klavier, which was the reason I started this whole thing and is what you can hear in the tweet above.
I hope you get a chance to check out the library & make sound/music with it!