ByteWaves is a Python-based acoustic modem that encodes and decodes data into sound waves using a multi-frequency shift keying (MFSK) technique. It leverages Reed-Solomon error correction to ensure data integrity even in noisy environments. This project provides a simple yet effective way to transmit data between devices using only a speaker and a microphone.
- Multi-Frequency Shift Keying (MFSK): Robust modulation scheme using 8 distinct frequencies
- Reed-Solomon Error Correction: Advanced error correction with configurable ECC bytes
- Adaptive Equalization: Real-time channel compensation for audio distortion
- CRC Validation: Cyclic redundancy checks for data integrity verification
- Comprehensive Testing: Extensive test suite with unit, integration, and performance tests
- Cross-Platform: Works on Windows, macOS, and Linux
You can install ByteWaves directly from PyPI using pip:
pip install bytewavesFor development and testing, install with development dependencies:
# Using uv (recommended)
uv sync --dev
# Or using pip
pip install -e ".[dev]"Once installed, you can run the modem from your terminal:
bytewavesThis will launch the interactive command-line interface, where you can choose to send or receive data.
The project includes a comprehensive testing framework:
# Run all tests
./scripts/test.sh
# Run specific test categories
make test-unit # Unit tests only
make test-integration # Integration tests only
make test-performance # Performance tests only
# Run with coverage report
make test-allFor detailed testing documentation, see tests/README.md.
- Type: Multi-Frequency Shift Keying (MFSK)
- Frequencies: 8 logarithmically-spaced frequencies (1000Hz base)
- Symbol Rate: 50 baud (20ms per byte + 20ms pause)
- Frequency Range: 1000Hz - 3393Hz (audible range)
- Algorithm: Reed-Solomon error correction
- ECC Bytes: 16 bytes (configurable)
- Maximum Block Size: 255 bytes
- Error Correction Capacity: Up to 8 bytes per block
- Sample Rate: 44,100 Hz
- Bit Depth: 32-bit float
- Channels: Mono
- Normalization: Automatic amplitude normalization
- Preamble: 4-byte synchronization pattern (
0x16168888) - Packet Structure: Preamble + Length + Data + CRC + ECC
- CRC: CRC32 for data integrity verification
- Adaptive Equalization: LMS filter for channel compensation
This roadmap outlines the future direction of the ByteWaves project, focusing on key areas of improvement to enhance its functionality, robustness, and user experience.
The current protocol implementation includes several advanced features for reliability and efficiency.
- ✅ Variable-Length Packets: Supports variable-length packets with intelligent size optimization
- ✅ Robust Synchronization: Preamble-based synchronization with unique 4-byte pattern for reliable lock-in
- ✅ Data Integrity: CRC32 checksum validation for early corruption detection before error correction
Advanced signal processing algorithms are implemented to boost performance in challenging acoustic environments.
- 🟡 Soft-Decision Decoding: Current implementation uses hard-decision decoding (planned enhancement for leveraging confidence scores)
- ✅ Adaptive Equalization: Real-time adaptive filter using LMS algorithm to compensate for frequency-dependent distortion from speakers, microphones, and environmental factors
A comprehensive testing suite has been implemented to ensure the reliability and stability of the modem.
- ✅ Unit Tests: Comprehensive unit tests for all critical components, including encoding, decoding, and signal processing functions
- ✅ Integration Tests: End-to-end transmission simulation under various conditions
- ✅ Performance Tests: Benchmarking and resource usage monitoring
- ✅ Edge Case Testing: Robustness testing for error conditions and boundary cases
- ✅ CI/CD Pipeline: Automated testing with GitHub Actions across multiple Python versions
Clear and comprehensive documentation is crucial for making the project accessible and maintainable.
- Protocol Specification: Write a detailed document specifying the communication protocol, including packet structure, modulation scheme, and error correction methods.
- API Reference: Generate a complete API reference for the codebase to assist developers in extending the project.
- User Guide: Create a user-friendly guide with examples and tutorials on how to use the modem for sending and receiving data.
Improving the user interface will make the modem more intuitive and easier to use.
- Graphical User Interface (GUI): Develop a GUI that provides real-time feedback, including:
- A frequency spectrum visualizer.
- A constellation diagram to monitor signal quality.
- Progress indicators for data transmission.
- Command-Line Interface (CLI) Enhancements: Improve the existing CLI with more informative output and better command parsing.
To simplify distribution and installation, the project will be packaged for standard repositories.
- PyPI Distribution: Package the project for distribution on the Python Package Index (PyPI), allowing for easy installation via
pip. - Dependency Management: Streamline dependency management to ensure a smooth installation process across different platforms.
-
Clone the repository:
git clone <repository-url> cd bytewaves
-
Install development dependencies:
# Using uv (recommended) uv sync --dev # Or using pip pip install -e ".[dev]"
-
Run tests:
# Quick test run make quick-test # Full test suite make test-all # Run specific test categories make test-unit # Unit tests make test-integration # Integration tests make test-performance # Performance tests
The project maintains high code quality standards:
# Format code
make format
# Lint code
make lint
# Check security vulnerabilities
make securityThe comprehensive testing framework includes:
- Unit Tests: Individual component testing with mocks
- Integration Tests: End-to-end transmission simulation
- Performance Tests: Benchmarking and resource monitoring
- Edge Case Tests: Robustness under error conditions
See tests/README.md for detailed testing documentation.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass:
make ci - Submit a pull request
bytewaves/
├── __init__.py # Package initialization
├── modem.py # Main modem implementation
└── ...
tests/
├── unit/ # Unit tests
├── integration/ # Integration tests
├── performance/ # Performance tests
└── README.md # Testing documentation
scripts/
└── test.sh # Test execution script
.github/workflows/
└── ci.yml # CI/CD pipeline