Repository navigation
sof-ucm: Add GTK4 end-to-end pipeline visualizer and ALSA UCM2 editor #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| PYTHON ?= python3 | ||
| INSTALL ?= install | ||
| PREFIX ?= /usr | ||
| BINDIR ?= $(PREFIX)/bin | ||
| DATADIR ?= $(PREFIX)/share | ||
| APPDIR ?= $(DATADIR)/sof-utils/sof-ucm | ||
| DESKDIR ?= $(DATADIR)/applications | ||
| DESTDIR ?= | ||
|
|
||
| PY_SRCS := $(wildcard sof_ucm/*.py) | ||
|
|
||
| .PHONY: all check install uninstall clean | ||
|
|
||
| all: check | ||
|
|
||
| check: | ||
| $(PYTHON) -B -m py_compile sof-ucm $(PY_SRCS) $(wildcard tests/*.py) | ||
| $(PYTHON) -B -m unittest discover -s tests | ||
|
|
||
| install: | ||
| $(INSTALL) -d "$(DESTDIR)$(BINDIR)" | ||
| $(INSTALL) -d "$(DESTDIR)$(APPDIR)/sof_ucm" | ||
| $(INSTALL) -d "$(DESTDIR)$(DESKDIR)" | ||
| $(INSTALL) -m 0755 sof-ucm "$(DESTDIR)$(APPDIR)/sof-ucm" | ||
| $(INSTALL) -m 0644 $(PY_SRCS) "$(DESTDIR)$(APPDIR)/sof_ucm/" | ||
| $(INSTALL) -m 0644 pyproject.toml requirements.txt README.md "$(DESTDIR)$(APPDIR)/" | ||
| $(INSTALL) -m 0644 desktop/org.thesofproject.SofUcm.desktop "$(DESTDIR)$(DESKDIR)/org.thesofproject.SofUcm.desktop" | ||
| ln -sf "$(APPDIR)/sof-ucm" "$(DESTDIR)$(BINDIR)/sof-ucm" | ||
|
|
||
| uninstall: | ||
| rm -f "$(DESTDIR)$(BINDIR)/sof-ucm" | ||
| rm -f "$(DESTDIR)$(DESKDIR)/org.thesofproject.SofUcm.desktop" | ||
| rm -rf "$(DESTDIR)$(APPDIR)" | ||
|
|
||
| clean: | ||
| rm -rf sof_ucm/__pycache__ tests/__pycache__ __pycache__ build dist *.egg-info | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SOF UCM (`sof-ucm`) | ||
|
|
||
| **SOF UCM** is a GTK4 end-to-end audio pipeline visualizer and ALSA UCM2 profile editor/generator for Sound Open Firmware (SOF) systems — supporting both the **local machine** and **remote DUTs via SSH**. | ||
|
|
||
| --- | ||
|
|
||
| ## Features | ||
|
|
||
| - **Full Audio Stack Discovery (Local or Remote SSH)**: | ||
| - Enumerates ALSA sound cards (`/proc/asound/cards`, `/sys/class/sound`, DMI) and PCM/Compress streams. | ||
| - Auto-detects and parses the active binary topology (`.tplg`) including DSP pipelines, modules, pin formats, routes, and widget-owned kcontrols. | ||
| - Reads all ALSA kcontrols (`amixer -c N contents`: volumes, switches, enums, bytes, TLV dB scales, jacks). | ||
| - Reads live ASoC DAPM widgets, routes, bias levels, and DPCM FE→BE states from `/sys/kernel/debug/asoc` (with automatic synthesis fallback when debugfs is unprivileged). | ||
| - **GTK4 + `Gtk.Snapshot` + Cairo End-to-End Graph**: | ||
| - Renders each pipeline from **ALSA PCM → Host Copier → DSP Modules/Mixers/Gains → DAI Copier → Codec DAPM → Hardware Endpoint** in the visual style of `sof-builder`. | ||
| - Interactive vertical `VOL` faders, `SW` toggles, and `ENUM` popovers anchored beneath their owning DSP/Codec/Endpoint nodes. | ||
| - **ALSA UCM2 Visualization, Editing & Creation**: | ||
| - Parses and evaluates UCM2 profiles (`Syntax 4..7`, `SectionUseCase`, `SectionVerb`, `SectionDevice`, `SectionModifier`, `BootSequence`, `If`/`Condition`, `Include`). | ||
| - Highlights the exact PCM, DSP modules, kcontrols, and hardware endpoints claimed by checked UCM devices. | ||
| - **New UCM Wizard**: Auto-generates a UCM2 profile by tracing PCM-to-endpoint paths in the live graph. | ||
| - **Record → UCM**: Dragging sliders/toggles on the canvas records `cset` steps into the selected device's `EnableSequence`. | ||
| - **Validate & Test (`alsaucm`)**: Stages edits in a temporary `ALSA_CONFIG_UCM2` directory and tests them live without overwriting system files. | ||
|
|
||
| --- | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| # Inspect local machine: | ||
| ./sof-ucm | ||
|
|
||
| # Inspect a specific local card or explicit .tplg: | ||
| ./sof-ucm --card 2 --tplg /lib/firmware/intel/sof-ipc4-tplg/sof-hda-generic.tplg | ||
|
|
||
| # Inspect & configure a remote DUT via SSH: | ||
| ./sof-ucm --ssh root@dut-host | ||
|
|
||
| # Headless offscreen PNG export: | ||
| ./sof-ucm --card 2 --render-png pipeline.png | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## License | ||
|
|
||
| SPDX-License-Identifier: `BSD-3-Clause` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [Desktop Entry] | ||
| Type=Application | ||
| Name=SOF UCM | ||
| GenericName=SOF End-to-End Pipeline Visualizer & ALSA UCM2 Editor | ||
| Comment=Visualize PCM-to-Hardware Audio Pipelines and Edit/Create ALSA UCM2 Profiles | ||
| Exec=sof-ucm | ||
| Icon=audio-card | ||
| Terminal=false | ||
| Categories=Development;AudioVideo;Audio; | ||
| Keywords=SOF;ALSA;UCM;UCM2;DAPM;Topology;DSP;GTK4; | ||
| StartupWMClass=org.thesofproject.SofUcm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| [build-system] | ||
| requires = ["setuptools>=61.0"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "sof-ucm" | ||
| version = "0.1.0" | ||
| description = "SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor" | ||
| readme = "README.md" | ||
| license = { text = "BSD-3-Clause" } | ||
| requires-python = ">=3.10" | ||
| authors = [ | ||
| { name = "Liam Girdwood", email = "liam.r.girdwood@intel.com" }, | ||
| ] | ||
| keywords = ["sof", "sound-open-firmware", "alsa", "ucm", "ucm2", "dapm", "topology", "gtk4"] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Environment :: X11 Applications :: GTK", | ||
| "Intended Audience :: Developers", | ||
| "License :: OSI Approved :: BSD License", | ||
| "Operating System :: POSIX :: Linux", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: 3.14", | ||
| "Topic :: Multimedia :: Sound/Audio", | ||
| ] | ||
| dependencies = [ | ||
| "PyGObject>=3.42.0", | ||
| "pycairo>=1.20.0", | ||
| ] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/thesofproject/sof-utils" | ||
| Repository = "https://github.com/thesofproject/sof-utils" | ||
| Issues = "https://github.com/thesofproject/sof-utils/issues" | ||
|
|
||
| [project.scripts] | ||
| sof-ucm = "sof_ucm.main:main" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
| include = ["sof_ucm*"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| PyGObject>=3.42.0 | ||
| pycairo>=1.20.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/usr/bin/env python3 | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| """Launcher script for SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & UCM2 Editor.""" | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) | ||
|
|
||
| from sof_ucm.main import main | ||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
| """SOF UCM — GTK4 End-to-End Audio Pipeline Visualizer & ALSA UCM2 Editor.""" | ||
|
|
||
| __version__ = "0.1.0" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the
tests/suite here too (takes ~0.6s) so top-levelmake check/make testvalidatessof-ucm/testsas well as syntax: