# Realization of audio use cases
Source: [https://docs.qualcomm.com/doc/80-70014-16/topic/realization_of_audio_use_cases.html](https://docs.qualcomm.com/doc/80-70014-16/topic/realization_of_audio_use_cases.html)
Each audio use case is represented as a graph consisting of subgraphs of a specific
type. Each subgraph consists of one or more functional software blocks (referred to as
modules) that perform a specific function.
## Audio graph concepts and terminology
| **Use case** | A graph of modules from source end point(s) to sink end
point(s) that satisfies the product defined use case. |
| --- | --- |
| **Graph** | A logical interpretation of a group of one or more sub-graphs
connected together to realize a specific use case. |
| **Subgraph** | A logical abstraction for a group of modules that are
connected and manipulated as a single entity. |
| **Container** | Object that allows the system designer to group and execute
audio processing modules together in single software
thread. |
| **Module** | The smallest independent processing unit within signal
processing framework. |
| **Key value (KV) pair** | The individual key and associated values in a key vector.
For example, a key could be a sound device and a value
could be headphone, speaker, or some other sound
device. |
| **Key vector** | Uniquely identifies a graph or subgraph through a set of KV
pairs. All KV pairs are defined at:
build-qcom-wayland/workspace/sources/mm-audio-headers/proprietary/mm-audio-headers/acdbdata/kvh2xml.h |
| **Graph key vector (GKV)** | GKV is a unique identifier used to retrieve a graph which is
represented by a set of multiple KV pairs. The graph or system
designer associates a set of unique <keys> and <values>
when creating a subgraph from the QACT UI canvas. |
| **Calibration key vector (CKV)** | CKV is a unique identifier used to retrieve calibration data
which is represented by a set of multiple KV pairs. The graph or
system designer associates a set of unique <keys> and
<values> when storing calibration data. |
| **Tag and tag key vector (TKV)** | A tag is an identifier used to set runtime parameters for one
or more modules. It allows updating module configurations (e.g.,
enabling/disabling features like echo cancellation or
equalization) within a graph at runtime. |
## Graph segments
An audio use case is comprised of the following segments. The front-end generally
represents stream and streamPP subgraphs, while the back-end represents the PSPD,
devicePP, and device subgraphs.
| **Stream** | Provides a data write/read interface and performs decoding
and encoding of data if it is compressed |
| --- | --- |
| **StreamPP** | Contains stream-based processing modules (for example,
equalizer) |
| **Per-stream per-device (PSPD)** | Contains a module to convert the stream media format to the
device media format |
| **DevicePP** | Contains of processing modules for sound device
tuning |
| **Device** | Hardware endpoint such as CodecDMA (Soundwire), I2S, or TDM
port |
Once a front-end is connected to a back-end via a routing mixer control, the full GKV
is formed by concatenating the subgraph GKVs and the CKVs assigned via mixer
controls. Upon opening the front-end PCM or compress device, AGM invokes GSL APIs
with concatenated GKVs and CKVs to set up the graph in SPF and apply calibration. At
the same time, AGM opens a kernel PCM device corresponding to the connected
back-ends to begin audio peripheral setup.
## Sample audio graph
The follow diagram shows an example audio graph
for a playback scenario.

In this graph:
1. The stream subgraph consists of a write shared memory endpoint, PCM decoder,
and PCM converter. The client passes PCM samples to write shared memory
endpoint.
2. The PCM converter converts PCM samples to a format supported by the
stream-specific post-processing modules if conversion is necessary.
3. Output of the stream subgraph is fed into the stream-device subgraph, which
contains the media format converter (MFC). MFC converts the stream-subgraph
PCM to the device-subgraph PCM format.
4. After conversion, output of the stream-device subgraph is fed into the
device PP subgraph for device-specific post-processing. A mixer is placed at
the beginning of subgraph to mix input streams.
5. Output of the devicePP subgraph is then fed into the device subgraph, which
contains a hardware endpoint module such as an I2S driver.
The following is the GKV for this example
graph:
GKV1:
GKV2:
Copy to clipboard
## Audio calibration database (ACDB)
The ACDB is a static database located on the apps processor. It contains all
tuning/calibration parameters for the LPAI. Calibration data for various audio
modules for various use cases is organized in an \*.acdb file format that can be
edited using a PC-based tool called QACT and placed on the device file system in the
/etc/acdbdata/ folder. During use case initialization or device switch, the AML
queries the ACDB database with a given GKV and pushes the device calibration data to
SPF.
**Parent Topic:** [Software](https://docs.qualcomm.com/doc/80-70014-16/topic/software.html)
Last Published: Jul 15, 2024
[Previous Topic
Signal Processing Framework (SPF)](https://docs.qualcomm.com/bundle/publicresource/80-70014-16/topics/spf_sw.md) [Next Topic
Audio Bringup](https://docs.qualcomm.com/bundle/publicresource/80-70014-16/topics/bring_up.md)