Now this is still really boring. This lib is called rhythmical so how about adding some rhythm? Let's start easy with the german song "Alle meine Entchen":
Using spaces we can flatten our objects by one level to a string. What if we wanted to flat more levels? This is where bracket notation comes in. It works just like in JSON but without the " and , signs:
Under the hood, strings with brackets will be parsed to json first.
To spare the upper level of brackets, you can use " . " to seperate sections:
As you can see, the structure is like the major scale example but with an Array of Arrays.
This approach allows defining rhythms solely through data structure as opposed to time and duration values. That is
The same idea is also utilized by TidalCycles and the Tone.js Sequence
If you just want monophonic nested rhythm notation your good to go, but the good thing about this lib is that it combines the nested notation with polyphony and powerful ways of parsing & manipulation.
If you don't like them you don't have to use them. You can just use polyphonic mode with time and duration instead.
But if you prefer that notation, maybe you should not be using this lib at all.
We need to go deeper. Let's play the famous bolero Rhythm
Now we have Arrays that go up to four levels deep. The levels are
If you look at the paths of the rendered output, this is what you'll see as second numbers.
Even if you're not familiar with traditional music notation, it's worth comparing:

The point: western music notation is just a subset of rhythmical notation!