# 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!
Raw data
{
"_id": null,
"home_page": "https://github.com/KitsuneX07/pymss",
"name": "pymss",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "music source separation, audio separation, music processing, machine learning, audio",
"author": "KitsuneX07",
"author_email": "ghast1085654218@163.com",
"download_url": "https://files.pythonhosted.org/packages/d3/3d/3dfcc59bff7d44d8d7b04583f61d6fd2d1c2dd9cb3074464376d7761b5af/pymss-1.0.tar.gz",
"platform": null,
"description": "# pymss\r\n\r\nPython package for music source separation.\r\n\r\n\r\n## Install\r\n\r\nExample of using pip to install `pymss` package\uff1a\r\n\r\n```sh\r\npip install pymss\r\n```\r\n\r\n## Usage\r\n\r\nHere's a simple example.\r\n```python\r\nfrom pymss MSSeparator, get_separation_logger\r\n\r\n# init\r\nseparator = MSSeparator(\r\n model_type='htdemucs', \r\n model_path='path/to/model',\r\n config_path='path/to/config',\r\n device='cuda',\r\n device_ids=[0],\r\n output_format='wav',\r\n use_tta=True,\r\n store_dirs={\r\n \"vocals\": \"./output/vocals\",\r\n \"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.\r\n },\r\n audio_params={\"wav_bit_depth\": \"FLOAT\", \"flac_bit_depth\": \"PCM_24\", \"mp3_bit_rate\": \"320k\"}, # Can be omitted\r\n logger=get_separation_logger(), # Can be omitted\r\n debug=False, # Can be omitted\r\n inference_params={\r\n \"batch_size\": 4,\r\n \"num_overlap\": 1,\r\n \"chunk_size\": 1024,\r\n \"normalize\": True\r\n } # Can be omitted\r\n)\r\n\r\n# process all audio files in the folder\r\nseparator.process_folder('path/to/input_folder')\r\n```\r\n\r\n### Parameters\r\n\r\n- model_type: The type of model, e.g., 'htdemucs'. Must be one of \r\n ['bs_roformer', \r\n 'mel_band_roformer', \r\n 'segm_models', \r\n 'htdemucs', \r\n 'mdx23c', \r\n 'swin_upernet', \r\n 'bandit', \r\n 'bandit_v2', \r\n 'scnet', \r\n 'scnet_unofficial', \r\n 'torchseg', \r\n 'apollo', \r\n 'bs_mamba2']\r\n- model_path: The path to the model file.\r\n- config_path: The path to the configuration file.\r\n- device: The type of device, default is 'auto'. Must be one of ['auto', 'cuda', 'mps', 'cpu']\r\n- device_ids: List of device IDs, default is [0].\r\n- output_format: The output audio format, default is 'wav'. Must be one of ['wav', 'flac', 'mp3']\r\n- use_tta: Whether to use TTA, default is False. Using TTA will triple the processing time with a little bit improvement in quality.\r\n- store_dirs: Storage directories, can be a single folder path or a dictionary with instrument keys.\r\n- 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\"}.\r\n- logger: Logger instance. Default is pymss.get_separation_logger()\r\n- debug: Whether to enable debug mode, default is False.\r\n- 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).\r\n\r\n## Contributing\r\nContributions are welcome! \r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python package for music source separation.",
"version": "1.0",
"project_urls": {
"Bug Tracker": "https://github.com/KitsuneX07/pymss/issues",
"Documentation": "https://github.com/KitsuneX07/pymss/blob/main/README.md",
"Homepage": "https://github.com/KitsuneX07/pymss",
"Source Code": "https://github.com/KitsuneX07/pymss"
},
"split_keywords": [
"music source separation",
" audio separation",
" music processing",
" machine learning",
" audio"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "09abda73f0862887eeae3f8e3d3b428f491cbeb3f6ae195ef8a090dd63237df6",
"md5": "c1934892e183f974f0b176ca2f931f1d",
"sha256": "108421ff01a00995c6771fa04d39f50fd0a842144cf2032203d0302016a2814d"
},
"downloads": -1,
"filename": "pymss-1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c1934892e183f974f0b176ca2f931f1d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 122726,
"upload_time": "2025-01-28T06:30:28",
"upload_time_iso_8601": "2025-01-28T06:30:28.628757Z",
"url": "https://files.pythonhosted.org/packages/09/ab/da73f0862887eeae3f8e3d3b428f491cbeb3f6ae195ef8a090dd63237df6/pymss-1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d33d3dfcc59bff7d44d8d7b04583f61d6fd2d1c2dd9cb3074464376d7761b5af",
"md5": "2cb109b9bb01b0035ab9b39d6cf3d0ed",
"sha256": "7d99b0d73d10a5f4e8b626c7215d5d98e95a0adf9a48a4306ec5925a95f1e613"
},
"downloads": -1,
"filename": "pymss-1.0.tar.gz",
"has_sig": false,
"md5_digest": "2cb109b9bb01b0035ab9b39d6cf3d0ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 93544,
"upload_time": "2025-01-28T06:30:30",
"upload_time_iso_8601": "2025-01-28T06:30:30.449036Z",
"url": "https://files.pythonhosted.org/packages/d3/3d/3dfcc59bff7d44d8d7b04583f61d6fd2d1c2dd9cb3074464376d7761b5af/pymss-1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-28 06:30:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "KitsuneX07",
"github_project": "pymss",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pymss"
}