Scripting?

With Dorico’s alternative view of flows and players, I’m anxious to try scripting for purposes of creating educational sheets.

Any forecast on that availability? Still Lua?

Thanks!
hsf

The scripting API is very rudimentary at this point, and it’s not yet feasible to use it for much beyond simple macro-style automation of existing user interface commands. We intend to enrich the scripting features of the program as we go.

Is there any kind of documentation how to write Dorico skripts? I am aware of the limitations, but I also really would like to get myself confident with the skripting system. An API description would be already good to start with…

There is no real API yet. It would be useful if instead you could describe what you would like to achieve with scripting specifically, so we can design the API around your needs.

Haha, I’m just out of words for this incredible customer service!!! :astonished: :astonished: :astonished: :smiley: :smiley: :smiley:

Here is a list of features I hope to see in near future in Dorico script API:

  1. File/ Folder Picker and simple File-Actions (List Files in Folder, Open compatible Files, Save/export Files, Read/Write plain Text-File)
  2. Creating Dialogs
  3. Read/Set/Replace HouseStyle (-settings) /MasterPage
  4. Conditional Selecting of Elements (Filtering)
  5. Read / Override all Properties of selected Elements (for example Note Pitch, duration etc…)
  6. Creating / Deleting Staffs / Instruments
  7. Converting to alternative Notation
  8. Enumerating of all Elements in Project/Flow/Player/Instrument/Staff/…

Example User Stories matching to the functions above
1.1 Batch converting of Files
1.2 Merging/ Extracting Files to Single/Multiple Project(s)
1.3 [PlainText] Creating Log-Files
1.4 [PlainText] Extracting Meta-Data
1.5 [PlainText] Reading/Saving Plugin-Settings
2.1 Plugin Dialogs
3.1 Batch process applying Layout to Files
4.1 Filter elements for manual / automatic processing
4.2 Selecting / Filtering in code should be easy but powerful (like LINQ in .Net)
5.1 analysing scores
6.1 Rewriting SATB to single staffs
7.1 For example TAB, Percussion or Chinese Notation

Additional User Stories

  • Rearrange
  • Add Fingering
  • Correct TAB Guitar Fingering
  • Export every Instrument as Audio
  • Export/ Import Lyrics

Some Additional Wishes

  • Please be consistent (not good: ManuScript used 0 or 1 as first element in an Array)
  • Would like to use both OOP and Functional programming (specially Lambdas) in scripts, if possible
  • Easy way to write / debug scripts. It is horrible to debug or even write ManuScript plugins
  • Access to all functions of Dorico

I do not expect to have all these features in the next update, but it would be fine to have the easy to implement as soon as possible. Thank you for transparent communication with the community!

I can’t imagine any of this will be available for quite some time, as in, years. The Steinberg team is so busy putting out fires and shoring up the basics that I just don’t think they have the resources to implement something like this for awhile yet.

But yeah, all of that would be awesome.

I’d rather see playback improvements, Cubase integration, transpositions, chord symbols etc before even thinking about scripting.

Unless Steinberg can hire another 20 programmers? Dorico at $1000 might do the trick.

Come to think if it, Steinberg could have charged that much. It’s such an awesome program! :laughing:

I look at scripting as a potential solution to generating relevant worksheets for students. I am excited about Dorico’s use of flows and text boxes for worksheets, so I see the scripting add-on here as a real potential.

In teaching college theory, composition, and private piano, the biggest problem I see in my theory students is fluency in various skill sets - recognizing notes, keys, scale degrees, scale collections, chords, etc. As long as students are having to take time to calculate what they see in one vertical moment, it will hamper what they analyze in the horizontal movement of the piece. The most efficient solution for this is repetitive drilling of each of the skill sets involved. And this involves either lots of worksheets or lots of computer drilling - and most computer drilling out there is quite constrained in what it offers.

One of the problems with generating worksheets is:

  • It takes a lot of time to create one worksheet
  • You can’t hand the same worksheet to the same student multiple times and expect them to avoid memorizing answers

Sibelius worksheet almost works, but I find that the random selection of problems from the template is always in the same relative order, so that if I create a worksheet set that has problems in all 12 keys, then every generation of that worksheet will always present the keys in the same relative order. It is not really a random function. Plus if I want a large set of problems, I have to create A LOT of examples for the worksheet to randomly choose. Most of what I want to drill could be generated with algorithms - even simple four part harmony excerpts.

So, with that in mind, a scripting language would be useful for this if it could:

  • programmatically generate music (useful for creating flash cards, chords, etc.)
  • rearrange measures/flows/or whatever would help me randomize order of how material is presented to the student.
  • randomly select music excerpts from a larger set (e.g., like the worksheet function in Sibelius, but with more control)
  • insert data from files (e.g., images) - especially if I could programmatically generate the file name to choose or choose programmatically from a folder of files.

Thanks!
Henry

@ Phrazemaster: Sure, some scripting functionalities cannot be implemented at this early stage because Dorico does not provide needed features. I do not know the architekture and design of Dorico, but there is usually more implemented in code-behind of what you actually can use in UI. Providing an API is like connecting native features to the scripting library. Functions, like for example Open/Save, are already implemented and “just” lacking connection.
I hope some of these functions will be available soon, specially because this makes Dorico much more customizable and allows you to speed up your workflow / prevent you from doing the same action by hand over and over again.

@Dorico-Developers: No pressure, take your time. I am just dreaming and cannot wait to get my hands on the script engine :slight_smile:

I can’t say anything at all about timescales, because at this point we just don’t know when we’ll be able to make all this available. However we do already have the Lua engine embedded in Dorico. We have great plans for the scripting engine because we know how many more possibilities it opens up for our users. I anticipate that it will be quite an incremental process. For instance, currently it is possible to access Dorico’s command system via a script. It may actually be possible to do batch file conversions already, though I haven’t tried it. This is all at a very early stage, but we want to design the APIs around the use cases that users have.

We chose Lua as its very lightweight and can be used in different threads concurrently, and can be used to call libraries in C and C++. You can use an external editor and script debugger.

Please take a look at the earlier thread on this: https://www.steinberg.net/forums/viewtopic.php?f=246&t=97329&p=545648&hilit=LUA#p545648 This is a thread we’ll come back to when we look at scripting in more detail. If you add your list on that thread then it’s something we can consider.

Hi,

I am a composer, and programmer, and Lua is my favorite language!!!

I wish to develop a suite of compositional plug-ins such as:

  • Auto-harominzer, generating harmonic accompaniment for a melody in a variety of tonal/modal styles, using intelligent (generative) algorhithms
  • Arvo Pärt style Tintinnabuli generator - you set up the T-voice chord, the desired position and it creates the T-Voice from an M-Voice
  • Glass/Reich style additive/substractive constructions, for example you select a melody and it builds an additive version of it following some numeric series (1 note, 2 notes, 3 notes…)
  • Specific inversion scripts that allow diatonic/chromatic inversion using different axes or pitch spaces
  • Random note cloud generators based on pitch class sets
  • Isorythmic patterns generator, either monophonic or poloyphonic, you input color and talea and the number of desired iterations
  • Auto chord figuring, you input plain chords and it writes out alberti bass, up/down/straight/broken arpeggios in a variety of preset/custom rhythmic patterns, “waltz” pattern…
  • Strict counterpoint species generator

And so on and so on.

So what I need from the API is:

  • To be able to query the current contents in a specific range, and filter out notes including their properties, eventually including elements such as articulations, slurs, dynamics.
  • To be able to input from script notes, articulations, slurs, dynamics in sepcific places of the score relative to a selection.
  • To be able to generate dialog boxes for user interatcion so that users can set plug-in options.

All of this is “internal”, so personnally I wouldn’t need any i/o API functions that would access the file system.

Those are the kind of API functions that we would certainly prioritise, however even something as apparently simple as iterating through the notes on a stave is deceptively complex and we need to do a lot of thinking on how to structure the API for the different types of operation. For instance the concepts of a note are very different between the original note event, the drawn notehead and the played note, and so they will have APIs that present event views, layout views and playback views quite separately.

Thank you for the quick answer! Yes, I understand that designing the API is complex.

However, I guess that a lot of the low-level methods are already there, and the modular design certainly helps.

For example, the module drawing the score has already to query the notes from wherever they are conceptually stored (I don’t know what is the object model of how music elements are stored - if so I could give more precise suggestions). Also, when you click the input the note, the method to create it also exists.

If, as a first step, we could expose to Lua some of these basic and general low-level read/write functions, the community could already start building higher-level functions from that.

Anyway, if you need any further help, input, or beta-testing APIs, I’ll be glad to help.

Well, unfortunately it’s not quite as simple as that… Having access to the low level event structure isn’t quite as useful as it sounds, as these events have very little context. They have no idea what accidentals are displayed, how they are structured on a beam, how many tied noteheads will be used, etc. There are also big decisions about the packaging of scripts and modules that we’ve yet to make, so there’s not much that can usefully be created at the moment.

Rest assured though that when we do come to think about scripting in more detail we’ll be gathering feedback from the community (see my earlier thread, linked above).

Since this is now 2+ years old, has there been any added functionality?

No. If you want to know what the team have done in the past two years, read the Version History documents for Dorico 2 and Dorico 3. They haven’t exactly been resting on their laurels.

looking forward to see this happen! … salute

Over in the play tab, similar facilities as the logical editor presets in Cubase.

Making it fast and easy to batch process playback events would be quite helpful.