Automating Trill Tasks in Dorico with Console Tools
Hey everyone,
I recently started learning to use the console tools in Dorico to simplify some complex tasks, and I wanted to share my first “slightly” elaborated profile. This script was developed to address repetitive tasks I often encounter when working with trills, especially in contemporary music. Here are some examples of issues I aimed to solve:
- Setting the trill note as a natural or artificial harmonic.
- Create a trill between two identical pitches.
- Handling microtonal accidentals of the small notes of the trill (natively, we cannot enharmonically respell the small notes of the trill in a microtonal context).
Typically, people seem to resolve these issues by recreating the small note of the trill in another voice. This involves steps like creating the note in another voice, deleting rests, hiding the stem, parenthesizing, scaling the note, etc. To simplify this process, I wrote a script.
The result is a functional script, though I believe there’s room for improvement. For instance, I encountered challenges with selection tools when trying to execute everything in a single command. For example:
- After creating the trill, the note gets deselected.
- To reselect the previous note, I used
EventEdit.NavigatePreviousItemSamePosition
. While this works in my test case, I’m unsure of its reliability. If it selects a tuplet instead of the note, the script won’t work.
Below, I’ve attached a video demonstrating the script and the script itself. Please note that the script is designed to work with the Console Tools framework created by Alexander_Ploetz, and it cannot be run directly from the “Run Script” function.
Script Code
local dorSetHarmonicType=CTL.generateDoricoPropertyChangeFunction("kNoteHarmonicType")
local dorSetPartial=CTL.generateDoricoPropertyChangeFunction("kNoteHarmonic","int")
local createOrnament = CTL.generateStaticDoricoCommandFunction("NoteInput.CreateOrnament")
local createTrill = CTL.generateStaticDoricoCommandFunction("NoteInput.CreateOrnament?Definition=tr&UseLocalOverride=0")
local wigglyLine = CTL.generateDoricoPropertyChangeFunction("kTrillHasWigglyLine")
local trillAppearence = CTL.generateDoricoPropertyChangeFunction("kTrillIntervalAppearance")
local accidentalVisibility = CTL.generateDoricoPropertyChangeFunction("kTrillAccidentalVisibility")
local selectNote = CTL.generateStaticDoricoCommandFunction("EventEdit.NavigatePreviousItemSamePosition")
local copyNote = CTL.generateStaticDoricoCommandFunction("Edit.Copy")
local enter = CTL.generateStaticDoricoCommandFunction("NoteInput.Enter?Set=1")
local nextVoice = CTL.generateStaticDoricoCommandFunction("NoteInput.NextVoice")
local pasteIntoVoice = CTL.generateStaticDoricoCommandFunction("Edit.PasteIntoVoice")
local exitEdit = CTL.generateStaticDoricoCommandFunction("NoteInput.Exit")
local changeDuration = CTL.generateStaticDoricoCommandFunction("NoteInput.NoteValue?LogDuration=kDemiSemiQuaver&Set=true")
local moveRight = CTL.generateStaticDoricoCommandFunction("EventEdit.MoveRightByValue?RhythmicGridResolutionValue=kDemisemiquaver")
local extendRight = CTL.generateStaticDoricoCommandFunction("EventEdit.NavigateRightExtendBar")
local extendLeft = CTL.generateStaticDoricoCommandFunction("EventEdit.NavigateLeftExtendBar")
local filterVoice = CTL.generateStaticDoricoCommandFunction("Filter.VoiceDownstem1")
local removeRest = CTL.generateStaticDoricoCommandFunction("Edit.RemoveRests")
local hideStem = CTL.generateStaticDoricoCommandFunction("Edit.ToggleHideStem")
local roundBrackets = CTL.generateStaticDoricoCommandFunction("Edit.ToggleRoundBracketsForNotehead")
local changeScale = CTL.generateDoricoPropertyChangeFunction("kEventScale")
createOrnament()
createTrill()
wigglyLine("true")
trillAppearence("kAccidental")
accidentalVisibility("kHide")
selectNote()
copyNote()
if(arg1 == "1") then
diamondNotehead()
end
if(arg1 == "4") then
dorSetHarmonicType("kArtificial")
dorSetPartial(4)
end
enter()
nextVoice()
pasteIntoVoice()
exitEdit()
changeDuration()
moveRight()
if(arg1 == "2") then
diamondNotehead()
end
if(arg1 == "5") then
dorSetHarmonicType("kArtificial")
dorSetPartial(4)
end
extendRight()
extendLeft()
filterVoice()
removeRest()
hideStem()
roundBrackets()
changeScale("kCue")
Video Demonstration
If anyone has suggestions for improving this script or handling the selection issues more reliably, I’d greatly appreciate your input!