| Crates.io | ush |
| lib.rs | ush |
| version | 0.1.0 |
| created_at | 2025-08-17 16:02:25.674212+00 |
| updated_at | 2025-08-17 16:02:25.674212+00 |
| description | Ultrasonic Shell - communicate between devices using ultrasonic sound waves |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1799539 |
| size | 3,489,452 |
ush (ultrasonic shell) is a terminal program that enables communication between devices using ultrasonic sound waves. Send text messages, engage in real-time chat, or transfer files using audio frequencies above human hearing range (18-22 kHz).
cargo instal ush
Send a message (Device A):
ush send "Hello, World!"
Listen for messages (Device B):
ush listen
Send a simple message:
ush send "Hello from device A!"
Listen with a 30-second timeout:
ush listen --timeout 30
Send message multiple times for reliability:
ush send "Important message" --repeat 3
Start a chat session:
ush chat --username alice
Chat with automatic acknowledgments:
ush chat --username bob --ack
Send a small file:
ush send-file document.txt
Send with custom chunk size and delay:
ush send-file image.jpg --chunk-size 32 --delay 1000
Receive a file:
ush receive-file downloaded.txt --timeout 300
Save transmitted audio for analysis:
ush send "Debug test" --save-wav output.wav
Process audio from a file instead of live:
ush listen --from-wav recorded.wav
Test the complete encoding/decoding pipeline:
ush test loopback "Test message"
List available audio devices:
ush test devices
Generate a test tone:
ush test generate 19000 --duration 2.0
Measure background noise:
ush test noise --duration 5
Use custom frequencies:
ush --freq-0 17000 --freq-1 21000 send "Custom frequencies"
Apply noise filtering:
ush listen --filter --threshold 0.2
Verbose logging:
ush --verbose send "Debug message"
--sample-rate: Audio sample rate (default: 44100 Hz)--freq-0: Frequency for bit '0' (default: 18000 Hz)--freq-1: Frequency for bit '1' (default: 20000 Hz)The protocol uses:
Typical performance characteristics:
"No audio device found"
ush test devices to list available devices"Failed to decode message"
--filter option for noisy environments--repeat 3 to send message multiple times"Timeout waiting for signal"
Monitor live audio for debugging:
ush debug --spectrum --waveform --rate 20
Run comprehensive tests:
cargo test --release
Benchmark encoding/decoding speed:
cargo test --release test_performance_benchmarks -- --nocapture
src/
├── main.rs # CLI entry point and command routing
├── lib.rs # Library exports and module declarations
├── app.rs # Main application logic and coordination
├── cli.rs # Command-line interface definitions
├── audio.rs # Cross-platform audio I/O with cpal
├── modulation.rs # FSK encoding/decoding with FFT
├── protocol.rs # Message framing and error detection
└── error.rs # Centralized error handling
Application Layer │ Text messages, files, chat
Protocol Layer │ Framing, sequencing, CRC checksums
Modulation Layer │ FSK (Frequency Shift Keying)
Physical Layer │ Ultrasonic audio (18-22 kHz)
# Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install system dependencies (Linux only)
# Ubuntu/Debian:
sudo apt-get install libasound2-dev pkg-config
# CentOS/RHEL:
sudo yum install alsa-lib-devel pkgconfig
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run tests
cargo test
# Run with logging
RUST_LOG=debug cargo run -- send "test"
# Generate documentation
cargo doc --open
Build for different platforms:
# Add targets
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-apple-darwin
# Cross-compile
cargo build --target x86_64-pc-windows-gnu --release
# Unit tests
cargo test
# Integration tests
cargo test --test integration_tests
# Specific test
cargo test test_full_pipeline
# With output
cargo test -- --nocapture
cargo fmt for formattingcargo clippy for lintingQ: Why ultrasonic frequencies? A: Ultrasonic frequencies (18-22 kHz) are above human hearing range, so communication doesn't create audible noise. Most computer speakers and microphones support these frequencies.
Q: What's the maximum range? A: Typically 2-10 meters depending on environment, speaker/microphone quality, and background noise. Outdoor range may be longer.
Q: Can I use this through walls? A: Sound waves don't penetrate walls well. ush is designed for same-room or adjacent room communication.
Q: Is this secure? A: Currently no encryption is implemented. Messages are transmitted as plaintext audio. Anyone with a microphone in range can receive messages.
Q: Why is it slow compared to WiFi/Bluetooth? A: Audio-based communication is inherently slower due to symbol duration and error correction needs. It's designed for short messages, not bulk data transfer.
Q: Does this work on mobile devices? A: The current implementation is desktop-focused. Mobile support would require platform-specific audio handling.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas where help is needed:
MIT License - see LICENSE file for details.
Built with:
Inspired by projects like:
Note: This is experimental software. Use responsibly and be mindful of local regulations regarding ultrasonic emissions.