Table of ContentsRosegarden Device File (.rgd) Developer's GuideDocument is still in progress, but should be quite helpful in its current state. What is a Rosegarden Device (.rgd) File?Rosegarden device files (*.rgd) describe the bank selects, program changes, controllers, and percussion keymapping(s) for a specific MIDI synthesizer. They can be loaded via the Rosegarden Device Manager: Studio > Manage MIDI Devices > Banks… > Import… Device files are stored in ~/.local/share/rosegarden/library. The files themselves are in xml format, gzipped. GM.rgdThe most commonly used device files are likely GM.rgd and its successor GM2.rgd. These are good examples to use for reference when making your own rgd files. Let's have a look at GM.rgd: $ cd ~/.local/share/rosegarden/library $ zless GM.rgd
There are three main kinds of tags: Bank Tags
<bank name="General MIDI" msb="0" lsb="0"> <program id="0" name="Acoustic Grand Piano" /> <program id="1" name="Bright Acoustic Piano" /> </bank>
The Controls Tags
<controls> <control name="Pan" type="controller" description="<none>" min="0" max="127" default="64" controllervalue="10" colourindex="2" ipbposition="0" /> <control name="Chorus" type="controller" description="<none>" min="0" max="127" default="0" controllervalue="93" colourindex="3" ipbposition="1" /> <control name="Volume" type="controller" description="<none>" min="0" max="127" default="100" controllervalue="7" colourindex="1" ipbposition="2" /> <control name="Reverb" type="controller" description="<none>" min="0" max="127" default="0" controllervalue="91" colourindex="3" ipbposition="3" /> <control name="Modulation" type="controller" description="<none>" min="0" max="127" default="0" controllervalue="1" colourindex="4" ipbposition="-1" /> <control name="PitchBend" type="pitchbend" description="<none>" min="0" max="16383" default="8192" controllervalue="1" colourindex="4" ipbposition="-1" /> </controls>
The The colourindex values allow a selection from among 5 colors (see the “generalmap” colourmap from autoload.rg):
The ipbposition numbers should be as above for those controllers. For all others, the numbers should be “-1”. This prevents them from appearing on the UI unless the user explicitly asks for them. ipbposition values are organized from left to right and then top to bottom. This table shows the organization along with the controllers that historically have occupied each position:
Keymapping Tags
<keymapping name="General MIDI Percussion" channel="9"> <key number="35" name="Acoustic Bass Drum" /> <key number="36" name="Bass Drum 1" /> <key number="37" name="Side Stick" /> <key number="38" name="Acoustic Snare" /> <key number="39" name="Hand Clap" /> </keymappping>
The Variations
If your synth implements variations across bank selects (like General MIDI 2), consider using variations mode. The To find some examples, use zgrep (see below) to search the device library for variation=“lsb” or variation=“msb”. Warning: For variations mode to work, every PC that has variations must be present in the first bank. Here's an example that will not work: First Bank:
(Note that there is no PC 2 in the first bank!) Second Bank, variation 1, (variation=“lsb”):
That Violin sound in the second bank will never show up in variations mode because there is no Program Change 2 in the first bank. Searching the Device LibraryUse the zgrep command to search all the installed .rgd files: $ zgrep Expression ~/.local/share/rosegarden/library/*.rgd Starting from Scratch
Making changes
Here's an #!/bin/bash # Edit an rg/rgd file... # Show a diff after editing is complete. cp "$1" "$1.xml.gz" gzip -d "$1.xml.gz" # Save for the diff. cp "$1.xml" "$1.xml.before" $EDITOR "$1.xml" # diff diff -u --color=always "$1.xml.before" "$1.xml" if [ $? = "0" ]; then echo No changes... rm "$1.xml.before" rm "$1.xml" exit fi rm "$1.xml.before" gzip "$1.xml" mv -f "$1" "$1.original" mv "$1.xml.gz" "$1" When you are ready to test, install your .rgd file by copying it to the Rosegarden library: $ cp device.rgd ~/.local/share/rosegarden/library Now the Device Manager (Studio > Manage MIDI Devices) will find it. Editing with the GUI
ChecklistBefore submission, be sure to go through the following checklist:
SubmissionSend your device files to our user mailing list for inclusion in the next version of Rosegarden: https://sourceforge.net/projects/rosegarden/lists/rosegarden-user UtilitiesTODO: Get all the scripts into the source code scripts directory and link to them. See txt2rgd.py above. ReferencesAn older guide is also available here: https://www.rosegardenmusic.com/resources/documents/rgd-HOWTO.shtml |