Skip to main content

An asyncio VBAN implementation

Project description

VBAN Protocol Wrapper

Currently Under Development - WIP

Overview

This project aims to create a modern, ergonomic wrapper around the VBAN protocol. By leveraging modern Python tools such as dataclasses and asyncio, this wrapper provides a simple and efficient interface for working with VBAN.

Features

  • Dataclasses: Utilizes Python's dataclasses for clean, concise and ergonomic data structures.
  • Asyncio: Supports asynchronous operations for non-blocking I/O.
  • Ease of Use: Designed to be simple and intuitive, making it easy to integrate VBAN into your projects.

Installation

To install the package, use pip:

pip install aiovban

Usage

Basic Example

Here's a basic example of how to use the VBAN wrapper:

from aiovban import VBANAudioHeader, VBANPacket
from aiovban import VBANSampleRate

# Create a VBAN audio header
audio_header = VBANAudioHeader(sample_rate=VBANSampleRate.RATE_44100, channels=17, samples_per_frame=3,
                               bit_resolution=3, codec=0xf0, streamname="Channel1")

# Create a VBAN packet
packet = VBANPacket(header=audio_header)

# Access properties
print(packet.header.sample_rate)  # Output: 44100
print(packet.header.samples_per_frame)  # Output: 3

Asynchronous Example

Using asyncio for non-blocking operations:

client = AsyncVBANClient(ignore_audio_streams=False)
asyncio.create_task(client.listen('0.0.0.0', 6980)) # Listen for all incoming packets

windows_host = client.register_device('bill.local', 6980)
windows_mic_out = windows_host.receive_stream('Windows Mic Out')


command_stream = await windows_host.text_stream('Command1')
await command_stream.send_text('Strip[0].Gain = 0.5;')
await asyncio.sleep(1)
await command_stream.send_text('Command.Restart = 1;')

# DRAIN_OLDEST will dump half the queue when it becomes full
rt_stream = await windows_host.rt_stream(30, back_pressure_strategy=BackPressureStrategy.DRAIN_OLDEST)
print(await rt_stream.get_packet())


receiver = VBANAudioPlayer(stream=windows_mic_out)

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or issues, please open an issue on the GitHub repository.


This README provides a brief overview of the project, installation instructions, usage examples, and contribution guidelines.

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

aiovban-0.6.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

aiovban-0.6.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file aiovban-0.6.0.tar.gz.

File metadata

  • Download URL: aiovban-0.6.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for aiovban-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e0050bf70dde2594670c39d821c63e6339345e303e0304d172c6198fed4a1249
MD5 8c40c1b16e131d063a79c52e7e11b8f7
BLAKE2b-256 315e40b6d0d5fe29df6990336ecad693a5f9fc792c5c564dcbe05ad1f7284351

See more details on using hashes here.

File details

Details for the file aiovban-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: aiovban-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for aiovban-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1c4aa0251b655dbe6f0d30d05cce1732b9779facc6f5520d5ebd0e0e8a1b4d1
MD5 f92f473a49f441ca261f045b01f6dfe6
BLAKE2b-256 c0d35820eadeeef7fdf89e8640a7df1095fa818da0ee29291d55bc7550f533ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page