Skip to main content

Base utilities for working with the Umik-1 microphone in Python applications.

Project description

๐ŸŽค audio-tools โ€” Audio Measurement CLI

A modular Python CLI for real-time audio measurement with USB microphones.

Supports UMIK-1, UMIK-2, Dayton UMM-6, Earthworks M23/M30, and other USB measurement mics. Auto-detects known devices, validates sample rate support, and applies per-unit calibration files.

๐Ÿ“ฆ Installation

APT โ€” Linux (Recommended for Raspberry Pi and Ubuntu)

curl -fsSL "https://br-se1.magaluobjects.com/audio-tools/audio-tools/pubkey.gpg" \
  | sudo gpg --dearmor -o /usr/share/keyrings/audio-tools.gpg
echo "deb [signed-by=/usr/share/keyrings/audio-tools.gpg] https://br-se1.magaluobjects.com/audio-tools/audio-tools $(lsb_release -cs) main" \
  | sudo tee /etc/apt/sources.list.d/audio-tools.list
sudo apt-get update && sudo apt-get install audio-tools

System dependencies (libportaudio2, libsndfile1, ffmpeg, libzmq3-dev) are installed automatically.

๐Ÿ“ Raspberry Pi 4B verified. Perfect headless acoustic monitoring box.

pip

pip install umik-base-app

Requires system libraries:

# Linux (Debian/Ubuntu)
sudo apt install libportaudio2 libsndfile1 ffmpeg libzmq3-dev -y

# macOS
brew install portaudio libsndfile zeromq ffmpeg

๐Ÿ•น๏ธ CLI Reference

audio-tools --<command> [options]
Command Description
audio-tools --devices ๐Ÿ” List available audio input devices
audio-tools --meter ๐Ÿ“Š Real-time SPL / LUFS / dBFS meter
audio-tools --record ๐ŸŽ™๏ธ Calibrated audio recorder (WAV)
audio-tools --calibrate ๐Ÿ”ง Generate FIR filter from a calibration file
audio-tools --analyze ๐Ÿ”ฌ Analyze a WAV file and export metrics to CSV
audio-tools --plot ๐Ÿ“ˆ Plot a metrics CSV as a chart
audio-tools --batch ๐Ÿ“ Batch-analyze a directory of WAV files
audio-tools --enhance โœจ Filter and enhance voice audio
audio-tools --convert ๐Ÿ”„ Convert WAV recordings to OGG / MP3 / AAC

Pass --help after any command for full options:

audio-tools --meter --help
audio-tools --convert --help

โšก Quick Start

# 1. Find your microphone's device ID
audio-tools --devices

# 2. Run the SPL meter (system default mic)
audio-tools --meter

# 3. Run with UMIK-1 calibration file
audio-tools --meter --calibration-file "umik-1/7175488.txt"

# 4. Record calibrated audio
audio-tools --record --calibration-file "umik-1/7175488.txt" --output-dir recordings/

๐Ÿƒ Run Modes

Monolithic (Default)

Single process โ€” simplest for desktop and testing.

audio-tools --meter --calibration-file "umik-1/7175488.txt"

๐Ÿ‘น Daemon Mode โ€” Unstoppable Ear

Run capture at high priority. Processing crashes never interrupt the audio stream.

# Terminal 1: high-priority capture process
sudo nice -n -20 audio-tools --meter --producer \
  --calibration-file "umik-1/7175488.txt" --zmq-port 5555

# Terminal 2: connect consumer (safe to open/close/crash)
audio-tools --meter --consumer --zmq-host localhost --zmq-port 5555

๐ŸŒ Distributed Mode โ€” Remote Sentry

Capture on a Raspberry Pi, visualize on your laptop.

# On the Raspberry Pi
audio-tools --meter --producer \
  --calibration-file "umik-1/7175488.txt" --zmq-port 5555

# On your laptop
audio-tools --meter --consumer --zmq-host 192.168.1.50 --zmq-port 5555

๐ŸŽ›๏ธ Calibration Files

Download the per-unit calibration file for your UMIK from miniDSP.

Auto-discovery

Place the file in one of these locations and it will be picked up automatically on the next run โ€” no --calibration-file flag needed:

Location Scope
~/.config/audio-tools/ Per-user
/etc/audio-tools/ System-wide

If multiple files are found, the app prompts you to select one interactively. If a calibrated microphone is detected but no file is found, the app warns you and asks for confirmation before running uncalibrated.

Sample files (installed with the package)

The .deb package ships sample calibration files to:

/usr/share/audio-tools/calibration/

These are not auto-discovered โ€” they are reference copies only. To activate one, copy it to an auto-discovery location:

# Per-user (recommended)
mkdir -p ~/.config/audio-tools
cp /usr/share/audio-tools/calibration/7175488_90deg.txt ~/.config/audio-tools/

# Or system-wide
sudo cp /usr/share/audio-tools/calibration/7175488_90deg.txt /etc/audio-tools/

File layout

umik-1/
โ”œโ”€โ”€ 7175488.txt           โ† 0ยฐ on-axis. Use when pointing at a speaker.
โ”œโ”€โ”€ 7175488_90deg.txt     โ† 90ยฐ ambient. Use when pointing at the ceiling.
โ””โ”€โ”€ 7175488_fir_*.npy     โ† [Generated] FIR filter cache (created on first run).

Generate or verify the FIR filter cache:

audio-tools --calibrate "umik-1/7175488.txt"

๐Ÿ–ฅ๏ธ Real-Time Dashboard (TUI)

Add --tui to get a live terminal dashboard instead of scrolling log output:

audio-tools --meter --tui
audio-tools --meter --tui --calibration-file "umik-1/7175488.txt"

Built with Textual:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  audio-tools --meter          Calibration: FULL (FIR) โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  dBFS  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  โ”‚  dBSPL   72.4 dB               โ”‚
โ”‚ -24.3  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  โ”‚  LUFS   -28.1 LUFS             โ”‚
โ”‚        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  โ”‚  RMS     0.0241                โ”‚
โ”‚                      โ”‚  Flux    38.6                  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Mode: MONOLITHIC    SR: 48000 Hz   โ— REC   [R] Stop  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Key Action
R ๐Ÿ”ด Toggle recording on/off
Q โŒ Quit

Press R to start recording โ€” audio is saved to recordings/ as a timestamped WAV. Press R again to stop; a notification pops with the filename.

๐Ÿ”ฌ Analysis & Visualization

# Analyze one file โ†’ CSV
audio-tools --analyze "recording.wav" --calibration-file "umik-1/7175488.txt"

# Batch analyze a directory โ†’ CSV per file
audio-tools --batch recordings/ --calibration-file "umik-1/7175488.txt"

# View chart (popup window)
audio-tools --plot "recording_metrics.csv"

# Save chart to PNG
audio-tools --plot "recording_metrics.csv" --save

๐Ÿ”„ Convert Audio

Convert WAV recordings to share-friendly formats. Requires ffmpeg.

# OGG/Opus โ€” smallest, WhatsApp-compatible
audio-tools --convert recordings/ --format ogg

# Multiple formats in one pass
audio-tools --convert recordings/session.wav --format ogg mp3

# Output to a different directory
audio-tools --convert recordings/ --format ogg --out converted/

# Overwrite existing files
audio-tools --convert recordings/ --format ogg --overwrite
Format Use Case
ogg ๐Ÿ“ฑ WhatsApp voice notes (smallest)
mp3 ๐ŸŽต Universal
aac ๐ŸŽ Apple-friendly (.m4a)

๐Ÿ”— Related Projects

AI Acoustic Monitor โ€” adds ML sound classification (chainsaws, glass breaking, birds) on embedded devices, built on this framework: py-edge-ai-acoustic-monitoring-app

๐Ÿ› ๏ธ For Developers

Building a custom app on this framework? See CONTRIBUTING.md.

Full technical documentation: docs/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

umik_base_app-0.8.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

umik_base_app-0.8.0-py3-none-any.whl (84.2 kB view details)

Uploaded Python 3

File details

Details for the file umik_base_app-0.8.0.tar.gz.

File metadata

  • Download URL: umik_base_app-0.8.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for umik_base_app-0.8.0.tar.gz
Algorithm Hash digest
SHA256 15c905f91e64a5ba2360c95e0ab2fa83056f40896d8ffc2aea6ea20e037f172e
MD5 95afa5c656d85682892934fdd26e628b
BLAKE2b-256 84a964f1d70f41c744a8e59a5e35f221a5089029ce74962b20125a31a2fee878

See more details on using hashes here.

File details

Details for the file umik_base_app-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: umik_base_app-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 84.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for umik_base_app-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a4e4c0f8c8240dddbadf8dd581a7af83ec68f198dfa0cc0f3b4401621b40c93
MD5 6aa9c85cee02fcb034b81942540f6990
BLAKE2b-256 7947ab1a0d026e7d1686a40e4662a1740452d0e42ec06356fdb18d34050a20b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page