Simple, dependency-light continuous recording library for Dodotronic Ultramic384k_evo USB microphone; install with pip, works anywhere.
Built on sounddevice (PortAudio), so it runs the same way on Linux, macOS, and Windows — no platform-specific audio backend required.
- Automatic device detection by name (no hardcoded device indices)
- Waits for USB enumeration with a configurable timeout
- Verifies the device supports the target sample rate before recording
- Continuous recording with automatic file rotation (new
.wavevery N seconds) - Simple CLI entry point, plus a Python API for use in your own scripts
- Zero required dependencies beyond
sounddevice,soundfile, andnumpy
pip install ultramicFor local development:
git clone git@github.com:jgers32/ultramic.git
cd ultramic
uv venv
source .venv/bin/activate
uv pip install -e ".[dev,viz]"ultramic --audio-dir ./audio --file-duration 600This will:
- Wait for a device with "UltraMic" in its name to enumerate (default timeout: 30s)
- Verify it supports 384kHz recording
- Record continuously, rotating to a new timestamped
.wavfile every 600 seconds - Log status and errors to
./errors/
Run ultramic --help for all options.
from pathlib import Path
from ultramic import wait_for_device, verify_sample_rate, record_continuous
device = wait_for_device(timeout=30)
if not verify_sample_rate(device, sample_rate=384000):
raise RuntimeError("Device doesn't support 384kHz")
record_continuous(device, output_dir=Path("./audio"), file_duration_sec=600)See examples/ for more:
examples/list_devices.py— list all available input devices and their namesexamples/basic_record.py— minimal find-device-and-record exampleexamples/timed_recording.py— record for a fixed total duration and stop automatically
pip install "ultramic[viz]"
ultramic-viz path/to/recording.wavSaves a combined figure to ./plots/<filename>.png (use --plots-dir to change the output location).
pytest # unit tests only — no hardware required, safe for CI
pytest -m hardware # hardware-dependent tests — requires a real UltraMic attached
pytest -v # verbose outputtests/test_device.py and tests/test_recorder.py mock the audio backend and test pure logic (device matching, timeout handling, sample-rate checks) — these run anywhere, with no hardware needed.
tests/test_hardware.py exercises the real device: finding it, verifying its sample rate, and recording actual audio. These are marker-gated and skipped by default since they require physical hardware.
- WSL: the UltraMic must be passed through to WSL with
usbipd bind/usbipd attachbefore it will be visible toultramic. Without this step,wait_for_devicewill time out as if no device were connected. - Sample rate: UltraMic devices default to 384kHz, well above what most audio tooling assumes (16–48kHz). If you extend the visualization or add feature extraction, double-check that any library defaults (FFT window size, mel filter count, etc.) are adjusted for this — see
src/ultramic/viz.pyfor an example of tuningn_fftandfmaxfor high sample rates.
- Gain switch verification: utility to check/report the state of the Ultramic gain (adjustable via the slider on the side)
Additional ideas? Please open an issue on Github
MIT — see LICENSE.