One reason I haven't been blogging is that I've been tinkering with an audio synthesis tool for OSX written in Haskell.

You hook up modules in the GUI just like a real modular synth. Under the hood it actually compiles and builds a C module that does the synthesis. This works because C compilers are pretty damn fast. Each time you rewire the "patch" new C code is generated that smoothly (if you're lucky and have enough cores) carries on with the previous state. I hope that eventually it'll generate standalone code you can run on an Arduino, say.

Modules include everything from bit operations for one line symphonies, through mathematical operations allowing you to implement things like the logistic equation, to band-limited emulation of analogue oscillators and filters.

This is not a release. This is research code still in progress. It's incomplete. It's 99% undocumented. It stops suddenly if you do inappropriate things. But it can do stuff now. And people might like to tinker with it and I'd be interested to know if anyone else can build it successfully. (I'm not very good with cabal and that shows.)

It uses no other audio synthesis libraries, or even GUI libraries (apart from Gloss). The whole thing was built from scratch as a learning experience. (Gloss is great, but not appropriate for this task and it uses much more CPU time than the audio code.)

This is mainly GUI code. GUI code is not my forte and I only know how to build UIs imperatively. (I used the reinversion of control free monad I've mentioned in my blog.)

There was some interesting mathematics involved in deriving the code for the band-limited oscillators, especially getting hard sync to work. I'll write that up separately some time.

There is complete separation of the GUI from the back end. It could generate any kind of code, not just audio code.

I can't imagine having written this code without lenses. Thanks +Edward Kmett and others!

I hope to one day make an actual release with docs and regression tests.

The code is here:
Some samples here:

Note: The html files in the doc/ directory are probably more up-to-date than the README.
Shared publiclyView activity