Category Archives: Virtual Sound Decoder

Science Night!

Science Night by BGTwinDad
Science Night, a photo by BGTwinDad on Flickr.

Last week I was asked to provide a presentation on a science or engineering topic at my daughter’s school. Since most of the other presenters had the “work” and “research” angles well covered, I decided to show something fun.

To the left is a test loop of track that I built.  The loop is broken into 14 blocks that are wired for train detection through a Digitrax BLD168.    The front, back, and left/right curve halves are connected to Digitrax RX4 for transponding detection.  That may be a lot of technical “jargon” for some of you.  The BDL168 detects which of the 14 track blocks the locomotive is on.  The RX4 allows the locomotive to “check in” and report its road number to the computer.

Speaking of the computer, in front of the layout, left to right you see a Digitrax Zephyr Xtra command station, which actually runs the train.  The small box in the middle is a PR3 which is basically a USB connection for the Zephyr.  And then, of course, is the computer.

On the computer (an Apple MacBook Pro), the JMRI software program is running.  It’s displaying a map of the oval,with the train’s location highlighted.  At the same time, it’s running my Virtual Sound Decoder, playing the sound of the engine through the speakers at back, and of course the sound appears to be coming from the locomotive, which is the whole point!

The poster board to the right has some “slides” showing how various sciences (both “hard” and “soft”) can be applied to Model Railroading or any other hobby.

The whole thing was a big hit with the kids, I think.  Either that or they were very polite.  Of course, they were getting extra credit for it!

Virtual Sound Decoder for JMRI

Here’s a little software project I’ve been working on, alongside of my more “hard” modeling work.  I made a video demo, as it can be hard to express how this is all supposed to work in words.


This is the result of a confluence of several factors.

I have long wanted to have sound on my layout, but I was balking at the expense and the lack of sound quality from N scale sound decoders (this has more to do with physics and tiny speakers than the quality of the available products).  SoundTraxx had been pre-announcing their SurroundTraxx product for a while, and a couple of online friends of mine have been toying with under-the-table sound systems being driven by hardware sound decoders and larger speakers.  And I had been playing with the JMRI Java Model Railroad Interface project.

It occurred to me that I could write a software program that would emulate (or simulate, if you prefer) the function of a hardware sound decoder, listening to the layout interface for throttle commands and responding to them  just as a hardware decoder installed in a locomotive would.  And most PCs these days come with surround sound audio systems!  JMRI already provided much of the foundation for this, including the layout interface, a nice abstraction of the throttle, and integration with the OpenAL 3D audio system, so it seemed a good match.

I’ve been working on this for a few months.  The basic idea follows very roughly the scheme of an add-on sound decoder.  For each engine you want to have sound, you launch a “Virtual Sound Decoder” (or “VSDecoder”) on the PC, select a “sound profile” from a “VSD File” and assign it a DCC address.  The virtual decoder then sits in the background and generates sounds in response to the throttle inputs.  Thanks to the way JMRI handles throttles, it will respond to any throttle on the system, whether a hardware or software throttle, or a wireless-attached throttle on a PDA or smart phone.  Buttons on the VSDecoder allow the user to directly trigger sounds, bypassing the throttle if desired.

The “VSD File is somewhat like a Digitrax SPJ file, though the two are completely incompatible.  The VSD file is a Zip archive containing all of the source audio files, plus a configuration file (written in XML) that tells the Virtual Sound Decoder when and how to use the sound files.  Each VSD File can contain one or more “Profiles”, each of which describes a specific configuration of a locomotive.  This could be multiple variants of a particular type of locomotive, or several completely different types of locomotives. For example, a VSD FIle might contain profiles for several different EMD engines based on the 567 Diesel prime mover, or an eclectic collection of engines belonging to the Pennsylvania Railroad.  VSD Files can be easily constructed by and shared among folks who are interested in doing so.

Work progresses steadily, and I hope to have a version of this included in the 2.13 development release of JMRI at some point.  In the meantime, if you are interested in developing or providing sound files, let me know!