Skip to main content

an openai based game audio translator

Project description

openai-game-translator

ChatGPT API based video game audio translator application and web service

License GitHub issues build codecov PyPI Documentation Status Doc

Overview

A game translation app that uses the ChatGPT API to recognize in-game speech (TODO: and even game visuals) and provide smooth text translations on platforms like Switch and PS5, thanks to the powerful language abilities of GPT.

Prerequisites

If you don't already have local credentials setup for your AWS account, you can follow this guide for configuring them using the AWS CLI.

  • Since we use amazon-transcribe SDK, which is built on top of the AWS Common Runtime (CRT), non-standard operating systems may need to compile these libraries themselves.
  • Should at least set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables and in [default] profile ~/.aws/credentials.

Also, ensure that you have portaudio, which is a prerequisite for pyAudio

sudo apt install portaudio19-dev # linux
brew install portaudio # macos

Installation

Install the latest version from pip

pip install openai-game-translator

Install from github repository

git clone https://github.com/Erisae/openai-game-translator
cd openai-game-translator
make install

Quick Start

Terminal Usage

To translate audio to text in the terminal, use the command translate. The simplest way to achieve this is through AWS's real-time media transcription and GPT-based translation, as shown below:

translate --openai_key <openai_key> -i <input_language> -o <output_language> aws_live
  • <openai_key>: A valid OpenAI API key is required for inferencing GPT model to translate.
  • <input_language>: Language of the audio to be transcribed.
  • <output_language>: Target language for the translation.
  • aws_live: This option uses the AWS live stream transcription model, allowing the voice data stream to be uploaded to AWS services using the AWS SDK while recording the voice. Other available audio transcription models include aws_pre and xunfei, but they require additional arguments such as --file, --pre_recorded, and audio transcription API tokens from xunfei.
  • Note that aws_live, aws_pre, xunfei work as subcommands. Ensure that openai_key, input_language and output_language are assigned before running these subcommands, as otherwise the argument values might not be recognized correctly. For more information about how to use the package in command line, refer to the documentation.

Script Usage

In script, simply pass aws_live to initialize a gameTranslator, translator.openai_translation() will translate Chinese audio to English text.

import openai
from game_translator import gameTranslator

openai.api_key = "<openai_key>"
translator = gameTranslator("aws_live", input_language="chinese", output_language="english")
translator.openai_translation()

Contributing

See more at CONTRIBUTING.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai-game-translator-1.2.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

openai_game_translator-1.2.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file openai-game-translator-1.2.0.tar.gz.

File metadata

File hashes

Hashes for openai-game-translator-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3c312e4347bf33ed8e84d22c3b16f6a19189fcdba28f3d96432d1f1920f66081
MD5 ab4970c96e02c37e7389cf7b55ee4b47
BLAKE2b-256 4180ec7e969cb09f5e8b3f37c5fa89dd009cc97a621cc1865dd829da4fd5523d

See more details on using hashes here.

File details

Details for the file openai_game_translator-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openai_game_translator-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ef21aa8dc7c6ccbec242b9942cd233811fe9408625111547f17c377645f7f5
MD5 91cb2614ddfc500ddfa16a599453b035
BLAKE2b-256 11b01865321e792be914f95709dee40e9fcd0404acecf5f59a9f77923811761e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page