This is an Edge Impulse transformation block that mixes background noise into audio files. It randomly picks a background sample, randomly changes the volume on the noise, and then combines these with the original file. It also downsamples the final audio file. You can use this to augment your data with realistic background noise in Edge Impulse.
-
Install the Edge Impulse CLI.
-
Initialize the block:
$ edge-impulse-blocks init
(To log in with a different account, run
edge-impulse-blocks init --clean
) -
Push the block:
$ edge-impulse-blocks push
-
In your Edge Impulse organization now go to Data transformation > Transformation blocks, select your new transformation block and click Edit transformation block. Then for 'CLI Arguments' set
--frequency 16000 --out-count 10
.
-
Install Docker for desktop.
-
Build the container
$ docker build -t transform-mix-noise .
-
Run the script (this creates 10 files, and downsamples to 16KHz):
$ docker run --rm -it -v $PWD/:/data transform-mix-noise --in-file /data/data/jan.wav --out-directory /data/out --frequency 16000 --out-count 10
-
The
out/
directory now contains 10 files.
To change the background audio go to Dockerfile
and change the URL of the YouTube video. Alternatively you can copy a file into the container yourself.