Skip to content

jscott111/scribe-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

64 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Scribe Frontend

React + TypeScript frontend for the Tongues real-time audio translation application with dual-client architecture for professional translation workflows.

โœจ Features

  • ๐ŸŽค Live Audio Recording - Real-time microphone input with noise suppression
  • ๐ŸŒ Multi-Language Support - 100+ languages with beautiful flag icons
  • ๐Ÿ”„ Real-Time Translation - Live translation display with WebSocket integration
  • ๐Ÿ“ฑ Responsive Design - Modern UI that works on all devices
  • ๐ŸŽจ Beautiful Interface - Gradient backgrounds, smooth animations, intuitive controls
  • ๐Ÿš€ Dual-Client System - Separate clients for input and translation display
  • ๐Ÿ’ฌ Persistent Chat Bubbles - Transcriptions and translations don't disappear
  • ๐ŸŽฏ Thought Completion - Automatically detects when speech is complete

๐Ÿš€ Quick Start

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • Modern web browser with microphone access
  • Backend server running on port 3001

Installation

# Install dependencies
npm install

# Start both clients simultaneously (Recommended)
npm run dev

# Or start individual clients
npm run dev:input      # Input Client on port 5173
npm run dev:translation # Translation Client on port 5174

๐Ÿ—๏ธ Architecture

Dual-Client System

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    WebSocket    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Input Client  โ”‚ โ†โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ Translation     โ”‚
โ”‚   (Port 5173)   โ”‚                 โ”‚ Client          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚ (Port 5174)     โ”‚
         โ”‚                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚ WebSocket
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Backend       โ”‚
โ”‚   (Port 3001)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Technology Stack

  • React 18 with TypeScript for type safety
  • Vite for fast development and building
  • Web Speech API for real-time speech recognition
  • Socket.IO Client for real-time communication with backend
  • Modern CSS with gradients, animations, and responsive design

๐Ÿ“ฑ Client Overview

๐ŸŽค Input Client (http://localhost:5173)

  • Purpose: Audio recording and transcription
  • Features:
    • Real-time speech recognition
    • Source language transcription display
    • Persistent transcription bubbles
    • Language selection controls
    • Recording status indicators

๐ŸŒ Translation Client (http://localhost:5174)

  • Purpose: Translation display and management
  • Features:
    • Real-time translation display
    • Persistent translation bubbles
    • Copy and speak functionality
    • Language pair visualization
    • Connection status monitoring

๐Ÿ”Œ Backend Integration

This frontend connects to the Tongues backend service via WebSocket. Make sure the backend is running on http://localhost:3001 before testing audio features.

๐Ÿ“ฑ Usage

Dual-Client Workflow

  1. Open Input Client (http://localhost:5173) for recording
  2. Open Translation Client (http://localhost:5174) for viewing translations
  3. Select Languages: Choose source and target languages from the dropdowns
  4. Start Recording: Click the microphone button to begin audio capture
  5. Speak Clearly: Talk into your microphone - the app will process audio in real-time
  6. View Translations: See translated text appear in the Translation Client
  7. Copy or Speak: Use the action buttons to copy text or hear it spoken

Single-Client Mode

Use npm run dev to run the original combined interface on the default port.

๐Ÿ› ๏ธ Development

# Start both clients simultaneously
npm run dev

# Start individual clients
npm run dev:input      # Input Client on port 5173
npm run dev:translation # Translation Client on port 5174

# Build for production
npm run build

# Preview production build
npm run preview

# Lint code
npm run lint

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ components/           # React components
โ”‚   โ”œโ”€โ”€ AudioRecorder.tsx    # Audio capture and streaming
โ”‚   โ”œโ”€โ”€ LanguageSelector.tsx # Language selection dropdowns
โ”‚   โ”œโ”€โ”€ TranslationDisplay.tsx # Translation results display
โ”‚   โ”œโ”€โ”€ InputClient.tsx      # Input client component
โ”‚   โ””โ”€โ”€ TranslationClient.tsx # Translation client component
โ”œโ”€โ”€ App.tsx              # Main application component
โ”œโ”€โ”€ InputApp.tsx         # Input client application
โ”œโ”€โ”€ TranslationApp.tsx   # Translation client application
โ”œโ”€โ”€ App.css              # Application styles
โ”œโ”€โ”€ InputApp.css         # Input client styles
โ”œโ”€โ”€ TranslationApp.css   # Translation client styles
โ””โ”€โ”€ main.tsx             # Application entry point

๐ŸŒ Supported Languages

100+ languages supported via Azure Translator API, including:

  • ๐Ÿ‡บ๐Ÿ‡ธ English (en)
  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish (es)
  • ๐Ÿ‡ซ๐Ÿ‡ท French (fr)
  • ๐Ÿ‡ฉ๐Ÿ‡ช German (de)
  • ๐Ÿ‡ฎ๐Ÿ‡น Italian (it)
  • ๐Ÿ‡ต๐Ÿ‡น Portuguese (pt)
  • ๐Ÿ‡ท๐Ÿ‡บ Russian (ru)
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japanese (ja)
  • ๐Ÿ‡ฐ๐Ÿ‡ท Korean (ko)
  • ๐Ÿ‡จ๐Ÿ‡ณ Chinese Simplified (zh-Hans)
  • ๐Ÿ‡น๐Ÿ‡ผ Chinese Traditional (zh-Hant)
  • ๐Ÿ‡ธ๐Ÿ‡ฆ Arabic (ar)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Hindi (hi)
  • ๐Ÿ‡ณ๐Ÿ‡ฑ Dutch (nl)
  • ๐Ÿ‡ธ๐Ÿ‡ช Swedish (sv)
  • ๐Ÿ‡ฉ๐Ÿ‡ฐ Danish (da)
  • ๐Ÿ‡ณ๐Ÿ‡ด Norwegian (nb)
  • ๐Ÿ‡ซ๐Ÿ‡ฎ Finnish (fi)
  • ๐Ÿ‡ต๐Ÿ‡ฑ Polish (pl)
  • ๐Ÿ‡จ๐Ÿ‡ฟ Czech (cs)
  • ๐Ÿ‡ธ๐Ÿ‡ฐ Slovak (sk)
  • ๐Ÿ‡ญ๐Ÿ‡บ Hungarian (hu)
  • ๐Ÿ‡ท๐Ÿ‡ด Romanian (ro)
  • ๐Ÿ‡ง๐Ÿ‡ฌ Bulgarian (bg)
  • ๐Ÿ‡ญ๐Ÿ‡ท Croatian (hr)
  • ๐Ÿ‡ท๐Ÿ‡ธ Serbian (Latin & Cyrillic)
  • ๐Ÿ‡ธ๐Ÿ‡ฎ Slovenian (sl)
  • ๐Ÿ‡ช๐Ÿ‡ช Estonian (et)
  • ๐Ÿ‡ฑ๐Ÿ‡ป Latvian (lv)
  • ๐Ÿ‡ฑ๐Ÿ‡น Lithuanian (lt)
  • ๐Ÿ‡ฌ๐Ÿ‡ท Greek (el)
  • ๐Ÿ‡น๐Ÿ‡ท Turkish (tr)
  • ๐Ÿ‡บ๐Ÿ‡ฆ Ukrainian (uk)
  • ๐Ÿ‡น๐Ÿ‡ญ Thai (th)
  • ๐Ÿ‡ป๐Ÿ‡ณ Vietnamese (vi)
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesian (id)
  • ๐Ÿ‡ฒ๐Ÿ‡พ Malay (ms)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Indian Languages (Tamil, Telugu, Kannada, Malayalam, Bangla, Punjabi, Gujarati, Marathi, Odia, Assamese)
  • ๐Ÿ‡ณ๐Ÿ‡ต Nepali (ne)
  • ๐Ÿ‡ฑ๐Ÿ‡ฐ Sinhala (si)
  • ๐Ÿ‡ฒ๐Ÿ‡ฒ Myanmar (my)
  • ๐Ÿ‡ฐ๐Ÿ‡ญ Khmer (km)
  • ๐Ÿ‡ฑ๐Ÿ‡ฆ Lao (lo)
  • ๐Ÿ‡ฒ๐Ÿ‡ณ Mongolian (mn-Cyrl)
  • ๐Ÿ‡ฐ๐Ÿ‡ฟ Kazakh (kk)
  • ๐Ÿ‡ฐ๐Ÿ‡ฌ Kyrgyz (ky)
  • ๐Ÿ‡บ๐Ÿ‡ฟ Uzbek (uz)
  • ๐Ÿ‡น๐Ÿ‡ฒ Turkmen (tk)
  • ๐Ÿ‡น๐Ÿ‡ฏ Tajik (tg)
  • ๐Ÿ‡ฆ๐Ÿ‡ซ Pashto (ps)
  • ๐Ÿ‡ฎ๐Ÿ‡ท Persian (fa)
  • ๐Ÿ‡ต๐Ÿ‡ฐ Urdu (ur)
  • ๐Ÿ‡ต๐Ÿ‡ฐ Sindhi (sd)
  • ๐Ÿ‡ญ๐Ÿ‡ฐ Cantonese (yue)
  • ๐Ÿ‡ฟ๐Ÿ‡ฆ African Languages (Afrikaans, Swahili, Somali, Amharic, Hausa, Igbo, Yoruba, Zulu, Xhosa)
  • ๐Ÿ‡ฎ๐Ÿ‡ฑ Hebrew (he)
  • ๐Ÿ‡ฎ๐Ÿ‡ถ Kurdish (ku)
  • ๐Ÿ‡ฒ๐Ÿ‡ป Divehi (dv)
  • ๐Ÿ‡ณ๐Ÿ‡ฟ Pacific Languages (Maori, Samoan, Tongan, Fijian, Tahitian)
  • ๐Ÿ‡จ๐Ÿ‡ฆ Indigenous Languages (Inuktitut, Inuinnaqtun)

๐Ÿ’ฌ Chat Bubble Features

Transcription Bubbles (Input Client)

  • Real-time display of speech recognition
  • Status indicators: Listening, Processing, Complete
  • Timestamps for each transcription
  • Persistent storage until manually cleared
  • Thought completion detection (2-second silence)

Translation Bubbles (Translation Client)

  • Original text in source language
  • Translated text in target language
  • Language flags and names
  • Copy to clipboard functionality
  • Text-to-speech for both languages
  • Persistent storage until manually cleared

๐Ÿ”„ How It Works

1. Audio Input Flow

๐ŸŽค User speaks โ†’ ๐Ÿง  Speech Recognition โ†’ ๐Ÿ“ Transcription Bubble โ†’ ๐Ÿ”— WebSocket โ†’ ๐ŸŒ Translation Client

2. Translation Flow

๐Ÿ“ Transcription โ†’ ๐Ÿ”— Backend API โ†’ ๐ŸŒ Azure Translator โ†’ ๐Ÿ”— WebSocket โ†’ ๐ŸŒ Translation Bubble

3. Bubble Lifecycle

๐Ÿ”„ Listening โ†’ ๐Ÿ“ Transcribing โ†’ โœ… Complete โ†’ ๐Ÿ—‘๏ธ Clear (optional)

๐ŸŽฏ Key Features

Persistent Storage

  • Transcriptions and translations remain visible
  • No data loss during recording sessions
  • Manual clear functionality available
  • Scrollable history for long conversations

Real-time Communication

  • WebSocket-based communication
  • Instant updates between clients
  • Connection status monitoring
  • Automatic reconnection handling

Language Management

  • 100+ supported languages
  • Easy language swapping
  • Visual language indicators
  • Consistent language codes

User Experience

  • Modern, responsive design
  • Smooth animations and transitions
  • Clear visual feedback
  • Intuitive controls

๐Ÿšจ Troubleshooting

Common Issues

Input Client Not Recording

  • Check microphone permissions
  • Ensure Web Speech API is supported
  • Verify backend connection

Translation Client Not Receiving Data

  • Check WebSocket connection status
  • Verify both clients are running
  • Check backend logs for errors

Language Selection Issues

  • Ensure language codes match Azure Translator
  • Check enum file for supported languages
  • Verify language metadata

Debug Steps

  1. Check browser console for errors
  2. Verify backend is running on port 3001
  3. Check WebSocket connection status
  4. Verify Azure Translator API credentials
  5. Check network connectivity

๐Ÿ“ฑ Browser Compatibility

  • Chrome/Edge: Full support
  • Firefox: Full support
  • Safari: Limited Web Speech API support
  • Mobile: Responsive design, touch-friendly

๐Ÿ”’ Privacy & Security

  • Audio processing happens on the backend
  • No audio data is stored in the frontend
  • WebSocket connections are secured
  • Microphone access requires user permission

๐Ÿš€ Deployment

# Build the application
npm run build

# Deploy the dist/ folder to your hosting service

๐Ÿ”ฎ Future Enhancements

  • Multi-language support in single session
  • Voice commands for client control
  • Export functionality for conversations
  • User authentication and history
  • Mobile app versions
  • Offline translation capabilities

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the ISC License.


๐ŸŽ‰ Enjoy your professional dual-client translation experience!

Part of the Tongues Audio Translation Platform

About

This is an AI live translation web app

Resources

Stars

Watchers

Forks

Packages

No packages published