Skip to content

mikessut/aws-translate

Repository files navigation

AWS Services Test Applications

This project contains five test web applications for AWS services:

  1. AWS Transcribe - For transcribing pre-recorded audio files
  2. AWS Translate - For translating text between languages
  3. AWS Transcribe Streaming - For real-time transcription using the browser's microphone
  4. AWS Transcribe & Translate - Combined app for real-time transcription and translation
  5. AWS Polly - Text-to-speech synthesis

Prerequisites

Before running these applications, make sure you have:

  1. Node.js installed (v14 or higher recommended)
  2. AWS credentials configured in one of the following ways:
    • Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
    • AWS credentials file (~/.aws/credentials)
    • IAM role if running on AWS services like EC2

Project Structure

translate2/
├── transcribe-app/               # AWS Transcribe test application (file-based)
│   ├── public/                   # Frontend files
│   │   └── index.html
│   └── server.js                 # Express server with AWS Transcribe integration
│
├── translate-app/                # AWS Translate test application
│   ├── public/                   # Frontend files
│   │   └── index.html
│   └── server.js                 # Express server with AWS Translate integration
│
├── transcribe-streaming-app/     # AWS Transcribe streaming test application (microphone)
│   ├── public/                   # Frontend files
│   │   └── index.html
│   └── server.js                 # Express server with WebSocket for real-time transcription
│
├── transcribe-translate-app/     # Combined Transcribe & Translate application
│   ├── public/                   # Frontend files
│   │   └── index.html
│   └── server.js                 # Express server with both transcription and translation
│
├── polly-app/                    # AWS Polly text-to-speech application
│   ├── public/                   # Frontend files
│   │   └── index.html
│   └── server.js                 # Express server with Polly integration
│
├── package.json
└── README.md

Running the Applications

AWS Transcribe Application

  1. Start the server:
    cd transcribe-app
    node server.js
    
  2. Open your browser and navigate to http://localhost:3000
  3. Enter the required information:
    • Job Name: A unique identifier for your transcription job
    • Media URL: S3 URL or publicly accessible URL to your audio file (e.g., s3://my-bucket/audio.mp3)
    • Language Code: Select the language of the audio

Notes:

  • You must have proper S3 permissions to access the media file
  • For S3 URLs, your AWS credentials must have access to that bucket
  • For large files, transcription may take several minutes to complete

AWS Translate Application

  1. Start the server:
    cd translate-app
    node server.js
    
  2. Open your browser and navigate to http://localhost:3001
  3. Enter text in the source text area
  4. Select source and target languages
  5. Click "Translate" to see the translation

AWS Transcribe Streaming Application (Microphone)

  1. Start the server:
    cd transcribe-streaming-app
    node server.js
    
  2. Open your browser and navigate to http://localhost:3002
  3. Select your language from the dropdown
  4. Click "Start Recording" to begin capturing audio from your microphone
  5. Speak into your microphone and see the transcription appear in real-time
  6. Click "Stop Recording" when finished

Notes:

  • Browser permission to access your microphone is required
  • A stable internet connection is recommended for best results
  • Transcription accuracy may vary based on audio quality and background noise

AWS Transcribe & Translate Application (Combined)

  1. Start the server:
    cd transcribe-translate-app
    node server.js
    
  2. Open your browser and navigate to http://localhost:3003
  3. Select your source language (for transcription) and target language (for translation)
  4. Click "Start Recording" to begin capturing audio from your microphone
  5. Speak into your microphone and see the transcription appear in real-time on the left panel
  6. Click "Stop Recording" when finished
  7. Click "Translate" to translate the transcribed text to your target language
  8. The translation will appear on the right panel

Notes:

  • This app combines real-time transcription with on-demand translation
  • Browser permission to access your microphone is required
  • Translation happens after you stop recording and click the "Translate" button
  • You can translate multiple times to different languages without re-recording

AWS Polly Application (Text-to-Speech)

  1. Start the server:
    cd polly-app
    node server.js
    
  2. Open your browser and navigate to http://localhost:3004
  3. Enter text in the text area
  4. Select a language from the dropdown
  5. Select a voice (voices are filtered by language)
  6. Click "Synthesize Speech" to generate audio
  7. The audio will play automatically and controls will appear

Notes:

  • Uses AWS Polly's neural engine for high-quality voice synthesis
  • Voices are automatically filtered based on selected language
  • Audio can be played, paused, and replayed using the controls

AWS Permissions Required

For Transcribe App

  • transcribe:StartTranscriptionJob
  • transcribe:GetTranscriptionJob
  • s3:GetObject (for accessing media files)
  • s3:PutObject (if saving transcription results to S3)

For Translate App

  • translate:TranslateText

For Transcribe Streaming App

  • transcribe:StartStreamTranscription

For Transcribe & Translate App (Combined)

  • transcribe:StartStreamTranscription
  • translate:TranslateText

For Polly App

  • polly:SynthesizeSpeech

Environment Variables

You can customize these applications with the following environment variables:

  • AWS_REGION: AWS region to use (default: us-east-1)
  • AWS_S3_BUCKET: S3 bucket to store transcription results (Transcribe app only)

Troubleshooting

Common Issues

  1. Authentication Errors: Ensure your AWS credentials are correctly configured and have the necessary permissions.

  2. S3 Access Issues: Verify that your IAM user/role has access to the S3 bucket containing your media files.

  3. Port Conflicts: If the ports are already in use, you can modify the PORT constant in each server.js file.

  4. CORS Issues: If accessing media from different domains, you might need to configure CORS on your S3 bucket.

Additional Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •