Metadata-Version: 2.1
Name: pymss
Version: 1.0
Summary: Python package for music source separation.
Home-page: https://github.com/KitsuneX07/pymss
Author: KitsuneX07
Author-email: ghast1085654218@163.com
License: MIT
Project-URL: Bug Tracker, https://github.com/KitsuneX07/pymss/issues
Project-URL: Source Code, https://github.com/KitsuneX07/pymss
Project-URL: Documentation, https://github.com/KitsuneX07/pymss/blob/main/README.md
Keywords: music source separation,audio separation,music processing,machine learning,audio
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydub
Requires-Dist: numpy
Requires-Dist: torch
Requires-Dist: torchaudio
Requires-Dist: librosa
Requires-Dist: soundfile
Requires-Dist: tqdm
Requires-Dist: ml-collections
Requires-Dist: omegaconf
Requires-Dist: pyyaml
Requires-Dist: demucs
Requires-Dist: colorama
Requires-Dist: pytorch_lightning
Requires-Dist: asteroid
Requires-Dist: spafe
Requires-Dist: pedalboard
Requires-Dist: torch_audiomentations
Requires-Dist: beartype
Requires-Dist: rotary_embedding_torch
Requires-Dist: transformers
Requires-Dist: segmentation_models_pytorch

# pymss

Python package for music source separation.


## Install

Example of using pip to install `pymss` package：

```sh
pip install pymss
```

## Usage

Here's a simple example.
```python
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! 
