Skip to main content

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
  • Queue/session helpers for buffering, skip, and current-track snapshots
  • 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
  • FFmpeg for decoding, playback, silence analysis, loudness analysis, and beat analysis
  • 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]"

Quick Start

from veloura.audio import AudioTrack, CrossfadeSession, transition_preset

config = transition_preset("streamer")

track = AudioTrack.from_source(
    "/music/current-song.flac",
    title="Artist - Current Song",
    duration=184,
)

session = CrossfadeSession(volume=0.65, crossfade_seconds=config.base_crossfade_seconds)
session.source.enqueue(track)

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

Aliases such as streamer-safe, broadcast-smooth, and fast are also available.

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


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.3.1.tar.gz (28.4 kB 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.3.1-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: veloura_audio-0.3.1.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for veloura_audio-0.3.1.tar.gz
Algorithm Hash digest
SHA256 add76cb3f7eb0ab9bef13a6da0e0c42cf01ba50a15aeca82ff7afc92d0fe2f11
MD5 7fb81833eae4cd8255dd0fd6b335e138
BLAKE2b-256 820263b662d950ad06878c4eac784f3b89654849e3c0d98fc7975ebea5f091e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for veloura_audio-0.3.1.tar.gz:

Publisher: release.yml on VelouraAudio/veloura-audio

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

File details

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

File metadata

  • Download URL: veloura_audio-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for veloura_audio-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0e0f5f8c4b2434684ba456ea127f9922e709138ea8621659a16f5660e90e7ed
MD5 8cc4f78f6f824ce4438e9af501cc3f18
BLAKE2b-256 bb866412fa4aceb1c3d50a452e78a23c8e63e0a174f7771188e6cf18e5c3ec65

See more details on using hashes here.

Provenance

The following attestation bundles were made for veloura_audio-0.3.1-py3-none-any.whl:

Publisher: release.yml on VelouraAudio/veloura-audio

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