referenceFree

one_way_translation_using_realtime_api

This project demonstrates how to use the [OpenAI Realtime API](https://platform.openai.com/docs/guides/realtime) to build a one-way translation application with WebSockets. It is implemented using the [Realtime + Websockets integration](https://platform.openai.com/docs/guides/realtime-websocket). A real-world use case for this demo is multilingual, conversational translation—where a speaker talks

Translation Demo

This project demonstrates how to use the OpenAI Realtime API to build a one-way translation application with WebSockets. It is implemented using the Realtime + Websockets integration. A real-world use case for this demo is multilingual, conversational translation—where a speaker talks into the speaker app and listeners hear translations in their selected native languages via the listener app. Imagine a conference room with multiple participants with headphones, listening live to a speaker in their own languages. Due to the current turn-based nature of audio models, the speaker must pause briefly to allow the model to process and translate speech. However, as models become faster and more efficient, this latency will decrease significantly and the translation will become more seamless.

How to Use

Running the Application

  1. Set up the OpenAI API:

  2. Clone the Repository:

    git clone <repository-url>
    
  3. Set your API key:

    • Create a .env file at the root of the project and add the following line:
      REACT_APP_OPENAI_API_KEY=<your_api_key>
      
  4. Install dependencies:

    Navigate to the project directory and run:

    npm install
    
  5. Run the Speaker & Listener Apps:

    npm start
    

    The speaker and listener apps will be available at:

  6. Start the Mirror Server:

    In another terminal window, navigate to the project directory and run:

    node mirror-server/mirror-server.mjs