Ecasound Support for Legacy OSS Audio Devices

Ecasound provides native, robust support for the Open Sound System (OSS) architecture through direct device-node interfacing, standardized system calls, and dedicated command-line object types. This article outlines the mechanisms Ecasound uses to communicate with legacy OSS interfaces, detailing device syntax, driver-level control, buffer management, and modern emulation layers.

Native OSS Audio Objects

Ecasound treats audio sources and destinations as abstract objects. For legacy OSS devices, it provides a built-in object format specified as oss. To route audio to or from an OSS device, users define input and output targets using the syntax:

-i oss,/dev/dsp
-o oss,/dev/dsp

If multiple sound cards or non-standard device nodes are present, paths like /dev/dsp1 or /dev/sound/dsp can be specified directly. Ecasound parses this prefix and routes audio streams through its internal OSS driver backend rather than modern ALSA or JACK subsystems.

Direct Driver Communication via IOCTLs

Ecasound interacts directly with OSS kernel drivers through POSIX open(), read(), write(), and ioctl() system calls. When an OSS object is initialized, Ecasound configures the hardware parameters using standard OSS ioctl commands:

  • Sample Format Negotiation: Uses SNDCTL_DSP_SETFMT to query and set bit depths (such as 8-bit unsigned or 16-bit signed PCM).
  • Channel Mapping: Uses SNDCTL_DSP_CHANNELS to configure mono, stereo, or multi-channel arrangements supported by the device.
  • Sampling Rate Selection: Uses SNDCTL_DSP_SPEED to request and verify sampling frequencies.
  • Duplex Handshaking: Ecasound can open the /dev/dsp device in O_RDWR mode, leveraging SNDCTL_DSP_SETDUPLEX to enable simultaneous input and output processing on hardware supporting full-duplex operation.

Fragment and Buffer Control

Legacy OSS uses a fragment-based buffering model rather than the ring-buffer structures common in modern systems. OSS drivers allocate buffers divided into fragments defined by a power-of-two size and a fragment count.

Ecasound bridges its internal processing buffers with OSS fragments via the SNDCTL_DSP_SETFRAGMENT ioctl. When configuring processing pipelines with the -b (buffer size) parameter, Ecasound calculates and sets the nearest matching fragment configuration. This ensures that real-time multitrack recording and signal processing avoid buffer under-runs (dropouts) while keeping latency deterministic.

OSS Mixer Access

Beyond PCM audio transfer, Ecasound provides an integrated interface for managing hardware levels on OSS devices via /dev/mixer. Through the -ev and related chain operator parameters, or via the interactive Ecasound control mode, it communicates with the OSS mixer using SOUND_MIXER_READ and SOUND_MIXER_WRITE ioctls to manage input gain, master volumes, and recording sources directly.

Compatibility with Modern Emulation Layers

While standard Linux distributions now rely primarily on ALSA or PipeWire, Ecasound's OSS support remains functional on modern systems through emulation:

  • Kernel ALSA Emulation: If the ALSA compatibility modules snd-pcm-oss and snd-mixer-oss are loaded, Ecasound interfaces seamlessly with the resulting /dev/dsp nodes without modification.
  • Userspace Emulation Wrappers: Utilities like aoss (from alsa-oss) or padsp (from PulseAudio) can wrap Ecasound, redirecting its OSS standard POSIX calls into contemporary sound servers.