Metadata-Version: 2.1
Name: openlrc
Version: 0.0.6
Summary: Transcribe (whisper) and translate (gpt) voice into LRC file.
Home-page: https://github.com/zh-plus/Open-Lyrics
License: MIT
Keywords: openai-gpt3,whisper,voice transcribe,lrc
Author: Hao Zheng
Author-email: zhenghaosustc@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Topic :: Scientific/Engineering
Requires-Dist: faster-whisper (>=0.6.0,<0.7.0)
Requires-Dist: langcodes (>=3.3.0,<4.0.0)
Requires-Dist: language-data (>=1.1,<2.0)
Requires-Dist: librosa (>=0.10.0,<0.11.0)
Requires-Dist: openai (>=0.27.6,<0.28.0)
Requires-Dist: opencc (>=1.1.1,<2.0.0)
Requires-Dist: rich (>=12.6.0,<13.0.0)
Requires-Dist: tiktoken (>=0.3.1,<0.4.0)
Requires-Dist: tqdm (>=4.65.0,<5.0.0)
Project-URL: Bug Tracker, https://github.com/zh-plus/Open-Lyrics/issues
Description-Content-Type: text/markdown

# Open-Lyrics

Open-Lyrics is a Python library that transcribes voice files using
[faster-whisper](https://github.com/guillaumekln/faster-whisper), and translates/polishes the resulting text
into `.lrc` files in the desired language using [OpenAI-GPT](https://github.com/openai/openai-python).

**This new project is rapidly underway, and we welcome any issues or pull requests.**

## Installation

1. Please install CUDA and cuDNN first according to https://opennmt.net/CTranslate2/installation.html to
   enable `faster-whisper`.

2. Add your [OpenAI API key](https://platform.openai.com/account/api-keys) to environment variable `OPENAI_API_KEY`.

3. Install [whisperx](https://github.com/m-bain/whisperX)

    ```shell
    pip install git+https://github.com/m-bain/whisperx.git
    ```

4. This project can be installed from PyPI:

    ```shell
    pip install openlrc
    ```

   or install directly from GitHub:

    ```shell
    pip install git+https://github.com/zh-plus/Open-Lyrics
    ```

## Usage

```python
from openlrc import LRCer

lrcer = LRCer()
lrcer('./data/test.mp3', target_lang='zh-cn')  # Generate translated ./data/test.lrc with default translate prompt.
# lrcer('./data/test.mp3', prompter='lovely_trans')  # Generate ./data/test.lrc with lovely colloquial expressions.
```

## Todo

- [x] Batched translate/polish for GPT request (enable contextual ability).
- [x] Concurrent support for GPT request.
- [x] Use [whisperx](https://github.com/m-bain/whisperX) for transcription.
- [ ] Automatically fix json encoder error using GPT.
- [ ] Make translate prompt more robust.
- [ ] Add local LLM support.
- [ ] Add transcribed examples.
    - [ ] Song
    - [ ] Podcast
    - [ ] Audiobook

## Credits

- https://github.com/guillaumekln/faster-whisper
- https://github.com/openai/openai-python
- https://github.com/openai/whisper
