pby_fr

After reading in the March issue the excellent DCC projects using the Arduino article, I really wanted to try something with these little (and cheap) Arduino. Before, I wanted to add some ambiance sounds on my small layout (just one module), with a Raspberry Pi and some small Bluetooth speakers. But nothing worked (unable to connect to more than one speaker at the time even if it should work in theory, and I never was able to make any Jython script recognise the Raspberry Pi From JMRI).

But with Arduino, everything was a lot more easy: just needed to follow the article, take some part of the circuit and remove unneeded one, and add two more MP3 players, write some C++ code and voila, a working DCC decoder with 3 speakers.

So what does this things?

  • 5V external power source (doesn't take power from DCC bus)
  • DCC mobile decoder with some CV for configuration, a mute function key (F8) and day/night function key (F1) (and individual function key toggle for each speaker)
    • DCC stack is the NmraDcc library
  • 3 MP3 players, with each a cheap microSD card (2GB is already overkill)
    • The player is the same as in the article: DFPlayer Mini, with its Arduino library
  • Each player has its own speaker
  • Each player will loop a track, when toggling day/night, it will play a transition track (10s by default) and then loop another track (another transition track in the other way).

In the video, you will hear only the 3 daylight ambiance sounds. I would like to write a small JMRI script to toggle the day/night function key depending on the fast clock time. Unfortunately, I'm not even able to save the fast clock setting in JMRI (as a professional software developer, I find the user experience of JMRI very bad).

For the sound tracks, I first looked at https://www.ambient-mixer.com/  but then I just used my own recording or some free sounds ( http://freesound.org/) and put them in Audacity program ( http://www.audacityteam.org/home/) . I used a background sound repeated several times, and added randomly some others there and here (finish track is around 5 minutes long).

The Arduino code is on https://github.com/pby7fr/dcc_audio_3players.

Same for the electronic schema: https://github.com/pby7fr/dcc_audio_3players/blob/master/schema/dcc_audio_3players.pdf

On the layout, I just made a hole in the Styrofoam, put the speaker box inside, and covered it with some grass mat (expect for the one inside the buidling).

Maybe someone with a JMRI oriented mind can write the toggle script?

Here some others photos of the board:

Pierre-Yann

pby_fr's blog index

Reply 0
rrfaniowa

Very cool!

Well done, pby!

I also plan to include ambient sound on my layout. I’ll have a slow flowing river with birds, interstate traffic, and industrial noise around a scrap dealer. The river sound/birds always put me in a great mood because the sound is so therapeutic.

Keeping the volume low so one hears it just around the intended area is workable. IMO, sounds really enhance a layout if done tastefully and not overdone. 

Scott Thornton

rebanner.png 

Reply 0
pby_fr

Thanks. Sure, ambiance sounds

Thanks.

Sure, ambiance sounds add a lot. Since I started to use sound decoder in some engines, I always thought that something was off. Well, a river and a forest without sounds don't seem right.

I put some DCC CVs to program (on the main) the different sound level. That's permit to easily adjust each player, directly on the layout.

Reply 0
Geoff Bunza geoffb

@pby_fr

Hi pby_fr (name?),

Some things for you to consider:

A terrific source of composed background sounds specifically for model scenes can be had at  http://www.fantasonics.com  I use these and edit them into other combinations. I am only a very satisfied customer. If you want to edit your own, search on the web for sound libraries. There are a few that offer great sound clips for free downloading.

The little DFPlayers can output real stereo (not using the on-board amp) at 24 bit 48Khz off of a max 32GB micro SD Card. If you get a decent small stereo amp and speakers, starting with quality stereo recordings, you can generate some remarkably good sound from this same tiny module. Try it sometime!

Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
pby_fr

Hi Geoff, Thanks for the

Hi Geoff,

Thanks for the link. It seems very interesting, with a lot of different ambiances.

Sure, many other sites have also free sounds. But I was amazed at how fast I got an interesting track with just adding several sounds in Audacity. For testing the board, I just made 3 tracks of around 5 minutes, but even with small 2GB cards, it is possible to put a lot more.

I forgot that the DFPlayers can output stereo. But sure, I would need 3 small stereo amp, and 3 more speakers. I don't see the need on my small layout, but I see the point for a larger one (having stereo ambiance sound for a long river can be interesting, has the two speakers are synchronized).

Pierre-Yann

 

 

 

Reply 0
Jim at BSME

Another todo

Well I guess I will have to add this to my list of ever growing arduino projects, thanks for sharing!

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
hawkesholayout

Great idea

Hi Geoff,

 

I've been thinking of this since I started looking into Arduino.

My goal is to install about 20-30 speakers around my layout (40' x 20') and to have them activated by censors under the track, so that the sound would only follow the operator with it's train. This way if I have 5 operators, each one would only hear the sound around them.

Since I'm new to Arduino, making a sketch is like doing a huge chemistry or a physics project and I don't know where to start from. I just finished my arc welding animation and now I'm presently building my speedometer and working on some animation, sound is next.

Thanks for the info.

 

Lloyd

 

 

Reply 0
Nick Santo amsnick

Sound was easy.

Hi Lloyd,

There are great and easy instructions on how to get the DF sound module going.  Dr Geoff's instructions were great and got me going.  Using an Arduino as a switch is very straight forward too.  Try it, you'll like it!

Nick

Nick

https://nixtrainz.com/ Home of the Decoder Buddy

Full disclosure: I am the inventor of the Decoder Buddy and I sell it via the link above.

Reply 0
Prof_Klyzlr

Valid Spam Kill

Valid Spam Kill by Post Author

While I understand the logic of "lots of little speakers with active-detection/following", there are a number of modellers who have attempted to tread this path before you, and all have reached the same conclusions. To Wit:

- Sync from one "speaker" location to the next is not impossible, but technically very challenging
(and one's ears are a very unforgiving, unblinking judge to try and fool. You have a window of 30millisec in which to avoid a audible "d-double" echo hit, and anything between 3-30millisec will sound "weird" as the sounds from adjacent speakers "phase cancels" to varying degrees in the air between the speakers and the listener's ears)

- The inherrent physical movement-interaction between a mobile "point source" (IE locomotive) and target ears is best achieved by actually mounting the point-source speaker co-incident with the visual noisemaker.
(IE if at all possible, put the speaker in the loco).

- "Ambience" is more than just "sounds from scenic items and other non-train noisemakers",
but also encompasses the acoustic interaction of the point-source noisemakers and the surrounding surfaces,
relative to the target listener's ears (including their realtime positional movement).

Putting these nuggets together, it becomes clear that:
- For moving and train-based "point source" reproduction, getting the speaker onboard the loco is actually quite important. With developments of PMD and cell-phone speaker drives, onboard sound even in N is possible

- It is better to think of "layout sound" in terms of a larger 2.1 speaker array per "scene" than to try and "active follow" sound with many many smaller speaker-drivers, presenting an obviously-discordant, disjointed result.

- Once the speakers are appropriately mounted relative to each "scene",
creating an appropriate soundtrack which can purposely and seamlessly knit together point-sources,
individual "call-out" elements (with active and startlingly accurate "localising" within the sound field),
and consistent encompassing enviromental-specific acoustic "ambience",
can present a more finescale, engaging presentation.
(You're already comfy with FreeSound sond sources and Audacity,
so creating an optimised scale-sound soundtrack is only a few moments of "trusting your ears" away... ).

FYI, you might find the following an interesting read...
http://www.fantasonics.com/manual.pdf

Happy Modelling,
Aim to Improve,
Prof Klyzlr

​PS reducing the playback system down to a 2.1 rig may sound like you're going to smother everyone with noise,
but as Scott T notes above, setting the playback volume waaay down low (and preferably consciously engineering
the soundtrack to sound correct at "just below conscious" playback volumes) can achieve optimised aural results
while not "flooding the room"

Reply 0
Reply