Musical PureScript

Hi all, i was able to attend just one of @mikesol’s webinars this week and what he’s doing is really interesting and exciting.

I know of at least one other approach to music making in PureScript which is @newlandsvalley’s work based off of the late Paul Hudak’s Haskell School of Music.

Between the two of them that’s quite a wide base for doing musical things with PureScript…i wonder whether there’s other people out there interested enough that we could have some sort of special interest group?

any takers?


Count me in. I’m generally more familiar with the Csound approach to music (and the Haskell solution to it) but that would be a great idea.

1 Like

I’m very interested. My approach so far has been largely from the angle of musical notation rather than synthesising sounds or generating rhythms.

i’m thinking that quite a lot of constructs could be shared between those worlds…like if you wanted to do things like TidalCycles is doing you might have a DSL that allows you to say “instantiate this list of chords using that scale in this key and send the results to this MIDI channel”

Yes, I’m sure. A lot of this depends on trying to find the most intuitive and straightforward DSL that might express what you want to say. I don’t think it’s easy. So, for example, I don’t like trying to write music in the Euterpea / Haskell School of Music notation. I tend to use ABC notation and translate it to HSoM, but that’s very niche.

1 Like

Count me in!

I could repurpose the discourse as a purescript-arts discourse, or we could keep it here or make a Slack channel. I like some discourse, though, because you can post examples (ie the klank discourse has lots of “I Made This” examples).

2 Likes discourse sounds like a fine idea to me.

i was reading (TBH, skimming) this, this morning:

and it occurred to me that it would be interesting to know have some compare and contrast with Tidal - i see on the Tidal forum that there are a couple of mentions of PureScript “tried a port a few years ago and found PS was missing some features” and a mention of trying to get Tidal to work in the browser using ASM…all of which leads me to believe there might be other people out there interested in that sort of cross-over…


I could give you admin access to the discourse. Should I use the same e-mail with which you registered for the webinar?

A few things would need to change to make it more amenable for general discussion…

  • The name
  • The getting-started info (we could keep the klank post, but we should have a more generic getting started and an intro post for other arts projects, ie John’s, as well)
  • The current “I Made This” posts would need to indicate that they’re made on so that we could differentiate between different places/technologies available

Does that sound ok?


I did in fact start writing a port of Tidal in PureScript some time last winter, and we’re now pairing up with Alex (McLean, the author of Tidal) to clean-up/release that code and possibly (re)start the work on that. I’ll post here once I have something out :slightly_smiling_face:

1 Like

sounds great, whatever works for you will definitely be fine with me.

Hm, tough to compare. My first shot:

  • Tidal is an input language for creating live pattern-based art that uses SuperDirt (and thus SuperCollider) as a backend
  • purescript-audio-behaviors is a general-purpose audio and graphics creation tool.

I’ve never used tidal before for making art (I’ve just done the hello world), so the first thing I’d need to understand if artists want to port tidal to the web or if artists want to expand what tidal can do. If it is the former, then it’s possible to build a port that uses purescript-audio-behaviors as a backend. If it is the latter, then it may be better to teach people how to build DSLs, kind of like the Bach prelude or percussion example from the webinar.

I personally like building or reusing DSLs for each new piece because they’re quick to build and can often vary subtly depending on the requirements of the piece, which results in a more expressive outcome. Ie the two Bach examples on the klank discourse have two slightly different DSLs because the pieces work differently.

i was definitely imagining Tidal or Tidal-ish DSL using purescript-audio-behaviors as the sound generator, obviating need for SuperCollider/SuperDirt…and/or using MIDI out.

I agree with Mike in the way that a general purpose musical language like purescript-audio-behaviors (PAB) and a live-performance dsl like Tidal are really separate things. Composing and improvising are dual to each other, musically as important as the other, but they are meant to never be used at the same time and I think any tool trying to integrate both should be clear on what is doing what.
However, they have so much in common (time management, orchestra instruments, effects …) that it would be a shame not to make profit from it.
So I’m asking, fellow PureScript Musicians, thanks to the type system that we all love, is it possible to design a set of classes that could be common to written AND played music and could express the difference between them as rarely but as clearly as possible, that could describe any kind of music and that would be intuitive and extensible. What would be your ideal musical tool ?
As I was saying, I’m used to the Csound way of describing any music as a tuple (score, orchestra) but I’m noticing a shift towards an all-orchestra description as time passes (scores are often represented by special instruments now). I like that. What do you think ?

1 Like

@afc could you register for ? Then I can give you admin access so we can start migrating it to a more general music-themed space. Thanks!

1 Like

This is a great question. I’m going to pick it up on the klank discourse to see if we can kick off a first general-purpose music-themed discussion.

1 Like