Showing posts sorted by relevance for query sound. Sort by date Show all posts
Showing posts sorted by relevance for query sound. Sort by date Show all posts

Friday, November 06, 2015

How I used Audacity to create sound files for my Ford(ish) railbus

Introduction

Having just modified a cheap USB MP3 Player to enable a Deltang receiver to trigger movement from file to file (see How I modified an MP3 Player to provide sound for my railbus), I needed to create some appropriate sound files to use with it.

I decided that I needed five sound files:
  1. 20 min of silence (when the railbus was stationary with no engine running)
  2. Engine start-up and idle (for 20 minutes)
  3. Horn, gears and acceleration through the gears before running sound (for 20 mins)
  4. Deceleration, brake squeal and idle (for 20 mins)
  5. Engine stop
I figured that I could move forward and back through these files using the direction switch on my Deltang Tx22 transmitter to cover all eventualities under which the railbus might operate.

Locating suitable sound files

The internet is a wonderful place. I searched for appropriate sound files of antiquated Ford motor vehicles which I could use. Initially, I searched for Model T Ford sounds as I had previously used some of these to dub sounds on to a video of the railbus in action (see A Day in the Life of Peckforton Station).

 These sounds had been suitable for lineside shots, with the railbus moving towards and away from the camera, but I needed engine sounds which were more constant.

Eventually, I managed to track down the sound of a Model A Ford on the StockMusic.com website. For a modest sum (just under $10), I was equipped with the sound of a car running past, the car starting, idling and stopping, and the sound of a car horn.

I was now ready to start editing in Audacity, which is a free open-source sound editing program available from SourceForge. To demonstrate the editing processes involved in producing the sound files, I'll show you how I produced the most complicated one - the third file with the horn, gear change and acceleration to running speed.

The first step was to start up Audacity and then open the downloaded file containing the idling engine sound. The engine start and engine stop sections of the file were highlighted and then deleted, leaving just the sound of the idling engine.

Part of the engine sound was highlighted and then Adjustable fade ... was selected from the Effects menu

 The opening volume was set to 100% and the closing volume was set to 200%. You may need to experiment with these values to suit the sound file you are working with.

 Once the rising effect of the volume was checked, the same section was highlighted once more and the Sliding Time Scale/Pitch Shift tool was selected from the Effects menu.

 The initial tempo change was set to 0 and the final tempo change was set to 200%. Again this final value was determined by experimentation. After some checking I decided the pitch needed to be changed as well to give a rising pitch to the engine as it increased in speed. The final pitch shift was set to 100%.

 The effect was tested to check the settings sounded satisfactory.

 The edited section of sound was highlighted, copied and pasted into the sound track and another section of the original idling sound was edited to give a slightly different and shorter section of rising sound, which was copied and pasted again to give the effect of working through four gears.

I decided the sound would be enhanced with the addition of the gearbox whining in the background. I tracked down the video of a vintage bus on the internet and extracted the sound using another piece of free software - Any Video Converter.

Once a suitable section of whining gearbox was found it was imported into the Audacity .......

.... where it opened as a new track

The short section of whine was copied and pasted a few times....

 The section of whine sound before the rising engine sound was highlighted and then, using the Amplify tool from the Effects menu, its volume was reduced to zero (there would be no gearbox whine while the railbus is stationary).

A section about twice as long as the rising engine sound was highlighted and amplified, rising from 0 to 400% using the Adjustable fade tool from the Effects menu (again some experimentation was necessary to find the most appropriate value).

The tempo and pitch of the same section was edited with the Sliding Time Scale/Pitch Shift tool from the Effects menu. The tempo was changed from 0 to 200, and the pitch from 0 to 100%.

The effect was applied again and copied and pasted to match the other sections of the engine sound track.

After some tweaking and adjustment, the sound of a grating gearbox (found on a free sound effects website - https://www.freesound.org/ ) was then imported and copied and pasted on to a new track to occur at appropriate places alongside the engine and gearbox sounds.

Finally, the sound of the Ford's klaxon horn was imported and added on a track near the start of the recording.

 A similar approach was used to create the other files needed (ie start and idle, decelerate and idle, idle and engine stop). These were exported from Audacity as MP3s and then transferred, one at a time (to ensure they appeared in the correct order) on to the micro SD card.

The SD card was then installed into the MP3 player on the railbus and tested to ensure everything worked as intended.

As you can see, there is a 1 second pause when moving from one track to another. I may look into the possibility of using a recordable sound module triggered by a Picaxe chip to mask this pause, but for now I am happy to live with the pause - my imagination disguises the gap in sound and when making videos of the railbus, I can edit out the pauses.




Friday, August 07, 2026

How I used a DF Player Mini module as a simple soundcard

 Introduction

After my IP Engineering Plate Frame Simplex loco's cheap greetings card sound module failed (see How I modified a cheap greetings card module as a sound card), I wanted something similarly cheap but more reliable as a replacement. Enter the DF Player Mini.

The DF Player Mini sound module has been around for quite a few years. It is modestly priced (c£3.50GBP on eBay or less than £2.00GBP on AliExpress), and is very versatile.

Basically, it is a compact MP3 player which can access tracks stored on a Micro SD card. What makes it particularly useful for use as a soundcard is that it has a built-in audio amplifier which will power a 3W speaker. Its operational voltage range is 3.2v - 5v and so will need to be connected to a voltage regulator if used with locos with a higher voltage battery pack (or track power). 

 VCC is the positive (+ve) input and either of the GND pins are the negative (-ve) input. The speaker is connected to SPK_1 and SPK_2. 

Tracks stored on the SD card are played in the order in which they were uploaded to the card and need to be numbered 001, 002, 003, etc. They can be in .MP3 or .WAV format. .WAV files are better for our purposes as they can be accessed or looped with a hardly noticeable gap between them. The module can accept cards up to 32Gb and so can potentially access thousands of sound files. However, I only needed a couple of files and so used a 521Mb card. 

It has been designed to interface with microprocessors such as Arduino but, for my purposes, sound files on the SD card can be triggered by connecting various pins to Ground (ie 0v or the negative side of the battery used to power it).

For simple soundcard purposes, the most useful pins are:

IO1 - Short press = Play previous track - Long press = Decrease volume
IO2 - Short press = Play next track - Long press = Increase volume
ADKEY_1 = Play first track (and loop if held down)
ADKEY_2 = Play fifth track (and loop it)
 
However, by connecting resistors to the ADKEYs particular tracks can be played or functions selected.
 
Armed with this knowledge, I was now in a position to create a simple soundcard for my IP Engineering Simplex loco.

 

Creating the sound files

 Firstly, I needed to track down some suitable sound files. I would need the sound of a diesel loco similar to a Simplex running at a fairly constant speed, and also a horn sound.

There are various sound libraries on the internet where you can download sounds by paying a small fee. I used Sound fishing which is quite reasonably priced (eg 6 Euros for a month) - https://www.soundfishing.eu/premium.html 

Once I had found a suitable sound file, I then highlighted a section of the recording which I felt was most appropriate for my needs, .......

 .... and exported that Current Selection as a Mono WAV file.

I could now store this file on an SD Card (as 001) and then loop it using ADKEY_1 connected to ground to provide continuous sound for my loco.

 

 Adding a horn sound

However, I also wanted to add a hooter or horn sound, triggered by pressing the Bind button on any of my Deltang or Micron transmitters.

After tracking down a section of video which featured a typical Simplex loco horn sound, I exported the short segment from Audacity (as above) and then re-opened the file of the steady Simplex engine sound which I had saved earlier.

 I then imported .......

..... the short segment of horn sound which appeared on a new track below the steady engine sound track.

I moved the horn sound track slightly to the right and then trimmed the steady engine sound so it was slightly longer than the horn sound track. As you can see, the combined tracks last slightly under one second in total.


 The new combined sounds were then exported as a WAV file.

The reason for overlaying the horn sound on to the steady engine note is so that when the horn sounds, the engine sound continues in the background.

To allow the two files to be played and triggered, I had to make use of the ADKEYs ability to trigger separate tracks using resistor inputs. This also required the tracks on the SD card to be arranged accordingly.

I found that, not only did I need to delete the original WAV file, I also had to reformat the SD card otherwise the sound files wouldn't play properly. The horn sound was loaded first on to the card and renamed 001.wav . The steady engine sound was uploaded second and renamed 002.wav .

 The link from GND to ADKEY_1 was replaced with a 3k resistor (so Track 2 on the card would be played continuosly) and a link from ADKEY_1 to pad C on the Deltang Rx65b receiver was made. Pad C gives 0v output when the bind button is pressed on the transmitter (ie Channel 5)

So, when the loco is first turned on, the 3k resistor from ground to ADKEY_1 makes DF Player loop Track 2 (the steady engine sound) but when the bind button is pressed on the transmitter, the receiver connects ADKEY_1 to ground directly and so, while the bind button is being held down, track 1 (ie the horn sound) is looped.

Here's how it sounds.

 

Further DF Player Mini Projects

 

 

Thursday, July 06, 2023

How I used a cheap recordable sound module as a loco sound card - Part 1

In the past I have used a greetings card sound module to provide low coast sound for my IP Engineering plate frame Simplex ( see How I used a greetings card module as a sound card). It was cheap (c£1.50 GBP) but quite limited in scope. The sound file was restricted to around 20 seconds, it had to be recorded via a microphone so the quality was poor and the volume wasn't great.

When I saw another recordable module on eBay for a reasonable price (£12.00 GBP), I thought if give it a try, particularly as it was also available on AliExpress for less than £3.00 GBP. They are also available on the UK Amazon website for £13.99 (including a battery box and a suitable USB lead).

There was no documentation but one of the photos accompanying the listing indicated the module could be programmed to operate in different modes. 


Further research on t'internet revealed the modes were fairly limited but it was possible to loop the sound file, which is what I needed for a basic soundcard.


This chart may at first look baffling but, with help from a YouTube video, I managed to interpret it - see below for more info.

I had already tracked down a suitable sound file of a noisy diesel tractor on the Soundsnap website (see How I added sound to my Bluetooth controlled diesel loco), and so my first job was to edit a suitable clip from the file to upload to the sound module. 


Since I downloaded this file, there has been a price increase on SoundSnap so you might want to seek out alternative tractor sounds from one of the free online sound libraries - eg https://freesound.org/people/aUREa/sounds/268779/ 

I used the free audio editing program Audacity to create a clip of the running engine lasting about two and a half minutes ( clips of up to four minutes can be uploaded dependent on sound quality).


For more information on using Audacity see How I used Audacity to create sounds for my railbus

The file was exported as a WAV. Unlike MP3 files, WAV files don't suffer from that annoying half-second break in sound when the file loops back to the beginning.

The module was connected to the computer with a micro USB connector, bearing in mind that some USB leads are not fully wired. The first lead I tried must have been wired only for charging a device as it failed to show the module's memory store.

With the right lead, the module's memory opens like any other USB drive.


The MP3 file which comes with the module was deleted....


.... and my edited tractor WAV file was dragged and dropped on to the module's memory (files up to 8Mb can be uploaded).


At first, I tested the sound was OK by connecting the two power leads to a 4.5v battery box. 


I then got to grips with changing the playback mode using the above chart. It was a lot simpler than I expected. The zeros and ones indicate which of the three resistors labelled A B and C needed to be retained or removed to change the mode.

For example, 0 0 1 means keep resistors  A and B and remove resistor C. This will make the module play the sound file when the button is pressed and continue until the the button is released (or the sound file ends).

The mode I was interested in was the penultimate one - press the button to play and then cycle or loop the file being played until the button is pressed again. This was coded 1 0 1 which meant I needed to remove resistors A and C but retain resistor B.


To remove the resistors, I applied heat from a soldering iron to one end of the resistor and gave a small amount of pressure on the iron towards the opposite end of the resistor. As soon as the solder melted, the resistor slid off. 

The process was repeated for resistor A.

A quick test play showed the operation was successful. 

I now had to fit the unit into the loco. Fortunately, the loco in question is powered by two li-ion cells wired in parallel to give 3.7v output to the Deltang Rx60b receiver. In addition to the 5v input terminal, the sound module has 3.7v input pads.....

... so the wires on the 5v input pads were removed and two wires were soldered to the 3.7v terminals.

These were then connected to the 3,7v input to the Deltang Rx60b so the sound module would be powered up when the loco was switched on.

I removed the leads to the push-button. At first I simply soldered across the terminals to the push button so the sound module would start playing immediately the loco was turned on. 


However, as the sound file I used was of the engine running at speed rather than ticking over, I decided I wanted some way of turning the sound on and off from the transmitter.

The designers of this module have fortunately anticipated this requirement as the push button connects the trigger for turning on the sounds to ground (0v). Fortunately, they also include a trigger which is activated when it is connect to V+. The Rx60b is a very early Deltang receiver, with outputs which give only 3.2v rather than the 0v of later models and so, via a 1k resistor, I could connect the output pad from the Rx60b to the V+ trigger pad (labelled PH - P High) on the sound module - the other pad is PL (P Low)

The small speaker which is supplied with the module was housed in an enclosure which I designed in Tinkercad and 3D printed. 

This was mounted, as is my usual practice, on the underside of the cab roof using double sided sticky pads.

The loco was then given a few test runs

This soundcard solution is not the most sophisticated - it plays only one sound which is independent of the speed at which the loco is running. There is also no horn or whistle. It is akin to the sound cards which used to be marketed by Acme (no longer in production). However, as the modules can be bought for under £3.00GBP which includes the speaker, it is a cheap and reasonably effective way of providing small internal combustion-engined models with a sound system.

Update: How I added a second card to provide a horn sound