JMRI: Sound Editor
Author: Bob Jacobsen
Keywords: JMRI help sound editor

# SPJ Sound File Editor

Digitrax sound decoders are loaded with "sound projects", stored in "Sound Project" (.spj) files. Those contain a number of "sound fragments" in .wav format, plus a small program that tells the decoder when to play the various sounds, and controls the use of functions and CVs. That program is stored in a "Sound Definition" (SDF) format.

The "Digitrax SPJ Editor" window allows you to examine and change the contents of a sound project file. Once you've changed them, you can install them into your decoder with the sound downloader.

Digitrax provides sample sound project files at their Sound Depot (http://www.digitrax.com/sounddepot.php) web site. You can also find links to documentation and additional tools there.

When you invoke the SPJ Sounds File Editor tool from the LocoNet menu, you first get a file selection window:

Click "Open File..." and select the .spj file that you'd like to work with. (The examples on this page are from the Digitrax AC4400 example) The editor window will then expand to show the content of the file:
(Click on any of the images on this page to see a full size version)

Most of the content of a DIgitrax SPJ file is the individual .wav sound fragments. For those, the columns of the table are:

- The number of the fragment
- The type, WAV for .wav sound fragments
- The short name given this fragment by the file's author
- The handle number, which the SDF sound definition uses to refer to the sound
- The original filename for this fragment
- The fragments length in second
- A button that plays the sound on your computers speakers
- A "Replace" button

If you click the "Replace" button on a sound fragment, a file selection window opens in which you can select a new sound file (.wav file) which the replaces the original fragment. The new file should contain 8-bit unsigned monaural sound sampled 11.025kHz. Other formats might or might not work, but we know that this one does.

After making changes, you can click "Save" at the top of the editor window to save the file with the original name, or (better) under another name. You can then use the Sound Downloader tool to load the modified file into a Digitrax decoder via a PR2 or PR3 interface.

SPJ files contains some additional parts, visible at the bottom of the list here:

The "comment" element contains human-readable information from the SPJ file's author, in a specific format with other parts of DecoderPro are able to read. The View button shows it in another window:

The ".map file" element contains the connection between sound names (3rd column) and handle number (4th column) used by the SDF sound program. The View button shows it in another window:

The "SDF" element contains the Sound Definition File (or Format) information that the decoder uses to determine which sound fragments to show when. These are written in a form of assembly language, written in a specific format. The file only contains the result of that process; the human-readable source code is not stored in the SPJ file. Still, JMRI can recreate it (except for the original spacing and comments) to give you a rough idea of the content, and will show that in another window if you click the View button:
JMRI also provides a limited capability to edit the SDF information using the SDF Editor. Click the "Edit" button to open a separate SDF editor window, with its own help page.

The "CV data" element isn't used by JMRI. DecoderPro uses another method for storing CV information.

## Related Tools

The JMRI Sound File Downloader lets you download SPJ sound files to a Digitrax decoder if you have a Digitrax PR2 interface.

The SDF Editor, referenced above, lets you edit the SDF program within a SPJ file.