Skip to main content

AudioQL

A semantic layer for audio.

AudioQL wraps Whisper, pyannote, YAMNet and friends behind one small API. You point it at an audio file and get a semantic timeline — a single stream of events ("speech", "laughter", "music", "silence", ...) you can query with plain English:

from audioql import Audio

audio = Audio("meeting.mp3")

audio.find("laughter")               # all the laughs
audio.find("music after applause")   # sequencing works too
audio.find("speaker:SPEAKER_00")     # one speaker's turns
audio.search("someone discussing AI")  # keyword search over the transcript

No model-specific APIs leak out. Every backend produces the same TimelineEvent, so swapping Whisper for something else doesn't change your code.

Install

The core package is small and has no AI dependencies:

pip install audioql

Model backends are optional extras — install only what you use:

pip install "audioql[whisper]"        # speech-to-text
pip install "audioql[diarization]"    # speaker diarization
pip install "audioql[events]"         # laughter, applause, music detection
pip install "audioql[all]"            # everything

Quickstart

from audioql import Audio

audio = Audio("meeting.mp3")

print(audio.duration)                  # seconds
print(audio.sample_rate)

transcript = audio.transcript()        # needs audioql[whisper]
print(transcript.text)
for seg in transcript.segments:
    print(seg.start, seg.end, seg.text)

print(audio.speakers())                # needs audioql[diarization]

for event in audio.find("laughter"):
    print(event.start, event.end, round(event.confidence, 2))

Analysis runs lazily and the results are cached, so calling timeline(), find(), transcript() and search() on the same Audio only analyzes the file once.

Configuration

Backends are configured with keyword arguments to Audio:

import os

audio = Audio(
    "meeting.mp3",
    whisper={"model": "small", "device": "cpu"},
    diarization={"hf_token": os.getenv("HF_TOKEN")},
)

hf_token also falls back to the HF_TOKEN environment variable, so most setups just work.

Hugging Face setup (required for diarization)

The diarization model pyannote/speaker-diarization-3.1 is gated: you need a Hugging Face account and the model owner must approve your access before the model can be downloaded. This is a one-time setup:

  1. Create a free account at huggingface.co/join.

  2. Open the model page and click Agree and access repository to accept the user conditions.

  3. Create an access token at huggingface.co/settings/tokens (a Read token is enough), then make it available to AudioQL. Either set the HF_TOKEN environment variable:

    # Windows (PowerShell)
    setx HF_TOKEN "hf_xxxx"
    
    # macOS / Linux
    export HF_TOKEN="hf_xxxx"
    

    or pass it directly to Audio:

    audio = Audio("meeting.mp3", diarization={"hf_token": "hf_xxxx"})
    

Transcript-only usage

transcript() also runs speaker diarization to attribute each segment to a speaker whenever the diarization extra is installed. If you only want the transcript (or haven't done the Hugging Face setup yet), disable the speaker plugin:

audio = Audio("meeting.mp3", disabled_plugins=["speaker"])
transcript = audio.transcript()

How it works

audio file
  → loader                 (decodes to mono float32)
  → plugins                (speech, speaker, events, silence)
  → timeline builder       (merges events, fills gaps, detects questions)
  → query engine           (find / search over the timeline)

Plugins are auto-enabled when their dependencies are installed, and disabled when they're not. You can also pass plugins and disabled_plugins to take full control.

Development

python -m venv .venv
.venv\Scripts\activate     # or: source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT

Download files

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

Source Distribution

audioql-0.1.2.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

audioql-0.1.2-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file audioql-0.1.2.tar.gz.

File metadata

  • Download URL: audioql-0.1.2.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for audioql-0.1.2.tar.gz
Algorithm Hash digest
SHA256 55f7f8e7e7c3a2f520d7e57311c49f64ce19a59a52c15c8b2cc02b38537324fe
MD5 537a05912abbf446cea5378347e1ff49
BLAKE2b-256 9a311c20b0acf8f059e218ddb48cecdd406f1d57af0e11bcbd2a75173da0c356

See more details on using hashes here.

Provenance

The following attestation bundles were made for audioql-0.1.2.tar.gz:

Publisher: publish.yml on d-j7code/AudioQL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file audioql-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: audioql-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for audioql-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84b383d71d0874d6b4ad838c90d88c8b09083ee9c6a913485882627ced74476d
MD5 fd824ba528867bb5eb8d16bce2eed1b1
BLAKE2b-256 fdc37d06f13a6bf2574748d6f4b17017e3cc0d27c24c3e40506aaf468d7c30e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for audioql-0.1.2-py3-none-any.whl:

Publisher: publish.yml on d-j7code/AudioQL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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