https://github.com/rajtilak-2020/vox
A web app that converts text to International Standard Morse Code with authentic audio playback and WAV export. Built with React, TypeScript, and Web Audio API.
https://github.com/rajtilak-2020/vox
cybersecurity morsecode morsecode-encoder project webdevelopment
Last synced: 8 months ago
JSON representation
A web app that converts text to International Standard Morse Code with authentic audio playback and WAV export. Built with React, TypeScript, and Web Audio API.
- Host: GitHub
- URL: https://github.com/rajtilak-2020/vox
- Owner: rajtilak-2020
- License: mit
- Created: 2025-10-15T18:48:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-16T05:18:30.000Z (8 months ago)
- Last Synced: 2025-10-17T07:24:46.307Z (8 months ago)
- Topics: cybersecurity, morsecode, morsecode-encoder, project, webdevelopment
- Language: TypeScript
- Homepage: https://voxsos.vercel.app
- Size: 1.05 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vox - Your Encrypted Thought.
**A web application that converts text to Morse code and generates authentic audio playback**
[](https://reactjs.org/)
[](https://www.typescriptlang.org/)
[](https://vitejs.dev/)
[](LICENSE)
---
## π― About The Project
**Vox** is a sophisticated web application that bridges modern communication with classical telegraphy. It converts alphanumeric text (A-Z, 0-9) into International Morse Code and generates high-quality audio representations using the Web Audio API. Built with React and TypeScript, Vox features a premium glassy UI with a black and green color scheme, delivering both aesthetic appeal and functional excellence.
### Why Vox?
- **Educational Tool**: Perfect for learning Morse code
- **Accessibility**: Convert text to audio for various use cases
- **Historical Preservation**: Keep the art of Morse code alive
- **Modern Implementation**: Leverages cutting-edge web technologies
---
## β¨ Features
### Core Functionality
- π€ **Real-time Text Conversion** - Instant Morse code translation as you type
- π **Authentic Audio Generation** - Web Audio API creates genuine dot and dash tones
- πΎ **Audio Download** - Export Morse code as WAV files
- π **One-click Copy** - Copy Morse code to clipboard
- β
**Input Validation** - Smart filtering of valid characters (A-Z, 0-9, spaces)
- π **Reference Chart** - Interactive Morse code lookup table
### User Experience
- π¨ **Premium Glassy UI** - Black background with vibrant green accents
- π¨ **Smooth Animations** - Professional, minimal transitions
- π± **Fully Responsive** - Seamless experience across all devices
- βΏ **Accessible Design** - WCAG compliant color contrasts
- β‘ **Lightning Fast** - Powered by Vite for optimal performance
---
## π Tech Stack
### Frontend
- **React 18.3.1** - Modern UI library with hooks
- **TypeScript 5.5.3** - Type-safe JavaScript
- **Vite 5.4.2** - Next-generation build tool
- **Tailwind CSS 3.4.1** - Utility-first CSS framework
- **Lucide React** - Beautiful icon library
### Audio Processing
- **Web Audio API** - Native browser audio generation
- **Custom WAV Encoder** - PCM audio encoding to WAV format
### Development Tools
- **ESLint** - Code linting and quality
- **PostCSS** - CSS processing
- **Autoprefixer** - CSS vendor prefixing
---
## π Architecture
### System Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Vox Application β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ β
β β β β β β
β β User Input ββββββββββΆβ Validation β β
β β (Text) β β (A-Z,0-9) β β
β β β β β β
β ββββββββββββββββ βββββββββ¬βββββββ β
β β β
β βΌ β
β βββββββββββββββββββ β
β β β β
β β Morse Encoder β β
β β (Converter) β β
β β β β
β ββββββββββ¬βββββββββ β
β β β
β ββββββββββββββββ΄βββββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββββββ ββββββββββββββββββββ β
β β β β β β
β β Display Output β β Audio Service β β
β β (Morse Code) β β (Web Audio API) β β
β β β β β β
β ββββββββββββββββββββ ββββββββββ¬ββββββββββ β
β β β
β ββββββββββββββββ΄βββββββ β
β βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββ
β β β β β
β β Play Audio β β Download β
β β (Browser) β β (WAV File) β
β β β β β
β ββββββββββββββββ ββββββββββββββββ
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Data Flow Diagram
```
ββββββββββββ
β Start β
ββββββ¬ββββββ
β
βΌ
ββββββββββββββββββββ
β User Types Text β
ββββββ¬ββββββββββββββ
β
βΌ
ββββββββββββββββββββ βββββββββββββββ
β Validate Input βββββββΆβ Show Error β
β (A-Z, 0-9 only) β β βββββββββββββββ
ββββββ¬ββββββββββββββ
β β
βΌ
ββββββββββββββββββββ
β Convert to Morse β
β (Real-time) β
ββββββ¬ββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Display Morse β
β Code Output β
ββββββ¬ββββββββββββββ
β
βββββββββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β Copy to β β Generate β
β Clipboardβ β Audio β
ββββββββββββ ββββββ¬ββββββ
β
βββββββββ΄ββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β Play β β Download β
β Audio β β WAV β
ββββββββββββ ββββββββββββ
```
### Audio Generation Workflow
```
ββββββββββββββββββββ
β Morse String β
β "... --- ..." β
ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββ
β Parse Symbols β
β . = 80ms β
β - = 240ms β
β space = gap β
ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββββββββββ
β Web Audio API β
β ββββββββββββββββββββββ β
β β Create AudioContextβ β
β βββββββββββ¬βββββββββββ β
β βΌ β
β ββββββββββββββββββββββ β
β β Generate Sine Wave β β
β β Frequency: 600Hz β β
β βββββββββββ¬βββββββββββ β
β βΌ β
β ββββββββββββββββββββββ β
β β Apply Envelope β β
β β (Attack/Release) β β
β βββββββββββ¬βββββββββββ β
β βΌ β
β ββββββββββββββββββββββ β
β β Create AudioBuffer β β
β βββββββββββ¬βββββββββββ β
ββββββββββββββΌββββββββββββββ
β
βββββββββ΄βββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β Play β β Encode β
β Buffer β β to WAV β
ββββββββββββ ββββββ¬ββββββ
β
βΌ
ββββββββββββ
β Download β
β File β
ββββββββββββ
```
### Component Architecture
```
App.tsx (Root Component)
β
ββββ State Management
β ββββ inputText (string)
β ββββ morseCode (string)
β ββββ isPlaying (boolean)
β ββββ isGenerating (boolean)
β ββββ copied (boolean)
β ββββ error (string)
β
ββββ Effects
β ββββ useEffect (Real-time conversion)
β
ββββ Event Handlers
β ββββ handleConvert()
β ββββ handlePlay()
β ββββ handleDownload()
β ββββ handleCopy()
β
ββββ UI Components
ββββ Header (Title & Description)
ββββ Input Panel
β ββββ Textarea (User Input)
β ββββ Validation Error
ββββ Output Panel
β ββββ Morse Display
β ββββ Copy Button
ββββ Action Buttons
β ββββ Convert Button
β ββββ Play Button
β ββββ Download Button
ββββ MorseReference.tsx (Reference Chart)
ββββ Footer (Copyright & Links)
```
---
## π Getting Started
### Prerequisites
- **Node.js** (v18 or higher)
- **npm** (v9 or higher)
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/rajtilak-2020/vox.git
cd vox
```
2. **Install dependencies**
```bash
npm install
```
3. **Start development server**
```bash
npm run dev
```
4. **Open your browser**
Navigate to `http://localhost:5173`
### Build for Production
```bash
npm run build
```
The optimized production build will be in the `dist/` directory.
### Preview Production Build
```bash
npm run preview
```
---
## π‘ Usage
### Basic Conversion
1. Type your message in the input field (A-Z, 0-9, and spaces only)
2. The Morse code appears automatically in real-time
3. Click **Convert** to generate audio
4. Click **Play** to hear your message
5. Click **Download** to save the audio file
### Advanced Features
#### Copy to Clipboard
Click the **Copy** button next to the output to copy the Morse code to your clipboard.
#### Reference Chart
Scroll down to view the complete Morse code reference chart showing all letter and number mappings.
### Example Conversions
| Input Text | Morse Code Output |
|-----------|-------------------|
| HELLO | `.... . .-.. .-.. ---` |
| SOS | `... --- ...` |
| 123 | `.---- ..--- ...--` |
| HELLO WORLD | `.... . .-.. .-.. --- / .-- --- .-. .-.. -..` |
---
## π How It Works
### Morse Code Conversion
The application uses a mapping table that follows the International Morse Code standard:
```typescript
const MORSE_CODE_MAP: Record = {
'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
// ... etc
};
```
**Conversion Process:**
1. Convert input to uppercase
2. Split into individual characters
3. Map each character to Morse code
4. Join with spaces between letters
5. Use '/' for word breaks
### Audio Generation
**Timing Standards:**
- **Dot duration**: 80ms
- **Dash duration**: 240ms (3Γ dot)
- **Symbol gap**: 80ms (between dots/dashes)
- **Letter gap**: 240ms (between letters)
- **Word gap**: 560ms (between words)
**Audio Parameters:**
- **Frequency**: 600Hz (standard Morse tone)
- **Sample Rate**: 44.1kHz (CD quality)
- **Wave Type**: Sine wave
- **Amplitude**: 0.3 (30% to prevent clipping)
- **Envelope**: 5ms attack/release for smooth tones
### WAV Encoding
The application encodes audio to WAV format using:
- **Format**: PCM (Pulse Code Modulation)
- **Bit Depth**: 16-bit
- **Channels**: Mono (1 channel)
- **Sample Rate**: 44,100 Hz
---
## π Project Structure
```
vox/
βββ public/
β βββ vite.svg
βββ src/
β βββ components/
β β βββ MorseReference.tsx # Morse code reference chart
β βββ services/
β β βββ audioService.ts # Web Audio API & WAV encoding
β βββ utils/
β β βββ morseCode.ts # Morse conversion logic
β βββ App.tsx # Main application component
β βββ main.tsx # Application entry point
β βββ index.css # Global styles
β βββ vite-env.d.ts # TypeScript definitions
βββ .env # Environment variables
βββ .gitignore # Git ignore rules
βββ eslint.config.js # ESLint configuration
βββ index.html # HTML entry point
βββ package.json # Dependencies & scripts
βββ postcss.config.js # PostCSS configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
βββ README.md # This file
```
---
## π API Reference
### Morse Code Utilities
#### `textToMorse(text: string): string`
Converts text to Morse code.
**Parameters:**
- `text` - Input string (A-Z, 0-9, spaces)
**Returns:**
- Morse code string with spaces between letters and `/` for word breaks
**Example:**
```typescript
textToMorse("HELLO") // Returns: ".... . .-.. .-.. ---"
```
#### `validateInput(text: string): boolean`
Validates if input contains only allowed characters.
**Parameters:**
- `text` - Input string to validate
**Returns:**
- `true` if valid, `false` otherwise
### Audio Service
#### `generateMorseAudio(morseCode: string): Promise`
Generates audio buffer from Morse code string.
**Parameters:**
- `morseCode` - Morse code string (dots, dashes, spaces)
**Returns:**
- Promise resolving to `{ audioBuffer, audioContext }`
#### `playMorseAudio(audioBuffer: AudioBuffer, audioContext: AudioContext): AudioBufferSourceNode`
Plays the generated Morse code audio.
**Parameters:**
- `audioBuffer` - Audio buffer to play
- `audioContext` - Web Audio context
**Returns:**
- Audio source node for playback control
#### `downloadMorseAudio(audioBuffer: AudioBuffer, filename?: string): void`
Downloads audio as WAV file.
**Parameters:**
- `audioBuffer` - Audio buffer to encode
- `filename` - Optional filename (default: "morse-code.wav")
---
## π€ Contributing
Contributions are what make the open-source community amazing! Any contributions you make are **greatly appreciated**.
### How to Contribute
1. **Fork the Project**
2. **Create your Feature Branch**
```bash
git checkout -b feature/AmazingFeature
```
3. **Commit your Changes**
```bash
git commit -m 'Add some AmazingFeature'
```
4. **Push to the Branch**
```bash
git push origin feature/AmazingFeature
```
5. **Open a Pull Request**
### Development Guidelines
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Keep PRs focused and atomic
---
## π License
Distributed under the MIT License. See `LICENSE` for more information.
---
## π€ Contact
**K Rajtilak**
- GitHub: [@rajtilak-2020](https://github.com/rajtilak-2020)
- Project Link: [https://github.com/rajtilak-2020/vox](https://github.com/rajtilak-2020/vox)
---
## π Acknowledgments
- [React Documentation](https://react.dev/)
- [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
- [International Morse Code Standard](https://en.wikipedia.org/wiki/Morse_code)
- [Tailwind CSS](https://tailwindcss.com/)
- [Lucide Icons](https://lucide.dev/)
- [Vite](https://vitejs.dev/)
---
**Made with β€οΈ by [rajtilak-2020](https://github.com/rajtilak-2020)**
β Star this repository if you found it helpful!