vpeopleonatank / example-transform-block-mix-noise

Transformation block that mixes custom background noise into audio files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transformation block: Mix background noise into audio files

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.

Usage in Edge Impulse

  1. Install the Edge Impulse CLI.

  2. Initialize the block:

    $ edge-impulse-blocks init
    

    (To log in with a different account, run edge-impulse-blocks init --clean)

  3. Push the block:

    $ edge-impulse-blocks push
    
  4. 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.

How to test locally

  1. Install Docker for desktop.

  2. Build the container

    $ docker build -t transform-mix-noise .
    
  3. 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
    
  4. The out/ directory now contains 10 files.

Updating the background audio file

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.

About

Transformation block that mixes custom background noise into audio files


Languages

Language:Shell 70.7%Language:Dockerfile 29.3%