Real-Time Processing Priority in Ecasound
This article explains how to enable real-time processing priority in Ecasound to achieve low-latency, glitch-free audio performance. You will learn the specific command-line parameter required to activate this mode, how to configure scheduling policies and priority levels, and the system permissions needed for real-time execution.
The Real-Time Parameter: -r
In Ecasound, the command-line parameter used to enable real-time
processing priority is -r (or its
long-form equivalent, --realtime).
When you pass this option, Ecasound requests real-time scheduling privileges from the operating system kernel. This prioritizes audio processing threads over standard system tasks, significantly reducing buffer underruns (xruns) and latency during playback, recording, or signal processing.
Syntax and Options
The -r option can be used as a standalone flag or with
specific scheduling parameters:
Basic syntax:
ecasound -r -i input.wav -o alsaRunning with just
-rinstructs Ecasound to use default real-time scheduling (typicallySCHED_FIFOwith a default priority level).Detailed syntax with custom policy and priority:
ecasound -r:sched_policy,priority -i input.wav -o alsaYou can explicitly define the scheduling algorithm and priority level:
sched_policy: The POSIX scheduling policy, commonlyfifo(SCHED_FIFO) orrr(SCHED_RR).priority: An integer representing the real-time priority level (typically between 1 and 99, where higher numbers indicate higher priority).
Example Command
To launch an Ecasound session using the SCHED_FIFO
policy with a priority level of 50:
ecasound -r:fifo,50 -i:somefile.wav -o:alsa,defaultSystem Requirements and Permissions
To use real-time priority without running as the root
superuser, your Linux user account must have appropriate resource limits
configured.
Ensure your user belongs to the audio group and that
/etc/security/limits.conf (or a file in
/etc/security/limits.d/) grants real-time priority
permissions:
@audio - rtprio 95
@audio - memlock unlimited
If these limits are not properly set, Ecasound will display a warning or error indicating that it was unable to acquire real-time scheduling privileges, falling back to standard scheduling instead.