Simple Command Line Language

polypaudio provides a simple command line language used by configuration scripts as well as the modules module-cli and module-cli-protocol-{unix,tcp}. Empty lines and lines beginning with a hashmark (#) are silently ignored. Several commands are supported:

Miscellaneous Commands

help

Show a quick help on the commands available.

exit

Terminate the daemon. If you want to terminate a CLI connection ("log out") you might want to use C-d.

Status Commands

modules

Show all currently loaded modules with their arguments.

sinks/sources

Show all currently registered sinks (resp. sources).

clients

Show all currently active clients.

sink_inputs/sink_outputs

Show all currently active inputs to sinks (resp. outputs of sources).

stat

Show some simple statistics about the allocated memory blocks and the space used by them.

info

A combination of all status commands described above. ls and list are synonyms for info.

Module Management

load

Load a module specified by its name and arguments. For most modules it is OK to be loaded more than once.

unload

Unload a module specified by its index in the module list as returned by modules.

Configuration Commands

sink_volume

Set the volume of the specified sink. You may specify the sink either by its index in the sink list or by its name. The volume should be an integer value greater or equal than 0 (= muted). Volume 256 (0x100) is normal volume, values greater than this amplify the audio signal with clipping.

sink_input_volume

Set the volume of a sink input specified by its index the the sink input list. The same volume rules apply as with sink_volume.

sink_default/source_default

Make a sink (resp. source) the default. You may specify the sink (resp. ssource) by its index in the sink (resp. source) list or by its name.

Sample Cache

scache_list

Lists the contents of the sample cache.

scache_play

Play a sample cache entry to a sink. Expects the sample name and the sink name as arguments.

sache_remove

Remove an entry from the sample cache. Expects the sample name as argument.

sache_load

Load an audio file to the sample cache. Expects the file name to load and the desired sample name as arguments.

Module Autoloading

autoload_list

Lists all currently defined autoloading entries.

autoload_sink_add/autoload_source_add

Adds an autoloading entry for a sink (resp. source). Expects the sink name (resp. source name), the module name and the module arguments as arguments.

autoload_sink_remove/autoload_source_remove

Remove an autoloading entry. Expects the sink name (resp. source name) as argument.

Miscellaneous Commands

play_file

Play an audio file to a sink. Expects the file name and the sink name as argumens.

dump

Dump the daemon's current configuration in CLI commands.

Killing Clients/Streams

kill_client

Remove a client forcibly from the server. There is no protection that the client reconnects immediately.

kill_sink_input/kill_source_output

Remove a sink input (resp. source output) forcibly from the server. This will not remove the owning client or any other streams opened by the client from the server.

Meta Commands

In addition the the commands described above there a few meta directives supported by the command line interpreter:

.include

Executes the commands from the specified script file.

.fail/.nofail

Enable (resp. disable) that following failing commands will cancel the execution of the current script file. This is a ignored when used on the interactive command line.

.verbose/.noverbose

Enable (resp. disable) extra verbosity.

Example Configuration Script

Mark the following script as executable (chmod +x) and run it for a sensible polypaudio configuration.

#!/usr/bin/polaudio -F

# Create autoload entries for the device drivers
autoload_sink_add output module-alsa-sink device=plughw:0,0 rate=48000 sink_name=output
autoload_source_add input load module-alsa-source device=hw:1,0 source_name=input

# Load several protocols
load module-esound-protocol-tcp
load module-simple-protocol-tcp
load module-native-protocol-unix
load module-cli-protocol-unix

# Load the CLI module (This is similar to passing "-C" on the command line of polypaudio)
load module-cli

# Make some devices default
sink_default output
source_default input

# Don't fail if the audio files referred to below don't exist
.nofail

# Load an audio to the sample cache for usage with module-x11-bell
scache_load /usr/share/sounds/KDE_Notify.wav x11-bell
load module-x11-bell

# Play a welcome sound
play_file /usr/share/sounds/startup3.wav output

Lennart Poettering <@PACKAGE_BUGREPORT@>, September 2004
$Id$