| Crates.io | ditdah |
| lib.rs | ditdah |
| version | 0.2.0 |
| created_at | 2025-06-24 11:09:06.753232+00 |
| updated_at | 2025-06-24 11:09:06.753232+00 |
| description | High-performance Morse code decoder with 100% test suite accuracy |
| homepage | |
| repository | https://github.com/yuvadm/ditdah |
| max_upload_size | |
| id | 1724169 |
| size | 68,391 |
A high-performance Rust implementation of a Morse code decoder that can process WAV audio files and decode them into text with 100% accuracy on the comprehensive test suite.
decode_wav_file, decode_samples)✅ All tests passing with 100% accuracy:
git clone https://github.com/yuvadm/ditdah
cd ditdah
cargo build --release
Decode a WAV file:
cargo run -- input.wav
With verbose output and timing:
cargo run -- input.wav --verbose --time
Generate test Morse code WAV files:
cargo run -- --generate "SOS" --verbose
cargo run -- --generate "HELLO WORLD" --output test.wav --frequency 800 --wpm 25
With debug logging:
RUST_LOG=info cargo run -- input.wav
High-level API (recommended):
use ditdah::{decode_wav_file, decode_samples, MorseGenerator};
// Decode a WAV file directly
let decoded_text = decode_wav_file("morse.wav")?;
println!("Decoded: {}", decoded_text);
// Decode audio samples directly
let samples: Vec<f32> = /* your audio data */;
let decoded_text = decode_samples(&samples, 12000)?;
println!("Decoded: {}", decoded_text);
// Generate Morse code WAV files
let generator = MorseGenerator::new(12000, 600.0, 20.0);
generator.generate_wav_file("SOS", "output.wav")?;
cargo test
# Basic test
cargo test baseline_decoder_test -- --nocapture
# With debug output
RUST_LOG=info cargo test baseline_decoder_test -- --nocapture
cargo test run_comprehensive_test_suite -- --nocapture
The test suite automatically:
The decoder uses a sophisticated multi-stage approach:
The library provides a clean, high-level API:
pub fn decode_wav_file<P: AsRef<std::path::Path>>(path: P) -> Result<String>
pub fn decode_samples(samples: &[f32], sample_rate: u32) -> Result<String>
pub use generator::MorseGenerator;
All signal processing complexity is handled internally - the library automatically:
ditdah/
├── src/
│ ├── main.rs # CLI application
│ ├── lib.rs # Public library API
│ ├── decoder.rs # Internal Morse decoder implementation
│ └── generator.rs # Public Morse code generator
├── tests/
│ └── integration_tests.rs # Comprehensive test suite
├── .github/workflows/ # CI pipeline
├── Cargo.toml # Rust 2024 edition project configuration
├── LICENSE # MIT License
└── README.md # This file
This implementation is based on the excellent work from ggmorse by Georgi Gerganov, which provided inspiration for the signal processing pipeline. The Rust implementation includes significant enhancements for robustness and accuracy.
This project is licensed under the MIT License - see the LICENSE file for details.
cargo testcargo fmtcargo clippy