Skip to main content

Python package for music source separation.

Project description

pymss

Python package for music source separation.

Install

Example of using pip to install pymss package:

pip install pymss

Usage

Here's a simple example.

from pymss MSSeparator, get_separation_logger

# init
separator = MSSeparator(
    model_type='htdemucs', 
    model_path='path/to/model',
    config_path='path/to/config',
    device='cuda',
    device_ids=[0],
    output_format='wav',
    use_tta=True,
    store_dirs={
        "vocals": "./output/vocals",
        "other": None # None or missing this stem will result in no output file for this stem. This example will output the vocal's stem in ./output/vocals and ignoring the other(instrumental) stem. Making sure the key(s) match the config file.
    },
    audio_params={"wav_bit_depth": "FLOAT", "flac_bit_depth": "PCM_24", "mp3_bit_rate": "320k"}, # Can be omitted
    logger=get_separation_logger(), # Can be omitted
    debug=False, # Can be omitted
    inference_params={
        "batch_size": 4,
        "num_overlap": 1,
        "chunk_size": 1024,
        "normalize": True
    } # Can be omitted
)

# process all audio files in the folder
separator.process_folder('path/to/input_folder')

Parameters

  • model_type: The type of model, e.g., 'htdemucs'. Must be one of ['bs_roformer', 'mel_band_roformer', 'segm_models', 'htdemucs', 'mdx23c', 'swin_upernet', 'bandit', 'bandit_v2', 'scnet', 'scnet_unofficial', 'torchseg', 'apollo', 'bs_mamba2']
  • model_path: The path to the model file.
  • config_path: The path to the configuration file.
  • device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'mps', 'cpu']
  • device_ids: List of device IDs, default is [0].
  • output_format: The output audio format, default is 'wav'. Must be one of ['wav', 'flac', 'mp3']
  • use_tta: Whether to use TTA, default is False. Using TTA will triple the processing time with a little bit improvement in quality.
  • store_dirs: Storage directories, can be a single folder path or a dictionary with instrument keys.
  • audio_params: Audio parameters including wav_bit_depth, flac_bit_depth, and mp3_bit_rate. Default is {"wav_bit_depth": "FLOAT", "flac_bit_depth": "PCM_24", "mp3_bit_rate": "320k"}.
  • logger: Logger instance. Default is pymss.get_separation_logger()
  • debug: Whether to enable debug mode, default is False.
  • inference_params: Inference parameters including batch_size, num_overlap, chunk_size, and normalize. Default is all None (means all params are depended on the config file).

Contributing

Contributions are welcome!

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

pymss-1.0.tar.gz (93.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymss-1.0-py3-none-any.whl (122.7 kB view details)

Uploaded Python 3

File details

Details for the file pymss-1.0.tar.gz.

File metadata

  • Download URL: pymss-1.0.tar.gz
  • Upload date:
  • Size: 93.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pymss-1.0.tar.gz
Algorithm Hash digest
SHA256 7d99b0d73d10a5f4e8b626c7215d5d98e95a0adf9a48a4306ec5925a95f1e613
MD5 2cb109b9bb01b0035ab9b39d6cf3d0ed
BLAKE2b-256 d33d3dfcc59bff7d44d8d7b04583f61d6fd2d1c2dd9cb3074464376d7761b5af

See more details on using hashes here.

File details

Details for the file pymss-1.0-py3-none-any.whl.

File metadata

  • Download URL: pymss-1.0-py3-none-any.whl
  • Upload date:
  • Size: 122.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pymss-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 108421ff01a00995c6771fa04d39f50fd0a842144cf2032203d0302016a2814d
MD5 c1934892e183f974f0b176ca2f931f1d
BLAKE2b-256 09abda73f0862887eeae3f8e3d3b428f491cbeb3f6ae195ef8a090dd63237df6

See more details on using hashes here.

Supported by

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