DubSplitter


NameDubSplitter JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/defisym/HibiscusAVGEngine/tree/main/Utilities/DubSplitter
Summaryan easy tool to split dubs based on given silence
upload_time2023-11-02 10:18:29
maintainer
docs_urlNone
authordefisym
requires_python
licenseMIT
keywords dubsplitter dub splitter hibiscus avg galgame visualnovel vn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DubSplitter

## Description

an easy tool to split dubs based on given silence

![Screenshot](https://github.com/defisym/HibiscusAVGEngine/blob/main/Utilities/DubSplitter/Screenshot.png?raw=true)

## Params

| Command              | Type   | Info                                                                                                                                                                                                                                                                                |
|----------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| -f, --fileName       | option | file to process                                                                                                                                                                                                                                                                     |
| -o, --outFilePath    | option | output folder, if not set, will use `scriptPath + \\Out\\` (as script), or `userPath + \\DubSplitter\\Out\\` (as package)                                                                                                                                                           |
| --outFileFormat      | option | output format, default is `ogg`                                                                                                                                                                                                                                                     |
| --fileNameFormat     | option | output file name format                                                                                                                                                                                                                                                             |
| --fileNameVRFormat   | option | output file name format with voice recognition                                                                                                                                                                                                                                      |
| --fileNameCustomInfo | option | custom info for output file name, default is `''`                                                                                                                                                                                                                                   |
| -s, --silence        | option | silence time, in ms, default is `1000`ms                                                                                                                                                                                                                                            |
| -r, --range          | option | range, default is `100`ms. e.g., silence = `400`, range = `100` will slice in `400`ms and `500`ms                                                                                                                                                                                   |
| --step               | option | loop step, default is `100`ms                                                                                                                                                                                                                                                       |
| --threshold          | option | anything quieter than this will be considered silence, default is `-40`db                                                                                                                                                                                                           |
| --keepSilence        | option | leave some silence at the beginning and end of the chunks. Keeps the sound from sounding like it is abruptly cut off. When the length of the silence is less than the given duration it is split evenly between the preceding and following non-silent segments, default is `100`ms |
| --noVR               | option | don't use voice recognition, default is `false`                                                                                                                                                                                                                                     |
| --model              | option | whisper model, default is `base`                                                                                                                                                                                                                                                    |
| --prompt             | option | init prompt used in whisper, default is `简体中文`                                                                                                                                                                                                                                      |
| --language           | option | language used in whisper, default is `chinese`                                                                                                                                                                                                                                      |
| --omitLen            | option | recognize result will omit middle characters if longer than given, `len <=0` -> do nothing, default is `20`                                                                                                                                                                         |
| --log                | option | output detailed log instead of progress bar, default is false                                                                                                                                                                                                                       |

## Usage

open folder in terminal, then run `python main.py`

or use command `pip install DubSplitter` to install [package](https://pypi.org/project/DubSplitter/), then
run `dubSplitter`

## Custom File Name

### Basic

`fileNameFormat` & `fileNameVRFormat` receives a format string, you can reference
the [formatting syntax doc](https://docs.python.org/3/tutorial/inputoutput.html#the-string-format-method) then write
your own one.

files will firstly be outputted in the format of `fileNameFormat`. If the script needs to do voice recognition, then the
file will be renamed to `fileNameVRFormat`

### File Name Format

default is `{2:0>4d}_{3:0>8d}.{1}`

| String              | Index | 
|---------------------|-------|
| custom info         | 0     | 
| output format       | 1     | 
| silence             | 2     | 
| loop index          | 3     | 
| ms time stamp start | 4     | 
| ms time stamp end   | 5     | 
| time stamp start    | 6     | 
| time stamp end      | 7     | 

`custom info` is the one you passed in `fileNameCustomInfo`

### File Name Format (with voice recognition)

default is `{2:0>4d}_{3:0>8d}_{5}.{1}`

| String              | Index | 
|---------------------|-------|
| custom info         | 0     | 
| output format       | 1     | 
| silence             | 2     | 
| loop index          | 3     | 
| recognize_result    | 4     | 
| text                | 5     | 
| ms time stamp start | 6     | 
| ms time stamp end   | 7     | 
| time stamp start    | 8     | 
| time stamp end      | 9     | 

`custom info` is the one you passed in `fileNameCustomInfo`

`text` is the process result of `recognize_result`, by omitting middle characters, and escaping invalid characters
like `\\`, `/`, `*`, `?`, `<`, `>`, `|`

## Note

### Whisper GPU

if whisper doesn't use GPU, you need to uninstall CPU version first then install GPU version

```shell
pip uninstall torch
pip cache purge
# from https://pytorch.org/get-started/locally/
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
```

### Whisper prompt

[document](https://platform.openai.com/docs/guides/speech-to-text/prompting)

example:

use `--prompt 简体中文` -> `真辛苦真辛苦啊 我会跳个好天气出去运动的`

use `--prompt 正體中文` -> `真辛苦真辛苦啊我會跳個好天氣出去運動的`

## Changelog

### 231102 0.7.0

- time stamp usable in custom file format

### 231027 0.6.0

- progress bar
- auto skip output routine if new silence has the same count comparing to previous one

### 231022 0.5.0

- iterate all files if input path is a folder

### 230520 0.4.0

- set silence threshold & keep silence length

### 230412 0.3.0

- add color for outputs
- add custom file format support
- add custom filename format support
- add prompt support
- add omit len option

### 230407 0.2.1

- use `AudioSegment.from_file` to support more file type
- load file before load model as file error happens more often
- remove unnecessary info & fix typo

### 230407 0.2.0

- print version when boot

### 230407 0.1.3

- fix typo

### 230407 0.1.2

- optimize `update_path`

### 230407 0.1.1

- update readme

### 230407 0.1.0

- init release

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/defisym/HibiscusAVGEngine/tree/main/Utilities/DubSplitter",
    "name": "DubSplitter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "DubSplitter dub splitter Hibiscus AVG Galgame VisualNovel VN",
    "author": "defisym",
    "author_email": "defisym@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/8e/9bdc9eed9ba9e87708de448e84b89ef1199cea8617dc3eaad58ee1e3a9fa/DubSplitter-0.7.0.tar.gz",
    "platform": null,
    "description": "# DubSplitter\r\n\r\n## Description\r\n\r\nan easy tool to split dubs based on given silence\r\n\r\n![Screenshot](https://github.com/defisym/HibiscusAVGEngine/blob/main/Utilities/DubSplitter/Screenshot.png?raw=true)\r\n\r\n## Params\r\n\r\n| Command              | Type   | Info                                                                                                                                                                                                                                                                                |\r\n|----------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\r\n| -f, --fileName       | option | file to process                                                                                                                                                                                                                                                                     |\r\n| -o, --outFilePath    | option | output folder, if not set, will use `scriptPath + \\\\Out\\\\` (as script), or `userPath + \\\\DubSplitter\\\\Out\\\\` (as package)                                                                                                                                                           |\r\n| --outFileFormat      | option | output format, default is `ogg`                                                                                                                                                                                                                                                     |\r\n| --fileNameFormat     | option | output file name format                                                                                                                                                                                                                                                             |\r\n| --fileNameVRFormat   | option | output file name format with voice recognition                                                                                                                                                                                                                                      |\r\n| --fileNameCustomInfo | option | custom info for output file name, default is `''`                                                                                                                                                                                                                                   |\r\n| -s, --silence        | option | silence time, in ms, default is `1000`ms                                                                                                                                                                                                                                            |\r\n| -r, --range          | option | range, default is `100`ms. e.g., silence = `400`, range = `100` will slice in `400`ms and `500`ms                                                                                                                                                                                   |\r\n| --step               | option | loop step, default is `100`ms                                                                                                                                                                                                                                                       |\r\n| --threshold          | option | anything quieter than this will be considered silence, default is `-40`db                                                                                                                                                                                                           |\r\n| --keepSilence        | option | leave some silence at the beginning and end of the chunks. Keeps the sound from sounding like it is abruptly cut off. When the length of the silence is less than the given duration it is split evenly between the preceding and following non-silent segments, default is `100`ms |\r\n| --noVR               | option | don't use voice recognition, default is `false`                                                                                                                                                                                                                                     |\r\n| --model              | option | whisper model, default is `base`                                                                                                                                                                                                                                                    |\r\n| --prompt             | option | init prompt used in whisper, default is `\u7b80\u4f53\u4e2d\u6587`                                                                                                                                                                                                                                      |\r\n| --language           | option | language used in whisper, default is `chinese`                                                                                                                                                                                                                                      |\r\n| --omitLen            | option | recognize result will omit middle characters if longer than given, `len <=0` -> do nothing, default is `20`                                                                                                                                                                         |\r\n| --log                | option | output detailed log instead of progress bar, default is false                                                                                                                                                                                                                       |\r\n\r\n## Usage\r\n\r\nopen folder in terminal, then run `python main.py`\r\n\r\nor use command `pip install DubSplitter` to install [package](https://pypi.org/project/DubSplitter/), then\r\nrun `dubSplitter`\r\n\r\n## Custom File Name\r\n\r\n### Basic\r\n\r\n`fileNameFormat` & `fileNameVRFormat` receives a format string, you can reference\r\nthe [formatting syntax doc](https://docs.python.org/3/tutorial/inputoutput.html#the-string-format-method) then write\r\nyour own one.\r\n\r\nfiles will firstly be outputted in the format of `fileNameFormat`. If the script needs to do voice recognition, then the\r\nfile will be renamed to `fileNameVRFormat`\r\n\r\n### File Name Format\r\n\r\ndefault is `{2:0>4d}_{3:0>8d}.{1}`\r\n\r\n| String              | Index | \r\n|---------------------|-------|\r\n| custom info         | 0     | \r\n| output format       | 1     | \r\n| silence             | 2     | \r\n| loop index          | 3     | \r\n| ms time stamp start | 4     | \r\n| ms time stamp end   | 5     | \r\n| time stamp start    | 6     | \r\n| time stamp end      | 7     | \r\n\r\n`custom info` is the one you passed in `fileNameCustomInfo`\r\n\r\n### File Name Format (with voice recognition)\r\n\r\ndefault is `{2:0>4d}_{3:0>8d}_{5}.{1}`\r\n\r\n| String              | Index | \r\n|---------------------|-------|\r\n| custom info         | 0     | \r\n| output format       | 1     | \r\n| silence             | 2     | \r\n| loop index          | 3     | \r\n| recognize_result    | 4     | \r\n| text                | 5     | \r\n| ms time stamp start | 6     | \r\n| ms time stamp end   | 7     | \r\n| time stamp start    | 8     | \r\n| time stamp end      | 9     | \r\n\r\n`custom info` is the one you passed in `fileNameCustomInfo`\r\n\r\n`text` is the process result of `recognize_result`, by omitting middle characters, and escaping invalid characters\r\nlike `\\\\`, `/`, `*`, `?`, `<`, `>`, `|`\r\n\r\n## Note\r\n\r\n### Whisper GPU\r\n\r\nif whisper doesn't use GPU, you need to uninstall CPU version first then install GPU version\r\n\r\n```shell\r\npip uninstall torch\r\npip cache purge\r\n# from https://pytorch.org/get-started/locally/\r\npip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117\r\n```\r\n\r\n### Whisper prompt\r\n\r\n[document](https://platform.openai.com/docs/guides/speech-to-text/prompting)\r\n\r\nexample:\r\n\r\nuse `--prompt \u7b80\u4f53\u4e2d\u6587` -> `\u771f\u8f9b\u82e6\u771f\u8f9b\u82e6\u554a \u6211\u4f1a\u8df3\u4e2a\u597d\u5929\u6c14\u51fa\u53bb\u8fd0\u52a8\u7684`\r\n\r\nuse `--prompt \u6b63\u9ad4\u4e2d\u6587` -> `\u771f\u8f9b\u82e6\u771f\u8f9b\u82e6\u554a\u6211\u6703\u8df3\u500b\u597d\u5929\u6c23\u51fa\u53bb\u904b\u52d5\u7684`\r\n\r\n## Changelog\r\n\r\n### 231102 0.7.0\r\n\r\n- time stamp usable in custom file format\r\n\r\n### 231027 0.6.0\r\n\r\n- progress bar\r\n- auto skip output routine if new silence has the same count comparing to previous one\r\n\r\n### 231022 0.5.0\r\n\r\n- iterate all files if input path is a folder\r\n\r\n### 230520 0.4.0\r\n\r\n- set silence threshold & keep silence length\r\n\r\n### 230412 0.3.0\r\n\r\n- add color for outputs\r\n- add custom file format support\r\n- add custom filename format support\r\n- add prompt support\r\n- add omit len option\r\n\r\n### 230407 0.2.1\r\n\r\n- use `AudioSegment.from_file` to support more file type\r\n- load file before load model as file error happens more often\r\n- remove unnecessary info & fix typo\r\n\r\n### 230407 0.2.0\r\n\r\n- print version when boot\r\n\r\n### 230407 0.1.3\r\n\r\n- fix typo\r\n\r\n### 230407 0.1.2\r\n\r\n- optimize `update_path`\r\n\r\n### 230407 0.1.1\r\n\r\n- update readme\r\n\r\n### 230407 0.1.0\r\n\r\n- init release\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "an easy tool to split dubs based on given silence",
    "version": "0.7.0",
    "project_urls": {
        "Homepage": "https://github.com/defisym/HibiscusAVGEngine/tree/main/Utilities/DubSplitter"
    },
    "split_keywords": [
        "dubsplitter",
        "dub",
        "splitter",
        "hibiscus",
        "avg",
        "galgame",
        "visualnovel",
        "vn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c68aec18951f022401fa64feb0f63e679d63aac716d53e34a47923ef08a125a",
                "md5": "043d4ce422be35e1824cfd6cdeba2f03",
                "sha256": "20a290cfda63554c81154b5e3674d5451625e011ce73c91a8df6b8ca6f531d59"
            },
            "downloads": -1,
            "filename": "DubSplitter-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "043d4ce422be35e1824cfd6cdeba2f03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12737,
            "upload_time": "2023-11-02T10:18:27",
            "upload_time_iso_8601": "2023-11-02T10:18:27.328825Z",
            "url": "https://files.pythonhosted.org/packages/5c/68/aec18951f022401fa64feb0f63e679d63aac716d53e34a47923ef08a125a/DubSplitter-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb8e9bdc9eed9ba9e87708de448e84b89ef1199cea8617dc3eaad58ee1e3a9fa",
                "md5": "114db1a052109743fb728b68f952bcc4",
                "sha256": "6cab5e242a36dacfb039896a0095905f62e51c5c5a7294a9a49be2879b37f7ef"
            },
            "downloads": -1,
            "filename": "DubSplitter-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "114db1a052109743fb728b68f952bcc4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10288,
            "upload_time": "2023-11-02T10:18:29",
            "upload_time_iso_8601": "2023-11-02T10:18:29.292336Z",
            "url": "https://files.pythonhosted.org/packages/fb/8e/9bdc9eed9ba9e87708de448e84b89ef1199cea8617dc3eaad58ee1e3a9fa/DubSplitter-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-02 10:18:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "defisym",
    "github_project": "HibiscusAVGEngine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dubsplitter"
}
        
Elapsed time: 0.13528s