Nestup musical rhythms

I recently revisited this site which is a pretty interesting idea, but I don’t use Max or Live. I was wondering if anybody has implemented anything remotely similar or in a similar vein in SC (not the visual part, purely the pattern generation)


1 Like

The library you mentioned parses this DSL to a class named Container. It’s not so hard to replicate that in SuperCollider. All rhythm manipulation happens on this underlined representation, so it’s not difficult to port this code to SC.

There is also SequentiableCollection.convertRhythm. It’s limited, but maybe useful for you.

I have some old code that does this kind of thing.

a = RhythmicCell([2, [1, 5, 1]]);
    b = RhythmicCell([2/3, [1, -1, 1]]);
    [a, b].asRhythmicSeq.plot;

I’ve been exploring working with RTM, but I am separating values and shapes with some inspiration from APL. But that’s not in SC.

example = rtm' [s 1, g 3, 2 |: [s 1, g 1, s 1], s 1]
example = [rtm| (1 -3 (2 (1 -1 1)) 1) |]

(shape, values) =  extractShape example

-- raw shape is something like
-- Shape: ShapeNode () [ShapeNode () [],ShapeNode () [],ShapeNode () [ShapeNode () [],ShapeNode () [],ShapeNode () []],ShapeNode () []]

shapeAsList = [4, 0, 0, 3, 0, 0, 0, 0]

Manipulating this seems weird, but after some time, I find it achieves much more than working with traditional trees. Pattern matching with complex arbitrary trees is very error-prone. APL-like approaches are computationally simple, and once you know what to look for, you don’t get errors after that.

Creating a simple DSL is something I sometimes think about. But I never found something to stick with.

–edit: @jamshark70 has developed a DSL with rhythmic features. There are other initiatives in the past too.

ERROR: Class not defined.
  in interpreted text
  line 1 char 16:

  a = RhythmicCell([2, [1, 5, 1]]); 
-> nil


I wrote this code more than ten (or 15? IDK) years ago. It’s not on Quarks. It’s not very useful for others now, but other libraries are around now.

The funny thing is that nobody cared when I worked with those things in SC. The lemma was that every project and every composer would create their own system.

Now, there is some will to have at least a basic functionality re: musical notation.

The Rational class I proposed to the Std Lib was a good start, but it was not accepted. It could be a base for other things since music notation depends on it.

It began the “conservative turn” in SuperCollider, when nothing new was well-regarded. People talked about bugs that they didn’t care to fix. :slight_smile: Now, they even want to shrink the main library, removing JitLib :sweat_smile: :sweat_smile:

Regarding designing “Domain-Specific Languages” or “little languages” like the OP, I think it’s a great initiative. Unfortunately, SC does not offer the best tools to do it, even though there are exciting ones here.

You can look around for inspiration!

If I were to do something now, I think the easiest way would be to use a Python script behind the scenes. Then, you could have access to Music21 and Abjad. That would be quite easy.

Beyond the musical notation, the way you did can interest current SC users. Old code can be recycled or upgraded according to the need.
And what about other libraries you are thinking of?
Note this is not my topic, I am just curious. Thanks.

1 Like

Take a look at Josh Parmenter’s @josh Ctk; there are a few examples of exporting to MusicXML, Guido, and Lilypond. You will get the basics there to go further.

Music notation is vast. Most tools in SC are incomplete in one way or another.

I’m now developing a music notation/music theory system in Haskell.

ALso an audio engine in Haskell and C++. But I want to integrate them with supercollider. The audio engine, for example, uses JACK2 as its node tree (imagine that each node is a jack2 client, in a similar way that non-mixer does that) for two reasons: a) I get multithreading and parallelism for free using the KISS principle, and I keep working with SuperCollider Server as a module

I’m not sure I understood you. If you need anything, be in touch. chhhrs