zh-plus / Open-Lyrics

Transcribe (whisper) and translate (gpt) voice into LRC file. 使用whisper和gpt来转录、翻译你的音频文件为LRC歌词文件。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open-Lyrics

Open-Lyrics is a Python library that transcribes voice files using faster-whisper, and translates/polishes the resulting text into .lrc files in the desired language using OpenAI-GPT.

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 to environment variable OPENAI_API_KEY.

  3. Install whisperx

    pip install git+https://github.com/m-bain/whisperx.git
  4. This project can be installed from PyPI:

    pip install openlrc

    or install directly from GitHub:

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

Usage

from openlrc import LRCer

lrcer = LRCer()
lrcer.run('./data/test.mp3', target_lang='zh-cn')  # Generate translated ./data/test.lrc with default translate prompt.

Todo

  • [Efficiency] Batched translate/polish for GPT request (enable contextual ability).
  • [Efficiency] Concurrent support for GPT request.
  • [Efficiency & Transcription Quality] Use whisperx for transcription.
  • [Translation Quality] Make translate prompt more robust according to https://github.com/openai/openai-cookbook.
  • [Usability] Automatically fix json encoder error using GPT.
  • [Efficiency] Asynchronously perform transcription and translation for multiple audio inputs.
  • [Usability] Multiple output format support.
  • [Efficiency] Add Azure OpenAI Service support.
  • [Usability] Add local LLM support.
  • [Others] Add transcribed examples.
    • Song
    • Podcast
    • Audiobook

Credits

About

Transcribe (whisper) and translate (gpt) voice into LRC file. 使用whisper和gpt来转录、翻译你的音频文件为LRC歌词文件。

License:MIT License


Languages

Language:Python 100.0%