Mobile and Embedded Linux Solutions

Home / Labs / ALSA Use Case Manager

Modern mobile devices are increasingly required to provide a rich set of audio functionality required by todays applications. This richer functionality places additional requirements on the audio hardware and leads to further complexity. Example: a modern Linux phone could have as much as 80 bespoke ALSA audio controls to manage different use cases.

The ALSA Use Case Manager (UCM) is a LGPL library designed to allow high level control of audio use cases in sound device hardware. It is intended to be used by applications to quickly and easily change the hardware audio use case of a device in a generic and portable manner.

This library is not meant to replace gstreamer, PulseAudio or a sound server, but is meant to work in tandem with such audio software.


The ALSA Use Case Manager (UCM) provides the following features.

  • Consistent and simple C API. The library provides simple and consistent methods to change use case and thus make applications more portable across different devices.
  • Ability to change any ALSA audio control type. This includes signal gain and signal routing (through mixers and muxes).
  • Gain and mixer aliasing. Different use cases may use different hardware gain controls (e.g. some hardware has different hardware gain controls for headphone and speaker volumes) . The library can alias controls so that the correct volume control is updated no matter what use case is in operation.

  • Source Code

    ALSA Use Case Manager (UCM) has been released in alsa-lib 1.0.24.

    UCM abstracts  sound card mixer controls into high level use case verbs like “phone call” or “music”.

    UCM stores the mixer settings per use case in configuration files, the files contain information like:

  • List of use case verbs per card or machine – The use case verb is the audio use case action.
    e.g. the “phone call” use case verb will configure the audio hardware for phone call playback and capture. Other example verbs are:  FM Analog Radio, HiFi Music, etc.
  • Supported devices per use case verb
    e.g configures hardware for Speaker, Line, Headphones, Headset, Handset. etc. for each use case. The use case could be HiFi music and the device could be set to either Speaker or Headphones, etc.
  • Use case sink device
  • Use case source device
    e.g. pcm0 is the sink for music, pcm3 is the sink for tones
  • Hardware playback volume control id (per use case verb and device)
  • Hardware playback mute switch id
  • Hardware capture volume control id
  • Hardware capture mute switch id
    e.g. The ALSA mixer control id that directly affects the audio for each use case and device.
  • Look at alsa-lib/include/use-case.h to get a more detailed description.

    Compiling alsa-lib and alsa-utils

    To get the UCM it is needed the rls 1.0.24 or later

    1. Clone alsa-lib from
    2. Checkout master branch
    3. Compile alsa-lib
    • ./gitcompile
    • ./configure –prefix=/usr
    • make
    • sudo make instal
    1. Clone alsa-utils from alsa-project
    2. Checkout master branch
    3. ./gitcompile
    4. make
    5. sudo make install

    Running the UCM

    The UCM needs at lest two files to work, they are:
    – master sound card file
    – at least one use case file.

    The following files has been used to test the UCM. HDA-Intel.conf is the master sound card file and hifi is the HiFi UCM verb config. After create your configuration files, copy them to /usr/share/alsa/ucm/<card_name> e.g /usr/share/alsa/ucm/HDA-Intel

    Basic commands
    – Start UCM on interactive mode
    $alsaucm -c HDA-Intel -i

    – List verbs availables per card
    $alsaucm -c HDA-Intel list _verbs

    – To set a verb
    $alsaucm -c HDA-Intel set _verb HiFi

    – List devices (only after set verb)
    $alsaucm -c HDA-Intel list _devices

    – List modifiers (only after set verb)
    $alsaucm -c HDA-Intel list _modifiers

    It is possible to use a batch file to execute several UCM commands

    $alsaucm -b test.batch

    Development is discussed on the ALSA development mailing list and on IRC channel  #alsa-soc on