Skip to main content

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-dlp stream 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
  • Veloura installs imageio-ffmpeg by default and uses its bundled FFmpeg executable when system ffmpeg is not available
  • System ffplay is only needed for the standalone local player example
  • yt-dlp only when resolving online stream/search inputs
  • discord.py and PyNaCl only 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]"

Verify the installed package:

python -c "import veloura; print(veloura.__version__)"
python -m veloura doctor

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 doctor
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 music
  • broadcast: longer, smoother radio-style blends
  • low-latency: shorter analysis windows for weaker machines or fast queues
  • automix: 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.

Discord Bot Integration

Keep your bot commands, queue state, and permissions in your Discord project. Use Veloura as the audio transition layer:

from veloura.audio import CrossfadeAudioSource, resolve_stream_track, transition_preset

config = transition_preset("streamer")
source = CrossfadeAudioSource(crossfade_seconds=config.base_crossfade_seconds)

track = await resolve_stream_track(
    "artist song official audio",
    transition_config=config,
)

source.enqueue(track)
voice_client.play(source)

Standalone Example

The example player resolves local files or stream queries, prepares transition analysis, mixes the queue, and pipes PCM into ffplay. This example needs a system FFmpeg install with ffplay available:

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

Free Transition Demo

The website includes a small transition clip rendered from CC0 music sources with PCMQueuePlayer. Regenerate it with:

python examples/generate_transition_demo_audio.py

Demo music sources:

Both source pages list the license as CC0. Attribution is not required by CC0, but Veloura credits the sources so the demo has clear provenance.

Troubleshooting

  • Run python -m veloura doctor to verify FFmpeg and optional integrations.
  • Set VELOURA_FFMPEG=/path/to/ffmpeg if you want Veloura to use a specific FFmpeg executable instead of the bundled provider.
  • Install system FFmpeg if you want to use the standalone ffplay example.
  • Install veloura-audio[stream] when resolving YouTube URLs or search queries through yt-dlp.
  • Install veloura-audio[discord] when using CrossfadeAudioSource directly with Discord voice playback.
  • Run python -m veloura presets to confirm the CLI entry point is installed.

Download files

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

Source Distribution

veloura_audio-0.5.3.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

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

veloura_audio-0.5.3-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file veloura_audio-0.5.3.tar.gz.

File metadata

  • Download URL: veloura_audio-0.5.3.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for veloura_audio-0.5.3.tar.gz
Algorithm Hash digest
SHA256 2311d7132ae5e0db0ddc7aa2b0bf8f1ef00020c2ae965add1cfacf92f3576122
MD5 e10ec0b50e7615a3965f7a6a0e70bdfe
BLAKE2b-256 d824cda77409a7fc007d47bb653dc45b695095cd041a3732d0b8c8ef68aa2003

See more details on using hashes here.

File details

Details for the file veloura_audio-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: veloura_audio-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for veloura_audio-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 edf7833140ae1211b7bcb31e120d7357c6420375f9a3439f2f9078c4a8eda014
MD5 cd671e4d761df0feb5418441ab5cfe41
BLAKE2b-256 7840ba2a651d9d1f966a34aa288feaa0e70f8d9092a4d8d2bdc1b3b281c360ea

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