Programming exercises with Lua

I’m wanting to write a scales and patterns book in all 12 keys. I’ve already used a program to figure out all the exercises in a scale degree format (e.g. 1235), all in all there’ll be thousands of exercises. It’d take me months or even years to write all of these out by hand… I just came across Lua, so I have 0 experience with it. But I was wondering if Lua would be suitable for programming Dorico to write out all these exercises? Is there a better option?

Thank you

If you’ve “already used a program to figure out the exercises…” I would use something like music21 to take that output and generate an XML. Import that into Dorico to do the layout work.

2 Likes

is it possible to write Numbered Notation with Lua?

The problem is not so much Lua, but Dorico’s merely rudimentary API.
I do have accumulated code over the years that can probably do what you want, provided that you can twist your data into my very own encoding syntax.
But you are probably much better off at the moment with what @Janus suggests.

2 Likes

Another option would be openmusic, which can export to MIDI or XML (download here). It has also a helpful forum.

2 Likes

I had a go at doing this using music21 and it is quite straightforward. Here are the files.
exerciseBook.zip (612.6 KB) - a python script to generate some notes; the output xml file (via museScore); and the dorico import (trivially formatted).
I’m sure others could produce more elegant code!

4 Likes

Amazing, thank you for the insights. I’ll check this file out later on