Code Monkey home page Code Monkey logo

pyvban's Introduction

pyVBAN

python implementation of the VBAN (VB Audio network) protocol Specification here: https://www.vb-audio.com/Voicemeeter/VBANProtocol_Specifications.pdf The module supports audio receiving and transmitting + text transmitting

Requierments

Need of the pyaudio module

pyVBAN.VBAN_Recv() usage:

cl = VBAN_Recv("IP-FROM","StreamName",Port,OutputDeviceIndex,verbose=False)
cl.runforever()

Example:

cl = VBAN_Recv("127.0.0.1","Stream7",6981,10,verbose=False)
cl.runforever()

or

cl = VBAN_Recv("127.0.0.1","Stream7",6981,10,verbose=False)
while True:
	cl.runonce()

pyVBAN.VBAN_Send() usage:

cl = VBAN_Send("IP-TO",PORT,"StreamName",SampleRate,DeviceInId,verbose=False)
cl.runforever()

Example:

cl = VBAN_Send("127.0.0.1",6980,"Stream8",48000,3,verbose=True)
cl.runforever()

or

cl = VBAN_Send("127.0.0.1",6980,"Stream8",48000,3,verbose=True)
while True:
	cl.runonce()

pyVBAN.VBAN_SendText() usage:

cl = VBAN_SendText("IP-TO",PORT,BAUDRATE,"StreamName")
cl.send("Command")

Example:

cl = VBAN_SendText("127.0.0.1",6980,9600,"Command1")
cl.send("Strip[0].Gain = -6")

Help

To find the output device index you can use this code:

import pyaudio
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')

print("--- INPUT DEVICES ---")
for i in range(0, numdevices):
        if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
            print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))
            
print("--- OUTPUT DEVICES ---")
for i in range(0, numdevices):
        if (p.get_device_info_by_host_api_device_index(0, i).get('maxOutputChannels')) > 0:
            print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))

pyvban's People

Contributors

thestaticturtle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyvban's Issues

Can't get connection

I was able to troubleshoot the code to the point of getting verbose=true to output to console, however no sound is being transmitted.

Interested in Contributions?

Hi there! Awesome project! 🎉

I've been poking around, and found a few ways that I think I could help offer some enhancements. Are you open to contributions?

Multiple send stream and send + recv not working

Hello,

I failed to send multiple streams, either to two separate devices or to one, even with different ports.
I then tried with Python Process but the result is the same.
I also cannot use send and receive at the same time.
Here is my code:

import pyVBAN
from multiprocessing import Process

def send(ip, port, streamName, sampleRate, deviceId):
    vbanSendSlot = pyVBAN.VBAN_Send(ip, port, streamName, sampleRate, deviceId, verbose=False)
    vbanSendSlot.runforever()

def recv(ip, port, streamName, deviceId):
    vbanRecvSlot = pyVBAN.VBAN_Recv(ip, streamName, port, deviceId, verbose=True)
    vbanRecvSlot.runforever()

def startSend1():
    sendSlot1 = Process(target=send, args=("10.0.254.6", 6980, "Stream1", 48000, 12))
    sendSlot1.start()
    sendSlot1.join()

def startSend2():
    sendSlot2 = Process(target=send, args=("10.0.254.6", 6981, "Stream2", 44100, 12))
    sendSlot2.start()
    sendSlot2.join()

def startRecv1():
    recvSlot1 = Process(target=recv, args=("10.0.254.6", 6980, "RECV", 14))
    recvSlot1.start()
    recvSlot1.join()


if __name__ == '__main__':
    startSend1()
    startSend2()
    startRecv1()

Is this normal or is there a specific setting to be made?

Sorry if my English is not very good, I use Google Translate.

Both VBAN_Recv and VBAN_Send return an error

Hi, I was playing around with this and I found the following problems:

  • When I run VBAN_Recv(), it yields the following error: struct.error: unpack requires a buffer of 8 bytes on the line self.stream_frameCounter = struct.unpack("l",data[24:28])[0]. I just tried to replace the line with self.stream_frameCounter = struct.unpack("l",data[24:32])[0] and it works fine. Not sure why this 8 bytes constraint was not the case on your system...

  • When I run VBAN_Send(), it keeps yielding the following error [Errno 56] Socket is already connected. I tried to change the PORT number, assuming socket refers to that, without success.

Any idea of why that might be?

VBAN_Send aborts after a while.

VBAN_Send runs for a while then quits with the following message:-
src/hostapi/alsa/pa_linux_alsa.c:3641: PaAlsaStreamComponent_BeginPolling: Assertion 'ret == self->nfds' failed

I have tried different sample rates but no change and the time before aborting varies.
Looking at htop the system (Intel© Core™ i3-3110M CPU @ 2.40GHz × 2 Linux Mint 20.1 Cinnamon) is not stressed, process taking about 5% CPU and total CPU load ~30%.

VBAN_Recv runs without stopping.

README script for PyAudio is broken in python3

Hi, I just got around to trying out pyVBAN, and your updates could not have been better timed.

However, the README may still need to be updated for Python 3, specifically the print statements in the PyAudio script to list devices.

Thanks!

Project License?

I was curious if you had preferences on the license for this project? Others in the same space have seemed to have gone with either the GPL 3.0 or Apache 2.0, and I was wondering if you had any thoughts on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.