Create instrument with custom clef

I’ve created a new instrument called “4-line chant,” and I’d like to add the appropriate clef.

Is it possible to assign a custom clef to a new instrument? I know the glyph is available in Bravura and that I can swap out an existing clef in the Music Symbols editor; I’d rather bake it into the instrument definition.

Also, I’d like to be able to adjust the vertical placement of the clef as needed. Is that possible?

It’s honestly not that hard to create a custom additional clef and add it to Dorico with a doricolib file. Just let me know what glyph you want, how you want it positioned, and it will only take a few minutes for me to swap it in. The catch is that there’s no way (that I know of) to define a key signature for it, so if you need to use a key sig, then you might just be stuck adding the key sig graphically.

I can’t remember why I did this one, but I already had a doricolib file for a 4-line treble clef if you want to try modifying it yourself.

4-line Treble
<?xml version="1.0" encoding="utf-8"?>
<kScoreLibrary>
	<clefDefinitions>
		<entities array="true">
			<ClefEntityDefinition>
				<name>Treble Clef for 4-Line</name>
				<entityID>clef.treble4</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<basicClefType>kGClef</basicClefType>
				<clefTranspositionReminder>0</clefTranspositionReminder>
				<compositeID>comp.4LineGClef</compositeID>
				<clefCategory>kUncommon</clefCategory>
				<clefChangeCompositeID>comp.4LineGClefSmall</clefChangeCompositeID>
				<clefDefinition>
					<isPitched>true</isPitched>
					<requiredNumStaveLines>4</requiredNumStaveLines>
					<staveIndexFromBottomLine>2</staveIndexFromBottomLine>
					<hotSpot>
						<noteName>G</noteName>
						<octave>4</octave>
					</hotSpot>
				</clefDefinition>
			</ClefEntityDefinition>
		</entities>	
	</clefDefinitions>
	<glyphDefinitions>
		<entities array="true">
			<GlyphPrimitiveEntityDefinition>
				<name>4LineGClef</name>
				<entityID>glyph.4LineGClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<codePoint>0xE050</codePoint>
				<isSmufl>true</isSmufl>
				<alternateForGlyph/>
				<fontStyle>font.defaultmusic</fontStyle>
				<pointSize>1</pointSize>
				<rotation>0</rotation>
				<colour>kDefault</colour>
			</GlyphPrimitiveEntityDefinition>
			<GlyphPrimitiveEntityDefinition>
				<name>4LineGClefSmall</name>
				<entityID>glyph.4LineGClefSmall</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<codePoint>0xF472</codePoint>
				<isSmufl>true</isSmufl>
				<alternateForGlyph/>
				<fontStyle>font.defaultmusic</fontStyle>
				<pointSize>1</pointSize>
				<rotation>0</rotation>
				<colour>kDefault</colour>
			</GlyphPrimitiveEntityDefinition>
		</entities>
	</glyphDefinitions>
	<compositeDefinitions>
		<entities array="true">
			<CompositeDefinition>
				<name>Treble Clef for 4-Line</name>
				<entityID>comp.4LineGClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<category>kClef</category>
				<components array="true">
					<component>
						<componentId>glyph.4LineGClef</componentId>
						<componentType>kGlyph</componentType>
						<xOffset>0</xOffset>
						<yOffset>-2.5</yOffset>
						<xScale>100.000000</xScale>
						<yScale>100.000000</yScale>
						<zOrder>0</zOrder>
						<maxOpticalScale>100</maxOpticalScale>
						<componentInstance>0</componentInstance>
						<colour>kDefault</colour>
					</component>
				</components>
				<relativeAttachments array="true"/>
				<scalingRules array="true"/>
			</CompositeDefinition>
			<CompositeDefinition>
				<name>Treble Clef for 4-Line (small)</name>
				<entityID>comp.4LineGClefSmall</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<category>kClef</category>
				<components array="true">
					<component>
						<componentId>glyph.4LineGClefSmall</componentId>
						<componentType>kGlyph</componentType>
						<xOffset>0</xOffset>
						<yOffset>-4</yOffset>
						<xScale>100.000000</xScale>
						<yScale>100.000000</yScale>
						<zOrder>0</zOrder>
						<maxOpticalScale>100</maxOpticalScale>
						<componentInstance>0</componentInstance>
						<colour>kDefault</colour>
					</component>
				</components>
				<relativeAttachments array="true"/>
				<scalingRules array="true"/>
			</CompositeDefinition>
		</entities>
	</compositeDefinitions>
</kScoreLibrary>

Thanks! The file I’m using for starters is attached, if that’s helpful. There are two possible clefs: the DO and FA clef. They’re in the Medieval and Renaissance Clefs range, U+E902 and U+E906. Either can be displayed centered on any of the 4 staves:

image

image

Chant Test.dorico (892.4 KB)

1 Like

I assume this isn’t baked into the Dorico project though, right? It’s going to be dependent on the customized settings at the device level?

Hmm, not sure. It certainly exports fine as a PDF. Does this open for you with the clefs installed?
Chant Test with Clefs.dorico (895.8 KB)

(The preview image of the clefs in the Uncommon category isn’t correct, but the score display and function is. Oops just realized I should change something else, but still curious if it opens.)

Yes!

1 Like

Cool! Seems to work then! I changed Engraving Options / Clefs / Scale Factor to 1 to get that clef the regular size.

Here’s the doricolib file:
Dan’s Clefs for 4-Line Staves.zip (1.0 KB)

and the code
<?xml version="1.0" encoding="utf-8"?>
<kScoreLibrary>
	<clefDefinitions>
		<entities array="true">
			<ClefEntityDefinition>
				<name>Do Clef for 4-Line</name>
				<entityID>clef.do</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<basicClefType>kCClef</basicClefType>
				<clefTranspositionReminder>0</clefTranspositionReminder>
				<compositeID>comp.4LineDoClef</compositeID>
				<clefCategory>kUncommon</clefCategory>
				<clefChangeCompositeID>comp.4LineDoClef</clefChangeCompositeID>
				<clefDefinition>
					<isPitched>true</isPitched>
					<requiredNumStaveLines>4</requiredNumStaveLines>
					<staveIndexFromBottomLine>6</staveIndexFromBottomLine>
					<hotSpot>
						<noteName>C</noteName>
						<octave>4</octave>
					</hotSpot>
				</clefDefinition>
			</ClefEntityDefinition>
			<ClefEntityDefinition>
				<name>Fa Clef for 4-Line</name>
				<entityID>clef.fa</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<basicClefType>kFClef</basicClefType>
				<clefTranspositionReminder>0</clefTranspositionReminder>
				<compositeID>comp.4LineFaClef</compositeID>
				<clefCategory>kUncommon</clefCategory>
				<clefChangeCompositeID>comp.4LineFaClef</clefChangeCompositeID>
				<clefDefinition>
					<isPitched>true</isPitched>
					<requiredNumStaveLines>4</requiredNumStaveLines>
					<staveIndexFromBottomLine>4</staveIndexFromBottomLine>
					<hotSpot>
						<noteName>F</noteName>
						<octave>4</octave>
					</hotSpot>
				</clefDefinition>
			</ClefEntityDefinition>
		</entities>	
	</clefDefinitions>
	<glyphDefinitions>
		<entities array="true">
			<GlyphPrimitiveEntityDefinition>
				<name>4LineDoClef</name>
				<entityID>glyph.4LineDoClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<codePoint>0xE906</codePoint>
				<isSmufl>true</isSmufl>
				<alternateForGlyph/>
				<fontStyle>font.defaultmusic</fontStyle>
				<pointSize>1</pointSize>
				<rotation>0</rotation>
				<colour>kDefault</colour>
			</GlyphPrimitiveEntityDefinition>
			<GlyphPrimitiveEntityDefinition>
				<name>4LineFaClef</name>
				<entityID>glyph.4LineFaClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<codePoint>0xE902</codePoint>
				<isSmufl>true</isSmufl>
				<alternateForGlyph/>
				<fontStyle>font.defaultmusic</fontStyle>
				<pointSize>1</pointSize>
				<rotation>0</rotation>
				<colour>kDefault</colour>
			</GlyphPrimitiveEntityDefinition>
		</entities>
	</glyphDefinitions>
	<compositeDefinitions>
		<entities array="true">
			<CompositeDefinition>
				<name>Do Clef for 4-Line</name>
				<entityID>comp.4LineDoClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<category>kClef</category>
				<components array="true">
					<component>
						<componentId>glyph.4LineDoClef</componentId>
						<componentType>kGlyph</componentType>
						<xOffset>0</xOffset>
						<yOffset>0</yOffset>
						<xScale>100.000000</xScale>
						<yScale>100.000000</yScale>
						<zOrder>0</zOrder>
						<maxOpticalScale>100</maxOpticalScale>
						<componentInstance>0</componentInstance>
						<colour>kDefault</colour>
					</component>
				</components>
				<relativeAttachments array="true"/>
				<scalingRules array="true"/>
			</CompositeDefinition>
			<CompositeDefinition>
				<name>Fa Clef for 4-Line</name>
				<entityID>comp.4LineFaClef</entityID>
				<parentEntityID/>
				<inheritanceMask>0</inheritanceMask>
				<category>kClef</category>
				<components array="true">
					<component>
						<componentId>glyph.4LineFaClef</componentId>
						<componentType>kGlyph</componentType>
						<xOffset>0</xOffset>
						<yOffset>0</yOffset>
						<xScale>100.000000</xScale>
						<yScale>100.000000</yScale>
						<zOrder>0</zOrder>
						<maxOpticalScale>100</maxOpticalScale>
						<componentInstance>0</componentInstance>
						<colour>kDefault</colour>
					</component>
				</components>
				<relativeAttachments array="true"/>
				<scalingRules array="true"/>
			</CompositeDefinition>
		</entities>
	</compositeDefinitions>
</kScoreLibrary>
2 Likes

Thanks Todd. I’m still lost though… Do I need the doricolib file? Do I place that somewhere? How did the file open for me without it? How do I input the clefs?

Sorry… out of my element!

I think because I saved that “Chant Test with Clefs” file on my system, they must have saved embedded with the file. If you start a new project from File / New, you won’t have them unless you already copied the doricolib file to your DefaultLibraryAdditions folder. It should be in Library/ApplicationSupport/Steinberg/Dorico 5 on a Mac. (I think, I’m on my PC right now.) Just unzip the zip file and copy the doricolib to that location to have them available in the future.

There’s no way to add a popover command so you have to enter them through the right panel. The images in the right panel aren’t correct. I’m not sure if it’s possible to correct these or not, but they will appear correctly in the score:
right

Ah, I see. I guess since I don’t have the doricolib file on my computer yet, that’s why I’m not seeing them in the side panel.

Thanks!

After moving the unzipped doricolib file to that location, I still don’t see the clefs you’re seeing.

Also, how do I change their location? Do I need to create a clef for each position?

Thanks!

They should appear in the Uncommon Clefs panel. You’ll need to close and restart Dorico after you’ve moved the doricolib file to DefaultLibraryAdditions though.

Do you mean vertically on the staff? Yeah, you’ll have to create a different clef for each different position you need. This bit is what defines what note is where on the staff:

Just copy everything I already did, give each new clef a new name and unique entityID, then change the clefDefinition as required to place the clef wherever you need it to appear.

3 Likes