Skip to main content

Overview

Real-time audio is minimodem’s primary mode of operation, allowing live transmission and reception of FSK signals through your computer’s audio hardware. minimodem supports multiple audio backends for maximum compatibility across different operating systems and audio subsystems.

Audio Backends

minimodem supports several audio backends (src/simpleaudio.c:69-117):

System Default

Automatically selects the best available backend for your system:
  • Linux: PulseAudio → ALSA → sndio
  • BSD: sndio → PulseAudio
minimodem --tx 1200  # Uses system default

PulseAudio

Modern Linux audio server with network support
minimodem --tx 1200  # Usually auto-selected on Linux

ALSA

Low-level Linux audio interface for direct hardware access
minimodem --tx 1200 --alsa
minimodem --tx 1200 --alsa=hw:0,0

sndio

OpenBSD’s audio and MIDI framework
minimodem --tx 1200 --sndio
minimodem --tx 1200 --sndio=rsnd/0
Backend Selection: If no backend is specified, minimodem uses SA_BACKEND_SYSDEFAULT which automatically selects PulseAudio on most Linux systems, ALSA if PulseAudio is unavailable, or sndio on BSD systems.

System Default Backend

The simplest way to use minimodem is with the default backend:

Transmit with Default Backend

# Transmit to default audio output
echo "HELLO" | minimodem --tx 1200

# Receive from default audio input
minimodem --rx 1200
The system default automatically selects (src/simpleaudio.c:83-94):
  1. PulseAudio if available (most Linux desktops)
  2. ALSA if PulseAudio unavailable (Linux)
  3. sndio if neither available (BSD systems)

PulseAudio Backend

PulseAudio is the default on most modern Linux systems and provides the most user-friendly experience:

Basic PulseAudio Usage

# Uses PulseAudio automatically
echo "TEST" | minimodem --tx 1200

# Receive with PulseAudio
minimodem --rx 1200

PulseAudio Features

Network Transparency

Send audio to remote PulseAudio servers over network

Application Mixing

Multiple applications can use audio simultaneously

Per-App Volume

Control minimodem’s volume independently using pavucontrol

Device Hotplug

Handles USB audio devices connecting/disconnecting

Checking PulseAudio

# List PulseAudio sinks (outputs)
pactl list short sinks

# List PulseAudio sources (inputs)
pactl list short sources

# Check default sink
pactl info | grep "Default Sink"

# Check default source
pactl info | grep "Default Source"

ALSA Backend

ALSA provides direct hardware access and lower latency, useful for embedded systems or when PulseAudio is unavailable:

Basic ALSA Usage

# Use ALSA backend with default device
echo "TEST" | minimodem --tx 1200 --alsa

# Receive with ALSA
minimodem --rx 1200 --alsa

Specifying ALSA Devices

ALSA devices are specified using the format hw:X,Y or plughw:X,Y:
# Card 0, Device 0 (direct hardware access)
minimodem --tx 1200 --alsa=hw:0,0

# Card 1, Device 0 (USB audio, typically)
minimodem --tx 1200 --alsa=hw:1,0

# Receive from specific device
minimodem --rx 1200 --alsa=hw:0,0
hw vs plughw:
  • hw:X,Y - Direct hardware access, no format conversion
  • plughw:X,Y - Plugin device with automatic format/rate conversion (recommended)

Listing ALSA Devices

# List all PCM devices
aplay -l

# List capture devices
arecord -l

# Test playback
speaker-test -D hw:0,0 -c 1 -t sine

# Test recording
arecord -D hw:0,0 -f S16_LE -c 1 -r 48000 -d 5 test.wav

Example ALSA Output

$ aplay -l
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Use hw:0,0 for built-in audio or hw:1,0 for USB device.

sndio Backend

Used primarily on OpenBSD and other BSD systems:

Basic sndio Usage

# Use default sndio device
echo "TEST" | minimodem --tx 1200 --sndio

# Receive with sndio
minimodem --rx 1200 --sndio

Specifying sndio Devices

# Default audio device
minimodem --tx 1200 --sndio=rsnd/0

# Alternative device
minimodem --tx 1200 --sndio=rsnd/1

# Receive from specific device
minimodem --rx 1200 --sndio=rsnd/0

Checking sndio Devices

# On OpenBSD, check audio devices
sndioctl -n

# List available devices
ls -l /dev/audio*

Audio Configuration

Sample Rate

minimodem defaults to 48000 Hz, but you can change it:
# Default 48 kHz
minimodem --tx 1200

# CD quality 44.1 kHz
minimodem --tx 1200 --samplerate 44100

# High resolution 96 kHz
minimodem --tx 1200 -R 96000

# Lower rate for older hardware
minimodem --tx 1200 -R 22050
Sample Rate Limits: The sample rate must be at least 2× the highest frequency in your signal (Nyquist theorem). For Bell 202 (2200 Hz space tone), use at least 4400 Hz, but 48000 Hz is strongly recommended.

Sample Format

minimodem supports two sample formats (src/simpleaudio.c:54-67):
# Default for transmit mode
echo "TEST" | minimodem --tx 1200

# 16-bit signed integer samples
# Range: -32768 to +32767
# Size: 2 bytes per sample
Use when: Standard audio, file size matters
Receive Mode: Always uses FLOAT format internally for FFT processing (src/minimodem.c:786-788), regardless of the --float-samples flag.

Volume Control

Adjust transmit volume:
# Full volume (default)
echo "TEST" | minimodem --tx 1200 --volume 1.0

# Half volume
echo "TEST" | minimodem --tx 1200 -v 0.5

# Quarter volume (good for testing)
echo "TEST" | minimodem --tx 1200 -v 0.25

# Very quiet (minimum audible)
echo "TEST" | minimodem --tx 1200 -v 0.1

Interactive Transmission

When transmitting to real-time audio (not a file), minimodem enables interactive features:

Interactive Features

1

Leader tone

Transmits 2 bits of mark tone before data begins
tx_leader_bits_len = 2;
Allows receivers to lock onto the carrier before data arrives
2

Trailer tone

Transmits 2 bits of mark tone after data ends
tx_trailer_bits_len = 2;
Ensures the last data bit is fully transmitted
3

Idle carrier

Emits mark tone during input pauses
idle_carrier_usec = (1000000/25);  // 1/25 second
Maintains carrier during typing pauses
4

Buffer flush

Adds 0.5 seconds of silence at the end
tx_flush_nsamples = sample_rate/2;
Ensures audio buffers are completely flushed

Example Interactive Session

# Start interactive transmit
$ minimodem --tx 300

# Type message (each character transmitted immediately)
HELLO
# Press Ctrl+D to end transmission

# With EOT marker
$ minimodem --tx 300 --print-eot
HELLO
^D
### EOT

Real-Time Reception

Basic Reception

# Receive from default microphone
minimodem --rx 1200

# Receive with status output
minimodem --rx 1200
### CARRIER 1200 @ 1200.0 Hz ###
HELLO WORLD
### NOCARRIER ndata=11 confidence=2.456 ampl=0.892 bps=1199.98 ###

Monitoring Reception

# See all status messages
minimodem --rx 1200

Troubleshooting

Symptoms: No sound when transmittingSolutions:
# Check volume
echo "TEST" | minimodem --tx 1200 --volume 1.0

# Try specific backend
echo "TEST" | minimodem --tx 1200 --alsa=plughw:0,0

# Test with file output first
echo "TEST" | minimodem --tx 1200 --file test.wav
aplay test.wav

# Check ALSA mixer levels
alsamixer

# Check PulseAudio
pavucontrol
Symptoms: Carrier never detectedSolutions:
# Test microphone with ALSA
arecord -f S16_LE -r 48000 -c 1 -d 5 test.wav
aplay test.wav

# Try specific ALSA device
minimodem --rx 1200 --alsa=plughw:0,0

# Check mixer levels
alsamixer

# Increase input gain in PulseAudio
pavucontrol  # Recording tab

# Lower confidence threshold
minimodem --rx 1200 --confidence 1.0
Error: Device or resource busySolutions:
# Check what's using the device
fuser -v /dev/snd/*

# Use PulseAudio instead (supports mixing)
minimodem --tx 1200  # Don't specify --alsa

# Kill conflicting process
sudo killall -9 processname

# Use different device
minimodem --tx 1200 --alsa=plughw:1,0
Symptoms: Crackling, pops, or buffer underrunsSolutions:
  • Reduce system load (close other applications)
  • Increase audio buffer size (PulseAudio configuration)
  • Use ALSA for lower latency
  • Reduce sample rate: --samplerate 44100
  • Check dmesg for hardware errors
# Check for xruns (ALSA buffer underruns)
dmesg | grep -i xrun
Symptoms: Audio goes to/from wrong deviceSolutions:
# Explicitly specify device
minimodem --tx 1200 --alsa=plughw:1,0

# Check ALSA defaults
cat ~/.asoundrc

# Set PulseAudio default
pacmd set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo
pacmd set-default-source alsa_input.pci-0000_00_1b.0.analog-stereo

# Or use pavucontrol GUI
pavucontrol
Error: no such sa_backend. not configured at build?Solutions:
  • Check build configuration: minimodem --version
  • Install required backend:
    # For ALSA support
    sudo apt-get install libasound2-dev
    
    # For PulseAudio support
    sudo apt-get install libpulse-dev
    
    # Then rebuild minimodem
    
  • Use available backend (system default usually works)

Advanced Configuration

ALSA Configuration File

Create ~/.asoundrc for custom ALSA configuration:
# Set default device
pcm.!default {
    type hw
    card 0
    device 0
}

# Named device for minimodem
pcm.modem {
    type plug
    slave {
        pcm "hw:0,0"
        rate 48000
        channels 1
    }
}
Then use:
minimodem --tx 1200 --alsa=modem

PulseAudio Configuration

Edit /etc/pulse/daemon.conf for system-wide settings:
# Increase buffer size for reliability
default-fragment-size-msec = 25

# Reduce resampling quality if CPU-constrained
resample-method = speex-float-1

USB Audio Devices

USB audio devices typically appear as card 1:
# List USB audio devices
lsusb | grep -i audio

# Use USB device with ALSA
minimodem --tx 1200 --alsa=plughw:1,0

# With PulseAudio (auto-detected usually)
minimodem --tx 1200

Performance Optimization

Use ALSA for Low Latency

minimodem --tx 1200 --alsa=hw:0,0
Direct hardware access, minimal overhead

Use PulseAudio for Convenience

minimodem --tx 1200
Automatic device management, mixing

Lower Sample Rate

minimodem --tx 1200 -R 44100
Reduces CPU usage and memory bandwidth

Optimize Search Limit

minimodem --rx 1200 --limit 2.0
Reduces CPU usage in receive mode

See Also

Build docs developers (and LLMs) love