A web application that converts text to Morse code and generates authentic audio playback
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.
- 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
- π€ 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
- π¨ 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
- 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
- Web Audio API - Native browser audio generation
- Custom WAV Encoder - PCM audio encoding to WAV format
- ESLint - Code linting and quality
- PostCSS - CSS processing
- Autoprefixer - CSS vendor prefixing
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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) β
β β β β β
β ββββββββββββββββ ββββββββββββββββ
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββ
β 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 β
ββββββββββββ ββββββββββββ
ββββββββββββββββββββ
β 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 β
ββββββββββββ
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)
- Node.js (v18 or higher)
- npm (v9 or higher)
- Clone the repository
git clone https://github.com/rajtilak-2020/vox.git
cd vox- Install dependencies
npm install- Start development server
npm run dev- Open your browser
Navigate to http://localhost:5173
npm run buildThe optimized production build will be in the dist/ directory.
npm run preview- Type your message in the input field (A-Z, 0-9, and spaces only)
- The Morse code appears automatically in real-time
- Click Convert to generate audio
- Click Play to hear your message
- Click Download to save the audio file
Click the Copy button next to the output to copy the Morse code to your clipboard.
Scroll down to view the complete Morse code reference chart showing all letter and number mappings.
| Input Text | Morse Code Output |
|---|---|
| HELLO | .... . .-.. .-.. --- |
| SOS | ... --- ... |
| 123 | .---- ..--- ...-- |
| HELLO WORLD | .... . .-.. .-.. --- / .-- --- .-. .-.. -.. |
The application uses a mapping table that follows the International Morse Code standard:
const MORSE_CODE_MAP: Record<string, string> = {
'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
// ... etc
};Conversion Process:
- Convert input to uppercase
- Split into individual characters
- Map each character to Morse code
- Join with spaces between letters
- Use '/' for word breaks
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
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
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
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:
textToMorse("HELLO") // Returns: ".... . .-.. .-.. ---"Validates if input contains only allowed characters.
Parameters:
text- Input string to validate
Returns:
trueif valid,falseotherwise
Generates audio buffer from Morse code string.
Parameters:
morseCode- Morse code string (dots, dashes, spaces)
Returns:
- Promise resolving to
{ audioBuffer, audioContext }
Plays the generated Morse code audio.
Parameters:
audioBuffer- Audio buffer to playaudioContext- Web Audio context
Returns:
- Audio source node for playback control
Downloads audio as WAV file.
Parameters:
audioBuffer- Audio buffer to encodefilename- Optional filename (default: "morse-code.wav")
Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Keep PRs focused and atomic
Distributed under the MIT License. See LICENSE for more information.
K Rajtilak
- GitHub: @rajtilak-2020
- Project Link: https://github.com/rajtilak-2020/vox
Made with β€οΈ by rajtilak-2020
β Star this repository if you found it helpful!