(Hopefully) Interesting snippet for making melodies

This snippet is based on @BongLebowski performance during the marathon, with some little help from @yaxu to make it work like I wanted.

    let dascale = "hirajoshi"
    let chord = "'maj"
    let melo = "0 3 4 7"
    let root = "<e4 d4 c4>"
    d1 $ n (scale dascale (chord + melo) + (root + "<-12 -7>")) 
        # s "superpiano"
    d2 $ every 3 (rev) $ n (scale dascale (melo) + root) # s "superpwm" 

This is just the core idea, but feel free to experiment by changing the variables to see how it works.
For the full list of scales and chords, have a look here:
and here:


Now that I look back at it, melo should be strictly speaking be called degree and melody would be the combination of root + degrees

1 Like

Just ran this, sounds perfect! And the code looks more professional than mine too, I was haywire with everything - debut performance got the best of me I guess :smiley:

Can you explain how this works:

From what I understand, it's taking in the 7th note and the octave below the current root?

Also, my code was based on a solution provided by @earthlydelight on another thread in the forum. I'll have to dig that post up.

Yes, it is a transposition an octave and a major fifth below the actual root, alternating between these, just to show some more possibilities. And also gives two separate melodic lines

1 Like


d1 $ every 2 (arpeggiate) 
        $ n (scale dascale (chord + melo) + (root + "<-12 -7>")) 
        # s "superpiano"

yields interesting results

1 Like

Hi all! I really like this topic, this is my favorite one-liner:

let tonal root mode = note . (|+ root) . scale mode

d1 $ tonal "<0 3>" "major" $ "0 2 4 7"

I'm currently researching ways to use ControlMaps for this. This is what I'm aiming for:

d1 $ "0 2 4 6" # key "0:major"

The arpegiate works great with something like a arpy or supermandolin, never quite got good results with the superpiano. But this is a great starting point!

I'd be interested in the ControlMaps versions of the code. Do keep us in loop when you figure it out!

1 Like

This looks super promising!

paging @earthlydelight - I think this is something you were looking for here:

Side note, that thread was unresolved - in theory I think my stuff should've worked, but it did not sound right to my ears, I didn't dig further...

1 Like

Thank you guys, that's some great improvement on the original idea! When I saw @BongLebowski 's performance it was very interesting to see it applied in such a creative way :slightly_smiling_face:

The one-liner I currently came up with is:

let chorddeg scl root voices degree = (scale scl (voices + degree - 1) + root)

I added the -1 because I'm more comfortable using 1-based numbers for chords built on the scale degrees. It resembles more the standard roman numbers (e.g. "I IV V ii").

These two are equivalent:

d1 $ arpeggiate $ n (chorddeg "major" "c4" "'maj" "1 4 5 2") # s "superpiano"

d1 $ arpeggiate $ n (chorddeg "major" "c4" "[0,4,7]" "1 4 5 2") # s "superpiano"

You can also do something like this, alternating octaves:

d1 $ arp "pinkyup" $ n (chorddeg "major" ("c4" + "<-12 0 12>") "'maj" "1 4 5 2") # s "supervibe"

or creating melodies on the chord progression by giving structure to the arpeggio (with a pattern or a semi-random mask):

d1 $ struct "t [~ t] t@2 [t*2 ~] t" $ arp "pinkyup" $ n (chorddeg "major" ("c4" + "<-12 0 12>") "'maj" "1 4 5 2") # s "supervibe"

d1 $ mask (binaryN 8 54385230) $ arp "pinkyup" $ n (chorddeg "major" ("c4" + "<-12 0 12>") "'maj" "1 4 5 2") # s "supervibe"

So many possibilities!


I might have a small improvement on your one liner, but not enough time right now to make it right, so I'll post later.
Btw, no big deal, but your use of binaryN is a bit awkward since you cannot encode such a big number on 8 bits. The biggest number possible is 256 (or 255 depending if you're a human or not).

Yeah I know, I usually just type a big number mashing the keyboard so I can increase the first parameter and take more values without running out of digits... 8, 12, 16 ecc.

As for your improvement I'm very interested :slightly_smiling_face:

OK I see, I just discovered the function, so I was a bit puzzled.

As for the improvement, I would like to decouple the root from the octave, so probably a prime function would be worth. The only problem is the octave is embedded in the root "c4", "c5" etc ... which is a bit annoying.

I think you can just do # octave "<3 4 5>"

OK, but what I mean is the function would look like :

let chorddeg scl root octave voices degree = (scale scl (voices + degree - 1) + (root + (octave - 5) * 12)

(btw, it looks like 0 == c5 which is unusual)

But, then if you want to use it, it would look like :

(chorddeg "major" "c5" "<-1 0 1>" "'maj" "1 4 5 2")

which is confusing ... do you see my point ?

Ok I see, you're right, that could also be an option...

One option I would LOVE to see in tidal is the ability to use "do re mi" instead of alphabet.
That would solve a lot of issue regarding mini-notation (like eigth note for example)
As a side effect, I would not have to think about translation when building chords ... :slight_smile:

(chorddeg "major" "do" "<3 4 5>" "'maj" "i iv v ii")

so much nicer to my ears :wink:

1 Like

That indeed would be very nice :smile:

We got to sell to @yaxu letting him know he could then proudly wear a shirt that says:

Anti-Fa# (reversed hashtag)