Rehearsal Marks >> MIDI Markers Export

Hello folks! First time posting here on the Dorico Forum, perhaps on any forum at all, even.

I recently started using Dorico for work, and I’m struggling with a multitude of things; so far the forum has been super helpful with a lot of things, though!

Some context: the project I am currently workin on requires manipulating existing MusicXML files (originally from Finale) and exporting them as MIDI into a DAW (UAD’s LUNA) in which I’ll load my orchestral library of choice (Spitfire’s BBCSO). My initial plan was to use Dorico’s Playback Template for BBCSO but I found the expression map to be, frankly, pretty terrible. I instead opted to use NotePerformer 4’s Playback Engine in conjunction with BBCSO, exporting audio stems into a LUNA project with an existing Tempo Map (from Dorico).

In a sense, I’m using Dorico as an interface between MusicXML and MIDI/audio rather than as a notation software (which I’m sure it’s really good at! I just haven’t found a program that can do the former better than dorico. Please correct me if I am mistaken on that point)

An integral part of getting all of this to work is getting rehearsal marks out of Dorico and into LUNA without issue. I know that Markers/Locaters can be communicated via a MIDI file from one program to another, but I can’t for the life of me figure out how to automate (to the best extent possible) the process of creating markers. I see that I can create markers in Dorico’s Play mode manually, and I could just as easily do the same within LUNA, but part of the project is to automate as much of the process as possible, and manually sitting there and creating markers is a no-go. I saw on another forum post that a user was able to get this to (sorta?) work in Dorico via inputting system text, but this is nearly as tedious as just creating markers (although it does avoid having go back and forth between programs/views).

So my question then becomes the following: is ther a more efficient way of getting markers out of Dorico? Perhaps I’m missing an obvious workaround here and someone can point that out to me, or maybe at the end of the day I’ll just have to manually create them for every score…

P.S. if anyone happens to have any sort of familiarity with Finale V27 and knows of an analogous function there that’d work too but would be less than ideal.

Thanks so much in advance, folks! I definitely will have some further questions on some different topics, and please do let me know if I should start a separate thread as I may be yet unfamiliar with the forum etiquette here.

Cheers
N

Welcome to the forum, Nathaniel.

I think the quickest way to create markers in Dorico is to select a note at the position where you want the marker to go, type Alt+P to bring the playhead to that position (since markers are always created at the playhead position), then type Shift+Alt+M to create the marker itself.

These markers will be included when you export MIDI from Dorico, and presumably will be imported by Luna.

1 Like

Thanks so much Daniel, you’re the best! Works like a charm. Of course this isn’t ideal and, perhaps, [feature request incoming] if you guys could implement an “Export Rehearsal Marks as Markers” option in the MIDI export dialogue, or maybe even a “Create Markers from Rehearsal Marks” command - that would be amazing.

I bet this whole process could be automated super easily with a script that cycles through shortcuts with all possible rehearsal marks - A-Z and so on. I’m not familiar with Dorico’s scripting capabilities, but I’m sure it can be done via even something as simple as Apple’s Automator or AppleScript

Here’s how I’d do it (in case anyone comes across this on the web and wants to implement it):
set a shortcut for Go To Marker..., say, ctrl+M for example
then run something along the lines of

ctrl+M
A
enter
alt+P
alt+shift+M
A

… repeat for all letters of the alphabet and all possible names of rehearsal marks in Dorico

I guess this is a tangent and is no longer directly applicable to the initial question posed, so please do let me know if I’ve violated a community guideline here.

If an when I do figure out how to script/automate this process, I’ll be sure to update this thread for any folks who might need to use it.

Thanks again for your help, Daniel; you’re the best

Cheers
N

(Please refrain from suggesting changes are easy… )

2 Likes

Update: I’ve got it! Apologies for suggesting that it may be easy to make an AppleScript, the intention was to suggest that a user could create a custom script with ease, not the developers integrating a feature. With that said, I am by no means a computer scientist and have nearly zero prior coding experience, and with a couple of google searches and 2 hours of back and forth, I’ve created a successful script.

Attached is an AppleScript (to be run in Automator) that will automatically create a Marker for each Rehearsal Mark. It’s not the fastest thing ever but it works just fine (significantly faster and Dorico crashes).

To run it, open Automator and select File >> New >> Quick Action >> Choose. Next, find "Run AppleScript in the Actions menu. Then paste the following script where it says (* Your Script goes here *)

on run {input, parameters}
	
	set MarkerNames to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
	
	set LastMarker to display dialog "Enter the name of the last marker, cap-sensitive (example: 'YY' or 'AAA'). After pressing continue, you have 5 seconds to click anywhere within the Dorico 'Write' window." default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
	delay 5
	
	tell application "System Events"
		set pass to 1
		repeat 4 times
			repeat with a from 1 to length of MarkerNames
				set CurrentMarker to item a of MarkerNames
				
				keystroke "m" using {control down}
				delay 0.2
				repeat pass times
					keystroke CurrentMarker
					delay 0.2
				end repeat
				keystroke return
				delay 0.2
				keystroke "p" using {option down}
				delay 0.2
				keystroke "m" using {option down, shift down}
				delay 0.2
				repeat pass times
					keystroke CurrentMarker
					delay 0.2
				end repeat
				keystroke return
				delay 0.2
				set temp to ""
				repeat with i from 1 to pass
					set temp to temp & CurrentMarker
				end repeat
				if (text returned of LastMarker is equal to temp) then
					display dialog "Finished creating markers." with icon caution buttons {"OK"} cancel button "OK"
				end if
			end repeat
			set pass to pass + 1
		end repeat
	end tell
	return input
end run

Once you’ve got that, go ahead and File >> Save and give it a name. Next, open up System Preferences >> Privacy and Security >> Accessibility and toggle on the switches next to Automator, Script Editor, and Dorico.

Now, open up your Dorico Project. First, open preferences and create a keyboard shortcut via Dorico >> Preferences >> Key Commands >>Edit >> Go To Rehearsal Mark. Click on the region that says Press shortcut and press control + M on your keyboard. Click Apply and close the preferences. In the App Menu at the top of the screen select Dorico >> Services >> {your new script} and follow the prompts.

Enjoy! I hope this is helpful to some people out there, I know it certain was (and will be) for me.

Cheers
N

edit: oops, pasted the wrong script (older, broken version). fixed it, the script above is good to go

2 Likes

Brilliant work, Nathaniel! Just FYI, it should be possible (someday, if not yet) to script this within Dorico using Lua. I was able to record steps such as navigating to the next rehearsal mark, moving the playhead there, and creating a marker. But I haven’t figured out how to reliably reselect the rehearsal mark so you can go to the next one.

Oh, you’re absolutely right on that front; I just couldn’t quite figure out Lua yet and how that works, and AppleScript seemed easier to work with (sorry Windows users, I feel your pain… just switched). Seeing as Dorico’s Rehearsal Marks follow a predictable pattern, I found it easy to make a list of the alphabet and have it increase the number of times letters get repeated every pass. If you’re well-versed in Lua you could probably achieve it that way, I’m just not a CS guy at all… Maybe it’s time to take a few courses