Skip to main content

Overview

minimodem supports multiple audio backend systems for maximum portability across different operating systems and configurations:
  • ALSA - Advanced Linux Sound Architecture (Linux)
  • PulseAudio - Cross-platform sound server (Linux, BSD, others)
  • sndio - Simple audio API (OpenBSD, other BSD systems)
  • sndfile - Audio file I/O (all platforms)
The build system automatically configures available backends based on your system’s libraries.

Backend Selection

System Default

When no backend is specified, minimodem uses the system default:
minimodem --rx 1200
minimodem --tx 1200
The default backend priority (from src/simpleaudio.c lines 83-93):
  1. PulseAudio (if available)
  2. ALSA (if PulseAudio not available)
  3. sndio (if neither above available)
The system default is determined at compile time based on which libraries are available when minimodem is built.

Explicit Backend Selection

You can force a specific backend using command-line options:
# Use ALSA
minimodem --rx --alsa 1200

# Use PulseAudio (default, explicit)
minimodem --rx 1200

# Use sndio
minimodem --rx --sndio 1200

# Use file I/O
minimodem --rx --file recording.wav 1200

ALSA Backend

Overview

ALSA (Advanced Linux Sound Architecture) provides low-latency audio access on Linux systems.

Command-Line Option

--alsa[=device]
-A[device]

Device Specification

Default device:
minimodem --rx --alsa 1200
# Uses "default" ALSA device
Specific hardware device:
minimodem --rx --alsa=hw:0,0 1200
minimodem --rx --alsa=plughw:1,0 1200
Card and device numbers:
minimodem --rx --alsa=0,0 1200
# Automatically expands to plughw:0,0

minimodem --rx --alsa=1 1200
# Automatically expands to plughw:1,0
The plughw: prefix enables ALSA’s plugin layer for sample rate conversion and format adaptation. Use hw: for direct hardware access (may fail if sample rate doesn’t match).

Implementation Details

From src/simpleaudio-alsa.c lines 117-127:
char *be_device;
if ( ! backend_device ) {
    be_device = "default";
} else {
    if ( strchr(backend_device, ':') )
        snprintf(be_device, 32, "%s", backend_device);
    else if ( strchr(backend_device, ',') )
        snprintf(be_device, 32, "plughw:%s", backend_device);
    else
        snprintf(be_device, 32, "plughw:%s,0", backend_device);
}

Examples

List ALSA Devices

aplay -l
# Output:
card 0: PCH [HDA Intel PCH], device 0: ALC295 Analog [ALC295 Analog]
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]

Use USB Audio Device

minimodem --rx --alsa=plughw:1,0 1200

Use Default Device

minimodem --tx --alsa 1200

Configuration

ALSA parameters (from src/simpleaudio-alsa.c line 152):
  • Format: S16 or FLOAT
  • Access: Interleaved
  • Channels: Typically 1 (mono)
  • Sample rate: Default 48000 Hz (configurable with --samplerate)
  • Latency: 100ms buffer
  • Soft resample: Enabled
If minimodem fails to open an ALSA device, check that:
  1. The device exists (aplay -l)
  2. No other application is using the device exclusively
  3. You have permission to access the audio device

PulseAudio Backend

Overview

PulseAudio is a sound server that provides network-transparent audio and automatic device management.

Automatic Operation

PulseAudio is the default backend on most modern Linux systems:
minimodem --rx 1200
# Automatically uses PulseAudio if available

Implementation Details

From src/simpleaudio-pulse.c:
  • Uses pa_simple API for straightforward audio I/O
  • Automatically selects default source (recording) or sink (playback)
  • Handles sample format conversion automatically

Configuration

Buffer attributes (lines 116-127):
pa_buffer_attr attr = {
    .maxlength = (uint32_t)-1,
    .tlength = (uint32_t)-1,
    .prebuf = (uint32_t)-1,
    .minreq = (uint32_t)-1,
    .fragsize = (uint32_t)-1,
};

attr.fragsize = 0;  /* lowest possible capture latency */
attr.tlength = 0;   /* lowest possible playback latency */

Advantages

  • Automatic device management
  • Network audio support
  • Per-application volume control
  • Better integration with desktop environments

Examples

# Receive with PulseAudio
minimodem --rx 300

# Transmit with PulseAudio
echo "Test" | minimodem --tx 1200
Use pavucontrol (PulseAudio Volume Control) to monitor minimodem’s audio streams in real-time and adjust input/output devices on the fly.

sndio Backend

Overview

sndio is a small, simple audio and MIDI framework used primarily on OpenBSD and other BSD systems.

Command-Line Option

--sndio[=device]
-s[device]

Device Specification

Default device:
minimodem --rx --sndio 1200
# Uses SIO_DEVANY (system default)
Specific device:
minimodem --rx --sndio=rsnd/0 1200
minimodem --tx --sndio=rsnd/1 1200

Implementation Details

From src/simpleaudio-sndio.c lines 84-111:
const char *be_device;
if ( ! backend_device )
    be_device = SIO_DEVANY;
else
    be_device = backend_device;

hdl = sio_open(
    be_device,
    sa_stream_direction == SA_STREAM_RECORD ? SIO_REC : SIO_PLAY,
    0 /* nbio_flag */);

Supported Formats

  • S16: 16-bit signed integer (supported)
  • FLOAT: Not currently supported in sndio backend
The sndio backend does not support --float-samples option. Use S16 format (the default) instead.

Configuration

From lines 90-103:
par.bits = 16;
par.sig = 1;           /* signed */
par.le = SIO_LE_NATIVE; /* native endianness */
par.bps = SIO_BPS(par.bits);
par.rate = rate;
par.xrun = SIO_IGNORE;  /* ignore overruns/underruns */

File I/O Backend (sndfile)

Overview

The sndfile backend enables reading from and writing to audio files instead of live audio devices.

Command-Line Option

--file <filename>
-f <filename>

Supported Formats

From src/simpleaudio-sndfile.c lines 111-141, supported file formats include:
  • WAV - Microsoft Wave
  • AIFF - Apple Audio Interchange File Format
  • FLAC - Free Lossless Audio Codec
  • OGG - Ogg Vorbis
  • AU - Sun/NeXT audio
  • RAW - Raw PCM data
  • And many more…
The format is automatically detected from the file extension.

Examples

Receive from Audio File

minimodem --rx --file recording.wav 1200
minimodem --rx -f signal.flac 300

Transmit to Audio File

echo "Hello" | minimodem --tx --file output.wav 1200
echo "Test" | minimodem --tx -f data.flac 300

Use with Pipes

# Decode from stdin
sox -t alsa default -t wav - | minimodem --rx --file - 1200

# Encode to stdout
echo "Test" | minimodem --tx --file - 1200 | aplay
File I/O is perfect for:
  • Offline decoding and analysis
  • Creating test signals
  • Debugging communication issues
  • Archiving FSK transmissions

Implementation Details

Automatic format detection (lines 144-157):
static unsigned int
sndfile_format_from_path( const char *path )
{
    const char *p = strrchr(path, '.');
    if ( p )
        p++;
    else
        p = path;

    for ( sfmt=sndfile_formats; sfmt->str; sfmt++ )
        if ( strcasecmp(sfmt->str,p) == 0 )
            return sfmt->major_format;
    return SF_FORMAT_WAV; /* default */
}

Sample Format Selection

minimodem supports two sample formats:

S16 (16-bit Integer)

Default format:
minimodem --rx 1200
# Uses 16-bit signed integer samples
  • Pros: Lower memory usage, faster processing
  • Cons: Slightly lower precision
  • Typical use: Most applications, real-time decoding

FLOAT (32-bit Float)

Enable with --float-samples:
minimodem --tx --float-samples --file output.wav 1200
  • Pros: Higher precision, better for analysis
  • Cons: More memory, slightly slower
  • Typical use: File generation, quality-critical applications
  • Required: For RX mode (automatically enabled)
Receive mode automatically uses floating-point samples internally for FFT processing, regardless of the --float-samples option.

Sample Rate Configuration

Set sample rate with --samplerate (-R):
minimodem --rx --samplerate 48000 1200  # Default
minimodem --rx --samplerate 96000 1200  # High quality
minimodem --rx --samplerate 24000 1200  # Low bandwidth
Higher sample rates increase CPU usage and memory requirements. Use 48000 Hz unless you have specific needs:
  • 96000 Hz: Very high baud rates or wide frequency spans
  • 24000 Hz: Embedded systems or low-power devices

Build Configuration

Checking Available Backends

When building from source, configure displays enabled backends:
./configure
# Output:
option summary:
    alsa           yes (1)
    pulseaudio     yes (1)
    sndfile        yes (1)
    sndio          no (0)

Disabling Backends

From configure.ac lines 19-65:
# Build without ALSA
./configure --without-alsa

# Build without PulseAudio
./configure --without-pulseaudio

# Build without sndio
./configure --without-sndio

# Build without sndfile
./configure --without-sndfile
At least one backend must be enabled. If all system audio backends (ALSA, PulseAudio, sndio) are disabled, you must enable sndfile for file-only operation.

Troubleshooting

Backend Not Available

Error: This build of minimodem was configured without alsa support Solution: Rebuild minimodem with the required backend:
./configure --with-alsa
make clean && make
sudo make install

Device Busy

Error: Cannot create ALSA stream: Device or resource busy Solutions:
  1. Close other applications using the audio device
  2. Try PulseAudio backend instead: minimodem --rx 1200
  3. Check for exclusive access: fuser -v /dev/snd/*

No Sound Output

Problem: Minimodem runs but no audio is transmitted Solutions:
  1. Check mixer settings: alsamixer
  2. Verify device selection: --alsa=plughw:0,0
  3. Test audio path: speaker-test -t sine
  4. Increase volume: Use system volume controls

Poor Quality or Dropouts

Problem: Audio has glitches, clicks, or missing frames Solutions:
  1. Increase buffer size (not directly configurable in minimodem)
  2. Close CPU-intensive applications
  3. Use ALSA directly instead of PulseAudio
  4. Reduce sample rate if very high

Best Practices

  • Use PulseAudio for desktop systems (easiest, most compatible)
  • Use ALSA directly for low-latency embedded applications
  • Use sndfile for offline processing and testing
  • Match sample rates between TX and RX when possible
  • Test audio path before attempting FSK communication

Performance Comparison

BackendLatencyCPU UsageCompatibility
ALSALowLowLinux only
PulseAudioMediumMediumCross-platform
sndioLowLowBSD focus
sndfileN/ALowAll platforms

Advanced Examples

Record and Decode Pipeline

# Record audio and decode simultaneously
minimodem --rx --alsa=hw:1,0 1200 | tee output.txt

Multi-Channel Recording

# Capture from specific channel
minimodem --rx --alsa=plughw:0,0 1200

Network Audio Streaming

With PulseAudio network audio:
# On receiver
export PULSE_SERVER=tcp:receiver.local
minimodem --rx 1200

# On transmitter
export PULSE_SERVER=tcp:transmitter.local
echo "Data" | minimodem --tx 1200

Batch File Processing

# Decode multiple files
for file in *.wav; do
    echo "Processing $file"
    minimodem --rx -f "$file" 1200 > "${file%.wav}.txt"
done

See Also

Build docs developers (and LLMs) love