Releases: mikesol/purescript-ocarina
Unparalleled utilities
From observing WAGS in anger, it was clear that many real-world examples needed to update control-rate parameters over time, and these functions of time needed to be speedy. One major bottleneck for time-based functions like piece-wise functions is locating the evaluation region on the time axis. We can speed this up substantially by knowing what values are no loner relevant (because they are in the past) and what values to check first (because they are in the immediate future). Comonads help us do this. Check out NE2CF
to see these functions 🚀
Calm continuations
Introduces an icont
function to improve continuations in ibranch
.
Immaculate indices
This release uses comonads to back the indexed type. This simplifies the code base a great deal (cutting over 1,000 lines of code) and makes WAGS programs more readable (less boilerplate) as seen in the examples.
Persistent parameters
Parameters now have a forceSet
option that, well, forces their being set. Sometimes, the web audio API linear interpolation is abrupt & causes unwanted pops. By forcing a parameter set before an interpolation, it decreases the chances of an auditory artifact.
Preternatural patches
There is now a command patch
that will take a frame automatically from any graph1
to any graph2
. That means that all create, connect, destroy and disconnect operations will be figured out by the compiler. This eliminates boilerplate substantially. Do git grep patch
in the examples
folder to see it in action.
Courageous cancellations
Audio can now be canceled after it has been scheduled.
This feature was added because, in many instances, it is more efficient (meaning less clicks & bloops) to schedule changes via the web audio API's scheduler rather than doing them JIT. When scheduling changes, we may need to cancel them in response to new information. The library now supports this.
Incredible instances
Math with AudioParameters is now a lot easier thanks to instances of Semiring and Field.
Judicious validation
Makes validation of audio graphs optional in makeScene
. As audio graphs are already validated as they are built, the extra validation step in makeScene
mostly catches corner cases. By making validation optional in makeScene
, projects with complex graphs compile ~100x faster and can opt into validation when needed.
Great graphs
This release simplifies the structure of graphs in by using extensible records to model graphs instead of a custom type. This has the following benefits:
- Function signatures are significantly shorter.
- The code base's size was cut down by 33%.
- Error messages are easier to read.
- Records can be reified to the type-level and reflected to the term-level without using proxies.
Amazing changes
The library now returns an object from change
, changeAt
, changes
and change'
that reflects the changed audio unit. Previously, these functions had returned Unit
(akin to set
in many libraries), whereas now they return an updated value (akin to modify
).
Furthermore, we've added an asGetter
function to transform any graph into a getter. On change
, this will get the previous values instead of modifying them.
Lastly, this version adds a get
family of functions, get
, getAt
, gets
and get'
that work exactly like their analogue from the change
family of functions but act as getters by using asGetter
internally. Importantly, the get
family of functions does not increment the change bit. An example of get
is in the project's unit tests.