Skip to main content

ultramic

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.

Features

  • 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 .wav every N seconds)
  • Simple CLI entry point, plus a Python API for use in your own scripts
  • Zero required dependencies beyond sounddevice, soundfile, and numpy

Installation

pip install ultramic

For local development:

git clone git@github.com:jgers32/ultramic.git
cd ultramic
uv venv
source .venv/bin/activate
uv pip install -e ".[dev,viz]"

Quickstart (CLI)

ultramic --audio-dir ./audio --file-duration 600

This will:

  1. Wait for a device with "UltraMic" in its name to enumerate (default timeout: 30s)
  2. Verify it supports 384kHz recording
  3. Record continuously, rotating to a new timestamped .wav file every 600 seconds
  4. Log status and errors to ./errors/

Run ultramic --help for all options.

Quickstart (Python API)

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 names
  • examples/basic_record.py — minimal find-device-and-record example
  • examples/timed_recording.py — record for a fixed total duration and stop automatically

Visualizing a recording

pip install "ultramic[viz]"
ultramic-viz path/to/recording.wav

Saves a combined figure to ./plots/<filename>.png (use --plots-dir to change the output location).

Testing

pytest              # unit tests only — no hardware required, safe for CI
pytest -m hardware   # hardware-dependent tests — requires a real UltraMic attached
pytest -v            # verbose output

tests/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.

Platform notes

  • WSL: the UltraMic must be passed through to WSL with usbipd bind / usbipd attach before it will be visible to ultramic. Without this step, wait_for_device will 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.py for an example of tuning n_fft and fmax for high sample rates.

Coming Soon!

  • 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

License

MIT — see LICENSE.

Release files for ultramic 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ultramic 0.1.3
File Size Uploaded
ultramic-0.1.3.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ultramic 0.1.3
File Interpreter ABI Platform
ultramic-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / ultramic-0.1.3.tar.gz

Download URL ultramic-0.1.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb205d9c252509f7914c99815f671258fa80cc56c2e336b75b296de04b5f659
BLAKE2b-256 checksum
How to use checksums
cc415b6bdd53c305180ee8cdf3770a8bd8e19b1bfa69f7d9663900905b699b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / ultramic-0.1.3-py3-none-any.whl

Download URL ultramic-0.1.3-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bd4a48409070bce2d92dc2a0352c0b3159e13bcd6bdd9e5326c713bd35a16c8
BLAKE2b-256 checksum
How to use checksums
c8f8a5b7e3c57976e19dc4afcd8032a6bf5295bb9fdb9729172079a13aff2fcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page