https://github.com/kryptonbd/speakeasyjs
Text-to-speech translator web app powered by Google Translate API and Web Speech API
https://github.com/kryptonbd/speakeasyjs
nodejs text-to-speech vanilla-javascript webspeech-api
Last synced: 3 months ago
JSON representation
Text-to-speech translator web app powered by Google Translate API and Web Speech API
- Host: GitHub
- URL: https://github.com/kryptonbd/speakeasyjs
- Owner: KryptonBD
- Created: 2025-01-30T10:26:23.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T10:27:04.000Z (4 months ago)
- Last Synced: 2025-02-11T13:00:00.486Z (3 months ago)
- Topics: nodejs, text-to-speech, vanilla-javascript, webspeech-api
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# SpeakEasy
SpeakEasy is a web application that enables real-time text translation and text-to-speech functionality. Users can input text, select their desired language, and have the translated text read aloud in various voices.
## Features
- Real-time text translation using Google Translate API
- Text-to-speech capability with multiple voice options
- Support for multiple languages including English, Spanish, German, and Bengali (can add more)
- Clean, responsive user interface built with Tailwind CSS
- Simple server implementation with basic static file serving## Project Structure
```
project/
├── api/
│ └── index.js # Backend server implementation
└── public/
├── index.html # Frontend user interface
└── main.js # Frontend JavaScript logic
```## Prerequisites
- Node.js
- Google Cloud Platform account with Translation API enabled
- API key for Google Translate## Setup
1. Clone the repository
2. Create a `.env` file in the root directory with the following variables:
```
GOOGLE_TRANSLATE_API_KEY=your_api_key_here
PORT=3000
```
3. Install dependencies:
```bash
npm install
```## Running the Application
1. Start the server:
```bash
node api/index.js
```
2. Access the application at `http://localhost:3000`## Technical Details
### Backend (`api/index.js`)
- Built with Node.js using native `http` and `https` modules
- Handles translation requests to Google Translate API
- Serves static files
- Implements basic error handling and security measures### Frontend (`public/`)
- HTML5 with Tailwind CSS for styling
- Vanilla JavaScript for DOM manipulation and API requests
- Uses Web Speech API for text-to-speech functionality
- Responsive design that works across different screen sizes## API Endpoints
### POST `/translate`
Translates text to the specified target language.
Request body:
```json
{
"text": "Hello, world!",
"targetLanguage": "es"
}
```Response:
```json
{
"data": {
"translations": [
{
"translatedText": "¡Hola Mundo!"
}
]
}
}
```