Skip to main content

Data augmentation for source separation models

Project description

stem_mixer

Create coherent mixtures from a folder with any provided stems. The package will infer the needed metadata from the audio files and use it to create mixtures. This package currently only supports .wav audio files.

This package aims to increase the diversity of instruments in mixtures used to train source-separation models.

Installation

pip install stem_mixer

Our library relies on python-soundfile for writing files, which relies on libsndfile.

Usage

Metadata and Feature Extraction

For every stem, we will calculate features and save them on a .json file.

python script/metadata.py
--data_home=<path_to_stems>
--datasets="brid","musdb"

if you want to manually call the extraction function to overwrite metadata:

from metadata import extraction

# define the path to your audio stem file
stem_path = "path/to/your/stem/file.wav"

# optionally, provide pre-computed metadata
metadata = {
    "stem_name": stem_name,
    "data_home": data_home,
    "tempo": tempo,
    "key": key,
    "sound_class": sound_class
}

extraction(stem_path, track_metadata=metadata, overwrite=True)

to see other variables available, please run

Supported Datasets

While we infer features, we support some datasets for which we can infer features from names information.

*note: if using MUSDB18, pre-pre-processing step required -->

  • must save each stem with "vocals", "drums", "bass", "other" as prefix in .wav filename
  • i.e. Detsky Sad - Walkie Talkie - drums.wav
  • i.e. Triviul - Angelsaint - vocals.wav
  • i.e. PR - Happy Daze - bass.wav
  • i.e. Voelund - Comfort Lives In Belief - other.wav

Mixture Creation

Tests

first make sure pytest is installed:

pip install pytest

if you would like to run our implemented tests of the metadata module, first navigate to your script folder and then do the following:

pytest ../tests/test_md.py

If you would like to run our implemented tests of the preprocessing module, first navigate to your script folder and then do the following:

pytest ../tests/test_pre.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stem_mixer-0.1.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

stem_mixer-0.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file stem_mixer-0.1.0.tar.gz.

File metadata

  • Download URL: stem_mixer-0.1.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for stem_mixer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29c7460710d0807664e3eb9445aafd306afb6610e6727fa247493bb766a59070
MD5 a13a3a8820ed79fef6b5c6802094343b
BLAKE2b-256 7e6442c5a34f03a10541136ea72b15e7be7657227e23bb02ca48f47dcba66379

See more details on using hashes here.

File details

Details for the file stem_mixer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stem_mixer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for stem_mixer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d32b09443531d6ad43033c7a6c270bb512f0196e6cd8838a7e03e0ab9cff2e3a
MD5 adccf2a0fc3533184e6654d0e93a383e
BLAKE2b-256 78ae95e8193181704c6cad03094ec58800fe0b4d091e345f07863a806a099b21

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page