Reusable Python audio engine with crossfade and beat-aware transition planning.
Project description
Veloura
Veloura is a reusable Python audio transition engine for smooth queue playback. It provides FFmpeg-backed PCM decoding, equal-power crossfades, transition analysis, beat-aware planning, and a small CLI for local inspection.
Veloura is framework-agnostic. Use it in streamer tools, radio pipelines, desktop music apps, Discord/Twitch bots, or backend automation without tying your project to one bot implementation.
Features
- Equal-power crossfade mixing for signed 16-bit PCM audio
- Discord-independent PCM queue player with snapshots and playback controls
- Smart transition planning based on track duration, silence trim, and loudness
- Beat/BPM analysis with beat-aware transition plans
- Project-local or user-cache transition analysis storage
- Optional
yt-dlpstream resolution for URLs and search queries - Optional Discord audio source compatibility
- Pure-Python PCM fallback for Python builds without
audioop
Requirements
- Python 3.12 or newer
- FFmpeg for decoding, playback, silence analysis, loudness analysis, and beat analysis
yt-dlponly when resolving online stream/search inputsdiscord.pyandPyNaClonly when using the Discord audio source directly
Installation
Install the core package:
pip install veloura-audio
Install stream resolution support:
pip install "veloura-audio[stream]"
Install Discord voice support:
pip install "veloura-audio[discord]"
Install every optional integration:
pip install "veloura-audio[all]"
Quick Start
from veloura.audio import AudioTrack, PCMQueuePlayer, transition_preset
config = transition_preset("streamer")
track = AudioTrack.from_source(
"/music/current-song.flac",
title="Artist - Current Song",
duration=184,
)
player = PCMQueuePlayer(volume=0.65, crossfade_seconds=config.base_crossfade_seconds)
player.enqueue(track)
frame = player.read_frame()
For online sources, install veloura-audio[stream] and resolve a playable stream:
import asyncio
from veloura.audio import resolve_stream_track, transition_preset
async def main():
track = await resolve_stream_track(
"artist song official audio",
transition_config=transition_preset("streamer"),
)
print(track.title, track.stream_url)
asyncio.run(main())
CLI
Veloura exposes the same core tools through python -m veloura or the
veloura console script:
python -m veloura presets
python -m veloura prepare ./song.mp3 --preset streamer
python -m veloura analyze ./song.mp3
python -m veloura plan ./current.mp3 ./next.mp3 --preset broadcast
For YouTube/search inputs, install veloura-audio[stream] and add --resolve:
python -m veloura plan "current song" "next song" --preset streamer --resolve
Transition analysis is cached under ~/.cache/veloura by default, or under the
directory set in VELOURA_CACHE_DIR. Use --cache-dir for a project-local
cache, or --no-cache when comparing fresh analysis.
Presets
streamer: balanced transitions for livestream/background musicbroadcast: longer, smoother radio-style blendslow-latency: shorter analysis windows for weaker machines or fast queuesautomix: beat-aware pair planning with conservative tempo matching
Aliases such as streamer-safe, broadcast-smooth, auto-mix, and fast are also
available.
For adjacent tracks, call prepare_automix_transition_pair before playback of
the next track starts. It analyzes beat windows, applies a pair-specific
crossfade length, trims weak intro audio on confident matches, and nudges tempo
only within a small safe range.
Apps that manage playback through PCMQueuePlayer can call
player.prepare_next_transition_pair(...) when the current and next track are
known. Discord bots can keep using CrossfadeAudioSource as an adapter for
Discord voice playback.
Standalone Example
The example player resolves local files or stream queries, prepares transition
analysis, mixes the queue, and pipes PCM into ffplay:
python examples/streamer_player.py ./song-a.mp3 ./song-b.mp3 --preset streamer
python examples/streamer_player.py ./song-a.mp3 ./song-b.mp3 --cache-dir ./veloura-cache
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veloura_audio-0.5.0.tar.gz.
File metadata
- Download URL: veloura_audio-0.5.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4d12f2f2e2d374da097fe280d6bcdd1da5e9a6e3e4dbac07869460eb92d629b
|
|
| MD5 |
5ed4e6cb0974e1023e2ae995747542e6
|
|
| BLAKE2b-256 |
b9fc61f7a2f3444135ef76da4c5b769c81463ca93ed816f7a3ecce4e4ccda4b2
|
Provenance
The following attestation bundles were made for veloura_audio-0.5.0.tar.gz:
Publisher:
release.yml on VelouraAudio/veloura-audio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veloura_audio-0.5.0.tar.gz -
Subject digest:
d4d12f2f2e2d374da097fe280d6bcdd1da5e9a6e3e4dbac07869460eb92d629b - Sigstore transparency entry: 1751267688
- Sigstore integration time:
-
Permalink:
VelouraAudio/veloura-audio@618edd9db1a2d1a6bcc1c7cbe20ef4d43ae64462 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/VelouraAudio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@618edd9db1a2d1a6bcc1c7cbe20ef4d43ae64462 -
Trigger Event:
release
-
Statement type:
File details
Details for the file veloura_audio-0.5.0-py3-none-any.whl.
File metadata
- Download URL: veloura_audio-0.5.0-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a4365694bf27e3c17f20f30d9b526e8a80fb27916f91a3d3cb7f215ec43dea
|
|
| MD5 |
7694def8a6fc4746af9d80e31b10c24b
|
|
| BLAKE2b-256 |
90399d460b94b1e5de2f96a2cff898592f3a0736b34c39dffd68171b7342280b
|
Provenance
The following attestation bundles were made for veloura_audio-0.5.0-py3-none-any.whl:
Publisher:
release.yml on VelouraAudio/veloura-audio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veloura_audio-0.5.0-py3-none-any.whl -
Subject digest:
60a4365694bf27e3c17f20f30d9b526e8a80fb27916f91a3d3cb7f215ec43dea - Sigstore transparency entry: 1751267782
- Sigstore integration time:
-
Permalink:
VelouraAudio/veloura-audio@618edd9db1a2d1a6bcc1c7cbe20ef4d43ae64462 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/VelouraAudio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@618edd9db1a2d1a6bcc1c7cbe20ef4d43ae64462 -
Trigger Event:
release
-
Statement type: