MixerTUI 1.5

Posted on February 23, 2024

MixerTUI is an audio mixer with a terminal user interface (TUI) for the FreeBSD sound system. It allow to switch easily between laptop and HDMI, headphones and speakers, and so on. Features include: show the current driver configuration, select an audio device to get information, change the volume, or make the device the default. The version 1.5 is out!

Window in a terminal with bars to select volume


To install the port audio/mixertui:

# cd /usr/ports/audio/mixertui/ && make install clean

To add the package:

# pkg install mixertui

To build from sources:

Step 1. Install deps

# pkg install bsddialog libsysctlmibinfo2

Step 2. Download, build, and run

% git clone https://gitlab.com/alfix/mixertui.git
% cd mixertui
% make
% ./mixertui

Version 1.5 Changes and Improvements

1) Pop-ups are implemented using libbsddialog, for example the screenshot shows a bsddialog menu. Curiosity, the first version of bsddialog was just a copy of the mixertui pop-ups to implement dialogs, now mixertui uses libbsddialog to show pop-ups.

2) Improvements for the menu to select the device/pcm. The item with the default pcm (sysctl hw.snd.default_unit) has the “(Default)” prefix; pcm4 in the screenshot. Opening the menu the selected item is the current pcm; pcm2 in the screenshot.

Window in a terminal with bars to select volume

3) Fix fault with terminals without colors. Example

% env TERM=vt220 mixertui

Window in a terminal with bars to select volume

4) Few internal refactoring. Probably this is the last C/ncurses version, (see Future subsection below).


Future

MixerTUI started out as a personal project (…game :D). I spent 30 minutes to set up my microphone to record my BSDCan presentation during the first lockdown. I set audio quickly via alsamixer in the past. Now my main laptop runs FreeBSD, so I wrote mixertui to avoid to waste time setting up a microphone, headphones, accessibility, and so on.

The first version was just 1000 lines of code; mainly ncurses stuff because the sound system interface is actually easy: just some ioctl and sysctl. However several users started to use it. I received a lot of tips, feedback, merge request, iussues, email, and so on.

The utility grew messy to implement the user requests. Mainly I spent time to use libncurses, because it does not provides widgets (buttons, title, bars, …), it is just a “render” library. I would have preferred to spend time implementing new audio features instead of “drawing” a bar. ncurses is not suitable. I am considering other TUI libraries to rewrite MixerTUI in the next version 2.0. Under the radar: brick/haskell, tui-rs/rust, FTXUI/C++.

Conclusion, this is just a TUI improvements version. I’ ll rewrite mixertui. TODO, Ideas and new audio features in the future: mouse, virtual_oss, devd, sound(4) improvements, accessibility, and so on.