Overview
While minimodem is designed for real-time audio transmission and reception, it also supports reading from and writing to audio files. This is invaluable for testing, debugging, offline processing, and archiving modem transmissions.File Backend
minimodem uses libsndfile to provide comprehensive audio file format support (src/simpleaudio-sndfile.c). When you specify the--file flag, minimodem automatically switches from real-time audio to file-based I/O.
Supported Audio Formats
The file backend supports numerous audio formats through libsndfile (src/simpleaudio-sndfile.c:111-140):Common Formats
- WAV - Microsoft WAVE
- AIFF - Audio IFF
- FLAC - Free Lossless
- OGG - Ogg Vorbis
Professional Formats
- AU - Sun/NeXT
- CAF - Core Audio
- W64 - 64-bit WAVE
- RF64 - 64-bit broadcast
Specialized Formats
- VOC - Creative Labs
- RAW - Raw PCM
- IRCAM - IRCAM
- MAT4/MAT5 - MATLAB
Format Detection: The audio format is automatically detected from the file extension. For example,
.wav creates a WAV file, .flac creates a FLAC file, etc.Writing Audio Files
Use the--file flag with --tx to write transmitted audio to a file:
Basic File Writing
- WAV Format
- FLAC Format
- RAW Format
Sample Formats
minimodem supports two sample formats:Sample Format Selection:
- S16: 16-bit signed integer, smaller files, sufficient for most uses
- FLOAT: 32-bit floating point, larger files, better for audio processing
Complete Transmission Examples
Reading Audio Files
Use the--file flag with --rx (or just no mode flag) to decode from an audio file:
Basic File Reading
- Decode WAV
- Decode FLAC
- Decode Any Format
Advanced Decoding
File Format Details
Sample Rate
Audio files can have any sample rate, but common values are:48000 Hz
Default - Excellent quality, widely compatible
44100 Hz
CD Quality - Slightly smaller files
96000 Hz
High Resolution - Better for weak signals
8000 Hz
Narrow Band - Smaller files, limited frequency range
Channels
minimodem only supports mono (1-channel) audio (src/minimodem.c:535):Converting Stereo to Mono
Testing Workflow
Using audio files is perfect for testing and validation:Practical Applications
Create Test Signals
Archive Transmissions
Process Recorded Audio
Quality Testing
Format Conversion
Performance Considerations
File Mode vs Real-Time Mode
File mode has different characteristics than real-time mode:File Mode
- No real-time constraints
- Can process faster than real-time
- No audio buffer underruns
- Suitable for batch processing
- No interactive timing features
Real-Time Mode
- Must keep up with audio stream
- Processes at exactly 1× speed
- Possible audio glitches
- Interactive features enabled
- Leader/trailer tones added
Processing Speed
File decoding can be much faster than real-time:Technical Details
File Backend Implementation
The sndfile backend (src/simpleaudio-sndfile.c:160-220):Sample Format Handling
Reading samples (src/simpleaudio-sndfile.c:43-74):PEAK Chunk
For floating-point WAV/AIFF files, minimodem disables the PEAK chunk header (src/simpleaudio-sndfile.c:203-210):This ensures that the same input always produces byte-identical output files, which is important for testing and verification.
Troubleshooting
Cannot open file
Cannot open file
Error:
filename.wav: System errorSolutions:- Check file exists and is readable
- Verify file extension matches format
- Try absolute path:
--file /full/path/to/file.wav - Check file permissions
Unsupported format
Unsupported format
Error:
minimodem was configured without sndfileSolutions:- Rebuild minimodem with libsndfile support
- Check build configuration:
minimodem --version - Use package manager to install version with file support
Wrong channel count
Wrong channel count
Error:
input stream must be 1-channel (not 2)Solutions:- Convert stereo to mono:
sox stereo.wav -c 1 mono.wav - Or with ffmpeg:
ffmpeg -i stereo.wav -ac 1 mono.wav
Poor decode quality from file
Poor decode quality from file
Symptoms: Garbled output or low confidenceSolutions:
- Check sample rate:
--samplerate 48000 - Try auto-carrier:
--auto-carrier - Lower confidence threshold:
--confidence 1.0 - Increase search limit:
--limit 5.0 - Verify file isn’t corrupted: Play it with audio player
Large file sizes
Large file sizes
Symptoms: WAV files are very largeSolutions:
- Use FLAC compression:
--file output.flac - Lower sample rate:
--samplerate 44100 - Use S16 format instead of FLOAT
- Compress after:
xz output.wav
See Also
- Transmit Mode - Generate FSK signals
- Receive Mode - Decode FSK signals
- Real-Time Audio - Using live audio devices
- Data Transfer - Complete data transfer workflows