# PAFTS
---
### Library That Preprocessing Audio For TTS.
This library enables easy processing of audio files into a format suitable for TTS training data with a simple execution.
## Description
PAFTS have three features.
1. Separator
2. Diarization
3. STT
* Separator : Removes background music (MR) and noise from each audio file to isolate clean voice tracks.
* Diarization : Separates speakers within each audio file, identifying distinct voices.
* STT : Extract text from audio.
```
# before run()
path
├── 1_001.wav # have mr or noise
├── 1_002.wav
├── 1_003.wav
├── 1_004.wav
└── abc.wav
# after run()
path
├── SPEAKER_00
│ ├── SPEAKER_00_1.wav # removed mr and noise
│ ├── SPEAKER_00_2.wav
│ └── SPEAKER_00_3.wav
├── SPEAKER_01
│ ├── SPEAKER_01_1.wav
│ └── SPEAKER_01_2.wav
├── SPEAKER_02
│ ├── SPEAKER_02_1.wav
│ └── SPEAKER_02_2.wav
└── audio.json
# audio.json
{
'SPEAKER_00_1.wav' : "I have a note.",
'SPEAKER_00_2.wav' : "I want to eat chicken.",
'SPEAKER_00_3.wav' : "...",
'SPEAKER_01_1.wav' : "...",
'SPEAKER_01_2.wav' : "...",
}
```
## Features
* Separator : Using the [UVR](https://github.com/Anjok07/ultimatevocalremovergui) project’s model and code for music source separation.
* Diarization : Using speaker diarization from [pyannote-audio](https://github.com/pyannote/pyannote-audio)
* STT : Using STT model whisper from [OpenAI](https://github.com/openai/whisper)
## Setup
This library was developed using Python 3.10, and we recommend using Python versions 3.8 to 3.10 for compatibility.
While the library is compatible with both Linux and Windows, all testing was conducted on Windows.
For any issues or errors encountered while running on Linux, please feel free to open an issue.
Before running the library, please ensure the following are installed:
### PyTorch
We highly recommend using a GPU to optimize performance. For PyTorch installation, please follow the commands below to ensure compatibility with your GPU
```
# Example for installing PyTorch with CUDA 11.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
```
### ffmpeg
[ffmpeg](https://ffmpeg.org/) is required for audio processing tasks within this library. Please ensure it is installed and accessible from your system’s PATH.
To install ffmpeg:
#### Windows
Download the latest FFmpeg release from [FFmpeg’s official website](https://ffmpeg.org/download.html), and add the bin folder to your system’s PATH.
#### Linux
Use the following command to install FFmpeg:
```
sudo apt update
sudo apt install ffmpeg
```
After installation, you can verify by running
```
ffmpeg -version
```
### HuggingFace Access Token (required for diarization)
To enable diarization functionality, please complete the following steps
1. Accept [`pyannote/segmentation-3.0`](https://huggingface.co/pyannote/segmentation-3.0) user conditions
2. Accept [`pyannote/speaker-diarization-3.1`](https://huggingface.co/pyannote/speaker-diarization-3.1) user conditions
3. Create access token at [`hf.co/settings/tokens`](https://huggingface.co/login?next=%2Fsettings%2Ftokens).
```
from pafts.pafts import PAFTS
p = PAFTS(
path = 'your_audio_directory_path',
output_path = 'output_path',
hf_token="HUGGINGFACE_ACCESS_TOKEN_GOES_HERE"
)
```
After completing the setup steps above, you can install this library by running
```
pip install pafts
```
## Usage
```
from pafts import PAFTS
p = PAFTS(
path = 'your_audio_directory_path',
output_path = 'output_path',
hf_token="HUGGINGFACE_ACCESS_TOKEN_GOES_HERE" # if you use diarization
)
# Separator
p.separator()
# Diarization
p.diarization()
# STT
p.STT(model_size='small')
# One-Click Process
p.run()
```
## TODO
- [ ] Command line
- [ ] Clean logging
- [ ] Separator with Model Selection
- [ ] Update README.md
- [ ] Add VAD
## License
The code of **PAFTS** is [MIT-licensed](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/harmlessman/PAFTS",
"name": "pafts",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.11,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "harmlessman",
"author_email": "harmlessman17@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/03/b2/b1127d1869a908255f1628ccd6be463e58cf9eed6e9e59dd020a1b714736/pafts-1.0.1.tar.gz",
"platform": null,
"description": "# PAFTS\r\n\r\n\r\n---\r\n\r\n### Library That Preprocessing Audio For TTS.\r\nThis library enables easy processing of audio files into a format suitable for TTS training data with a simple execution.\r\n\r\n\r\n## Description \r\nPAFTS have three features.\r\n\r\n1. Separator\r\n2. Diarization\r\n3. STT\r\n\r\n* Separator : Removes background music (MR) and noise from each audio file to isolate clean voice tracks.\r\n* Diarization : Separates speakers within each audio file, identifying distinct voices.\r\n* STT : Extract text from audio.\r\n\r\n\r\n\r\n\r\n```\r\n# before run()\r\n\r\n path\r\n \u251c\u2500\u2500 1_001.wav # have mr or noise\r\n \u251c\u2500\u2500 1_002.wav\r\n \u251c\u2500\u2500 1_003.wav\r\n \u251c\u2500\u2500 1_004.wav\r\n \u2514\u2500\u2500 abc.wav\r\n\r\n\r\n# after run()\r\n \r\n path\r\n \u251c\u2500\u2500 SPEAKER_00\r\n \u2502 \u251c\u2500\u2500 SPEAKER_00_1.wav # removed mr and noise\r\n \u2502 \u251c\u2500\u2500 SPEAKER_00_2.wav\r\n \u2502 \u2514\u2500\u2500 SPEAKER_00_3.wav\r\n \u251c\u2500\u2500 SPEAKER_01\r\n \u2502 \u251c\u2500\u2500 SPEAKER_01_1.wav\r\n \u2502 \u2514\u2500\u2500 SPEAKER_01_2.wav\r\n \u251c\u2500\u2500 SPEAKER_02\r\n \u2502 \u251c\u2500\u2500 SPEAKER_02_1.wav\r\n \u2502 \u2514\u2500\u2500 SPEAKER_02_2.wav\r\n \u2514\u2500\u2500 audio.json\r\n \r\n # audio.json\r\n {\r\n 'SPEAKER_00_1.wav' : \"I have a note.\", \r\n 'SPEAKER_00_2.wav' : \"I want to eat chicken.\",\r\n 'SPEAKER_00_3.wav' : \"...\",\r\n 'SPEAKER_01_1.wav' : \"...\",\r\n 'SPEAKER_01_2.wav' : \"...\", \r\n }\r\n```\r\n\r\n\r\n## Features\r\n* Separator : Using the [UVR](https://github.com/Anjok07/ultimatevocalremovergui) project\u2019s model and code for music source separation.\r\n* Diarization : Using speaker diarization from [pyannote-audio](https://github.com/pyannote/pyannote-audio)\r\n* STT : Using STT model whisper from [OpenAI](https://github.com/openai/whisper)\r\n\r\n\r\n## Setup\r\nThis library was developed using Python 3.10, and we recommend using Python versions 3.8 to 3.10 for compatibility.\r\n\r\nWhile the library is compatible with both Linux and Windows, all testing was conducted on Windows. \r\nFor any issues or errors encountered while running on Linux, please feel free to open an issue.\r\n\r\nBefore running the library, please ensure the following are installed:\r\n\r\n### PyTorch\r\nWe highly recommend using a GPU to optimize performance. For PyTorch installation, please follow the commands below to ensure compatibility with your GPU\r\n```\r\n# Example for installing PyTorch with CUDA 11.8\r\npip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118\r\n```\r\n\r\n### ffmpeg\r\n[ffmpeg](https://ffmpeg.org/) is required for audio processing tasks within this library. Please ensure it is installed and accessible from your system\u2019s PATH.\r\nTo install ffmpeg:\r\n\r\n#### Windows\r\nDownload the latest FFmpeg release from [FFmpeg\u2019s official website](https://ffmpeg.org/download.html), and add the bin folder to your system\u2019s PATH.\r\n\r\n#### Linux \r\nUse the following command to install FFmpeg:\r\n```\r\nsudo apt update\r\nsudo apt install ffmpeg\r\n```\r\n\r\nAfter installation, you can verify by running\r\n```\r\nffmpeg -version\r\n```\r\n\r\n\r\n### HuggingFace Access Token (required for diarization)\r\nTo enable diarization functionality, please complete the following steps\r\n1. Accept [`pyannote/segmentation-3.0`](https://huggingface.co/pyannote/segmentation-3.0) user conditions\r\n2. Accept [`pyannote/speaker-diarization-3.1`](https://huggingface.co/pyannote/speaker-diarization-3.1) user conditions\r\n3. Create access token at [`hf.co/settings/tokens`](https://huggingface.co/login?next=%2Fsettings%2Ftokens).\r\n\r\n```\r\nfrom pafts.pafts import PAFTS\r\n\r\np = PAFTS(\r\n path = 'your_audio_directory_path',\r\n output_path = 'output_path',\r\n hf_token=\"HUGGINGFACE_ACCESS_TOKEN_GOES_HERE\"\r\n)\r\n\r\n```\r\n\r\nAfter completing the setup steps above, you can install this library by running\r\n```\r\npip install pafts\r\n```\r\n\r\n\r\n## Usage\r\n```\r\nfrom pafts import PAFTS\r\n\r\np = PAFTS(\r\n path = 'your_audio_directory_path',\r\n output_path = 'output_path',\r\n hf_token=\"HUGGINGFACE_ACCESS_TOKEN_GOES_HERE\" # if you use diarization\r\n \r\n)\r\n\r\n# Separator\r\np.separator()\r\n\r\n# Diarization\r\np.diarization()\r\n\r\n# STT\r\np.STT(model_size='small')\r\n\r\n# One-Click Process\r\np.run()\r\n\r\n```\r\n\r\n## TODO\r\n- [ ] Command line\r\n- [ ] Clean logging\r\n- [ ] Separator with Model Selection\r\n- [ ] Update README.md\r\n- [ ] Add VAD\r\n\r\n## License\r\n\r\nThe code of **PAFTS** is [MIT-licensed](LICENSE)\r\n\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Library That Preprocessing Audio For TTS.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/harmlessman/PAFTS"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9961a103ef243cb54de6baf9900c7279e6a2909ce52d301e696d7e4686197677",
"md5": "a0026d8402b886ad7c89ebc00b54fcb9",
"sha256": "f6d1398c89fb586d9ee5238272e97e15f8e18921f22f7f6a2c7b5cd16119f093"
},
"downloads": -1,
"filename": "pafts-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a0026d8402b886ad7c89ebc00b54fcb9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.11,>=3.10",
"size": 151077,
"upload_time": "2024-11-11T00:58:14",
"upload_time_iso_8601": "2024-11-11T00:58:14.942063Z",
"url": "https://files.pythonhosted.org/packages/99/61/a103ef243cb54de6baf9900c7279e6a2909ce52d301e696d7e4686197677/pafts-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "03b2b1127d1869a908255f1628ccd6be463e58cf9eed6e9e59dd020a1b714736",
"md5": "6f13c9f1d2a3321d2ae3d6c7cde713ef",
"sha256": "22a9277ae170a120a0378a4787db346fed71b1a89631474f1501ef23d0c26579"
},
"downloads": -1,
"filename": "pafts-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "6f13c9f1d2a3321d2ae3d6c7cde713ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.11,>=3.10",
"size": 119107,
"upload_time": "2024-11-11T00:58:16",
"upload_time_iso_8601": "2024-11-11T00:58:16.851089Z",
"url": "https://files.pythonhosted.org/packages/03/b2/b1127d1869a908255f1628ccd6be463e58cf9eed6e9e59dd020a1b714736/pafts-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-11 00:58:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "harmlessman",
"github_project": "PAFTS",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pafts"
}