Virtual Sound Decoder

TwinDad Aug 10, 2011

  1. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    I've been working on a little software project... as an add-on to JMRI... I call it the Virtual Sound Decoder.

    http://www.youtube.com/watch?v=-Tgzz72Y0ao

    It's a little "thing" that runs on your computer and acts like... a sound decoder... listening for throttle events and generating sounds (engine, bells, horns, whistles, etc.) when you change the throttle or push a function button. Works with the JMRI software throttles or with your hardware throttles (or WiThrottle/EngineDriver), plus there's buttons directly on it if you want to use it "stand-alone".

    It's still very much "alpha" code, and a lot of stuff isn't implemented yet, but I've got enough to demo the concept, so I put together this video.

    In particular, you'll note the sounds don't loop or transition very well. Some of this is the quality (err, suitableness-for-looping) of the source audio, and some is that I haven't implemented much transition logic yet.

    So, please have a look if you're interested and provide some feedback.

    This isn't an official part of JMRI yet, and it is not available to be experimented with yet. I'm close, but it needs just a bit more time in the oven, and I've also got to secure some licensing rights for the source audio before I can distribute it.

    Thanks!
     
  2. Jerry Tarvid

    Jerry Tarvid TrainBoard Member

    739
    16
    16
    I'm very impressed! This would be a spectacular addition to JMRI. I think you have everything covered in theory. I look forward to seeing a demo released. I will be able to contribute more after some hands on operations.

    Since I have a computer already hooked up to my layout running JMRI this would be a great addition. I currently use stationary sound decoders feeding a Pyle 40W amp driving a Bose speaker system. I add the appropriate stationary sound decoder to a given consist; which allows it to respond in kind to all my throttle requests. Your addition to JMRI would be a simple means of doing the same thing, only better and feed the sound output to my existing under bench work sound system.

    Thank you for sharing and all your efforts.

    Jerry
     
  3. Vaccam

    Vaccam TrainBoard Member

    236
    0
    11
    Very nice TwinDad! I have been researching sound functionality for my n scale layout and was very pleased to see this. Can't wait to give it a try.

    Do you know if it will one day be possible to use this with surround sound equipment? I don't have JMRI set up yet, but I think it has the ability to know where your train is at any given time if block detection has been set up. Is this something that might be possible down the road?

    Thanks for all you do for our community!

    Michael
     
  4. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Yes. I have some bugs to work out, but it will work with whatever capabilities the sound card in your computer has. Which these days is usually at least 5.1 surround.

    Also, with some additional work later on, you'll be able to tie into the Digitrax transponding features and have the sound follow your engines, (more-or-less) just like the Surroundtraxx product.

    The main limiting factor will be the quality and availability of source audio for the VSD files. I am wholly at the mercy of the few kind folks out there who go out and record the various sounds and then are willing to share all that hard work for free.
     
  5. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Thank you. This project was in no small part inspired by the efforts a friend of mine went to build an under-table system using Tsunami decoders - and another one who used a G-scale decoder under the table. I just couldn't sit there and look at my Linux box with its audio system, and all the wonderful capabilities already built into JMRI, and not try to take advantage of it.
     
  6. Vaccam

    Vaccam TrainBoard Member

    236
    0
    11
    TwinDad,

    That would be great, but that is not exactly what I meant. Freiwald Software has a product they call +4D Sound, see their website. Their product does not require a decoder with transponding capabilities. This may be beyound JMRI's capabilities, I am not sure.

    Thanks again and can't wait.

    Michael
     
  7. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    The answer should still be yes. Any system that will interface with JMRI and provide locomotive position information could be used to then drive the sound position modification that will (eventually) be added to the VSD.

    SourroundTraxx, +4D Sound, and my VSD project are all doing essentially the same thing. The train control system is telling them where the train is in a 4D space, and the audio logic is converting this location information (along with position/velocity of the listener) into a blended audio output to a Surround Sound system. The only difference is in the method and accuracy of the train position detection, which isn't really part of the audio system.

    You could do a "poor man's" version by using current- or IR sensor-based block detection instead of transponders or whatever system TrainController is using. The train would seem to "jump" from block to block, but this might be good enough to at least move the sound from speaker set to speaker set in a basement empire. Heck, even having the dispatcher drag a marker on a Panel or click an occupancy button would be enough to provide some motion sensing.

    For a small layout you could use simple IR-sensors or block detection as a "poor man's" location feedback system to at least fade/mute the audio while in a tunnel...

    An ideal system would be run-time calculating the train's exact position, interpolating between IR sensors based on velocity feedback from the locomotive's decoder. I don't know if either the Digitrax or Freiwald systems do that, but it would be cool.
     
  8. Vaccam

    Vaccam TrainBoard Member

    236
    0
    11
    Cool! That is what I wanted to hear! I know that is beyound your current scope, but it is good to have hope that a low cost option may on day be available.

    Good luck with your project.

    Michael
     
  9. Curto

    Curto TrainBoard Member

    397
    0
    9
    Can it have a 'offline mode' where you can just have a panel of available sounds to trigger if it is not connected with a dcc layout? :)

    I ask because I'm using crummy old mrc prodigy (it works for driving trains... that's about it lol)
     
  10. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Yes. The "offline" mode is already implemented... except for the engine notching. The bell and horn work just fine, though, and you can start/stop/idle the engine.
     
  11. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Sneak Peek is available

    I'm probably going to get in trouble for doing this, but...

    If you want to have a sneak peak of the Virtual Sound Decoder, but either don't want to or don't know how to build JMRI from source, i've set up a ZIP file you can download to try it out.

    Full install instructions are here.

    Basically, you install JMRI v2.12 from their website, then replace the jmri.jar file with the one in my ZIP file. You can then run the virtual sound decoder, using the example_vsd.zip file included. It should respond to JMRI throttles, WiThrottles, EngineDriver throttles, or *some* hardware throttles... namely the ones that send throttle button info back to JMRI... Digitrax yes, NCE not so much...

    If you want to leave feedback, for now please do so on my Bugs page or my Feature Request page. This will help keep the JMRI bug and feature request trackers "clean" until this thing is stable enough. And help me see them more easily.

    FAIR WARNING: The jmri.jar file in this ZIP is "randomly" built from the current "HEAD" revision of JMRI. It's highly likely that it contains some unstable stuff that is broken and in the midst of being worked on by other JMRI folks. DO NOT use this for anything other than trying the VSDecoder function out. Or at least don't expect anything else to work.

    That said, it's pretty stable, at least as far as hooking up to LocoNet, launching a throttle, and doing other such "harmless" stuff.

    WARNING WARNING WARNING: DO NOT TRY TO PROGRAM A LOCO OR ANYTHING ELSE WITH THIS CODE. Use the standard 2.12 release instead. You foul up a decoder, it's your fault... I warned you...

    Bugs I already know about:
    * The sound doesn't stop when you close the VSDecoder window. Only when you shut down JMRI.
    * It doesn't handle multiple locomotives correctly. Starting a second VSDecoder and loading a VSD file for it affects BOTH VSDecoders...
    * There's a lot of "rough" behavior, especially in response to quick throttle moves.
    * sometimes the on-board buttons on the "Sounds" tab don't follow hardware (or JMRI) throttle actions correctly
    * Only the Bell and Horn work. The "Air Brake" and "coupler" (and other) buttons are just for show.
    * The entire "Options" tab is just for show for now.
    * Some of the sounds in the example VSD file are placeholders. I've never heard an NW2 with a Nathan K5LA, and I've never heard a GE 7FDL engine start that sounds like an NW2....

    Features "in the queue"
    * STEAM
    * Multiple locomotive support
    * More auxiliary sounds
    * 3D location tracking (someday!)
    * Gain control to balance the volume levels of sounds against each other.
    * Streaming audio to smart phones
     
  12. Svein-Martin Holt

    Svein-Martin Holt TrainBoard Member

    348
    377
    26
    Cool:tb-biggrin:,it worked.
    Just what I want to use on my Z-scale home layout.
     
  13. rray

    rray Staff Member

    8,312
    9,464
    133
    I want to try it too, but cannot find the zip file that contains the modified JMRI.JAR file. Where did you find that file Svein-Martin?

    I downloaded the latest build from the JMRI Jenkins Build Tool link, build #156, and installed it to a thumb drive on my home PC. The file name was "JMRI.r18461.exe". I started JMRI up and selected loconet simulator and saved. Next I re-started and created a loco, B31 at addres 31 and saved to roster. Next I opened TOOLS/THROTTLES/ and started wi-throttle. Next I used my phone to run engine driver, connected ok, then found my loco B31 in the list and aquired it. Now I am able to run loco B31 (virtually of course).

    So now I select DEBUG/VIRTUAL SOUND DECODER and the vsdecoder window opens up. I select FILE/LOAD VSD FILE and open example.vsd. I select EMD NW2 sound profile, my roster entry B31 for loco, and address set to 31. I save the settings.

    I go to the sounds tab and press "start engine" and nothing happens, no sound. I try horn, bell, coupler, and air brake, but hear nothing. I play an mp3 in winamp to verify sound is on, but cannot hear anything from the virtual sound decoder yet.

    The only thing I did not do was to first install 2.12 and then replace the JMRI.JAR file with the one from build #156, because I followed the "full instructions are here" version of instructions.

    What exactly did you do to get it to work Svein-Martin? I want to show the guys what's coming soon at the club Friday night? :D
     
  14. rray

    rray Staff Member

    8,312
    9,464
    133
    I just wanted to let you know I am really, really looking forward to getting this VSD feature setup. My previous idea of an ideal sound system was speakers placed under the layout in sound blocks, that transition to the next block when the locos move to the next block. This was what Surroundtraxx promised 11 years ago at the 2000 NTS in San Jose. Still never happened.

    When I seen Svein-Martin's Z Challenger running around our modules at the X2011 NTS I knew I had to do something about sound soon. Even the Surroundtraxx guys came running over to our layout to see Svein-Martin's Z Challenger, so I burst their bubble and told them he used a LokSound micro! Ha! :D

    I have 4 channels of MP3 sound effects on my latest module, which is great for background effects, but I have no loco sounds. I stream railroad radio through my Thunderbolt while running trains too using Engine Driver. This is cool, but still no loco sounds. I see this VSD as my last best hope for getting locomotive sounds for us Z scalers.
     
  15. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Hmm.... <scratches head>

    I thought you might have caught the bug I fixed last night, but my fix was in r18461...

    I ditched the zip file idea when I realized folks could access the Jenkins build. It's the full install package, so you shouldn't have to jump through any of the "install 2.12 first" hoops, just install it like the release.

    I assume since you downloaded the EXE version, you're on a Windows box. I'll have to look into it during the day tomorrow... don't have my Windows PC here...
     
  16. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Cool! You can see I've got a lot of work to do, though... :D
     
  17. Svein-Martin Holt

    Svein-Martin Holt TrainBoard Member

    348
    377
    26
    I had some problems having it to run, but figured it out.

    First of all I had problems to find the zipfile, but finally I found the menu for downloads...
    When I installed it, I had big problems for JMRI to find the new jmri.jar file, but I uninstalled my 2.12 version and reinstalled it, copying over the modified jmri.jar and when I then started up, I could run it.
    When I go back to the clean version, I did another uninstall, and installed 2.12. again to have a clean system after the test.
    May be not necesarry, but then it worked.

    An important point: I did not install the newest version, but used the stable 2.12 version!!

    I also had problems to load the sounds, until I read the manual better. It says: Load the .zip file!! When I loaded the zipfile, everything was looking good.

    I really look forward to have this working on my layout. A great idea. So, as soon it can run stable with several engines I will install it.
    An importent feedback to the developer: I think it is necesarry to have a volume control on each sound, so it can be set individually. I also think it would be nice to have a totalvolume button, so you can use the same pc for other sound sources also, like background mp3's.
     
  18. Svein-Martin Holt

    Svein-Martin Holt TrainBoard Member

    348
    377
    26
    Just to clean up any misunderstandings: It was not my Challenger, but Davids(the grey engine) and another black Challenger with sound(I do not know the name of the owner). I only created the video:
    http://youtu.be/URw1_MF_m8E
     
  19. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    This is one of the next major features I'm working on. There will be a master volume and a mute button across the bottom of the window (visible in all tabs), and there will be a new tab that will give an individual gain adjust (and possibly some additional "admin" controls) for each available sound. It's bugging me that right now the bell and horn are too loud relative to the engine. :D
     
  20. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    UPDATED "SNEAK PEEK" INSTALL

    The "sneak peek" install process has been simplified. You don't need the ZIP file anymore.

    You should be able to simply download and install the latest stable test build of JMRI from the JMRI Jenkins Server.

    Everything you need should be there.

    Keep in mind that this is a "bleeding edge" test build of the latest code from the developers. It is likely to have any number of bugs or incompletely implemented function, so be sure to back up your JMRI data files, and don't try to use this to run anything remotely mission-critical. Keep it in the sandbox!
     

Share This Page