2022-03-09 06:30:48 +00:00
[![License: MIT ](https://img.shields.io/badge/License-MIT-yellow.svg )](https://github.com/onyx-and-iris/vban-cmd-python/blob/dev/LICENSE)
2022-03-26 23:43:51 +00:00
[![Code style: black ](https://img.shields.io/badge/code%20style-black-000000.svg )](https://github.com/psf/black)
2022-06-16 16:10:06 +01:00
[![Imports: isort ](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 )](https://pycqa.github.io/isort/)
2022-04-28 11:34:48 +01:00
![Tests Status ](./tests/basic.svg?dummy=8484744 )
![Tests Status ](./tests/banana.svg?dummy=8484744 )
![Tests Status ](./tests/potato.svg?dummy=8484744 )
2022-04-27 20:00:30 +01:00
2022-02-27 18:57:16 +00:00
# VBAN CMD
2022-04-27 20:00:30 +01:00
2022-04-30 16:57:47 +01:00
This package offers a Python interface for the Voicemeeter RT Packet Service as well as Voicemeeter VBAN-TEXT.
This allows a user to get (rt packets) and set (vban-text) parameters over a local network. Consider the Streamer View app over VBAN, for example.
2022-03-06 14:44:30 +00:00
It may be used standalone or to extend the [Voicemeeter Remote Python API ](https://github.com/onyx-and-iris/voicemeeter-api-python )
2022-02-27 18:57:16 +00:00
2022-03-04 14:44:07 +00:00
For sending audio across a network with VBAN you will need to look elsewhere.
2022-03-02 23:28:42 +00:00
2022-04-30 16:57:47 +01:00
For an outline of past/future changes refer to: [CHANGELOG ](CHANGELOG.md )
2022-03-02 23:28:42 +00:00
## Tested against
2022-04-27 20:00:30 +01:00
2022-05-02 09:42:55 +01:00
- Basic 1.0.8.2
- Banana 2.0.6.2
- Potato 3.0.2.2
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
## Requirements
2022-04-27 20:00:30 +01:00
2022-04-30 16:57:47 +01:00
- [Voicemeeter ](https://voicemeeter.com/ )
2022-06-16 16:10:06 +01:00
- Python 3.11 or greater
2022-02-27 18:57:16 +00:00
## Installation
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
### `Pip`
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
Install voicemeeter-api package from your console
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
`pip install vban-cmd`
2022-02-27 18:57:16 +00:00
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
## `Use`
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
Simplest use case, use a context manager to request a VbanCmdvban_cmd class of a kind.
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
Login and logout are handled for you in this scenario.
2022-03-02 23:28:42 +00:00
2022-06-16 16:10:06 +01:00
#### `__main__.py`
2022-04-27 20:00:30 +01:00
2022-02-27 18:57:16 +00:00
```python
2022-06-16 16:10:06 +01:00
import vban_cmd
2022-02-27 18:57:16 +00:00
class ManyThings:
def __init__ (self, vban):
self.vban = vban
def things(self):
2022-06-16 16:10:06 +01:00
self.vban.strip[0].label = "podmic"
self.vban.strip[0].mute = True
print(
f"strip 0 ({self.vban.strip[0].label}) has been set to {self.vban.strip[0].mute}"
)
2022-02-27 18:57:16 +00:00
def other_things(self):
2022-06-16 16:10:06 +01:00
info = (
f"bus 3 gain has been set to {self.vban.bus[3].gain}",
f"bus 4 eq has been set to {self.vban.bus[4].eq}",
)
self.vban.bus[3].gain = -6.3
self.vban.bus[4].eq = True
print("\n".join(info))
2022-02-27 18:57:16 +00:00
def main():
2022-06-16 16:10:06 +01:00
with vban_cmd.api(kind_id) as vban:
2022-02-27 18:57:16 +00:00
do = ManyThings(vban)
do.things()
do.other_things()
2022-06-16 16:10:06 +01:00
# set many parameters at once
vban.apply(
{
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
"bus-2": {"mute": True},
"button-0": {"state": True},
"vban-in-0": {"on": True},
"vban-out-1": {"name": "streamname"},
}
)
2022-03-20 12:26:01 +00:00
2022-06-16 16:10:06 +01:00
if __name__ == "__main__":
kind_id = "banana"
ip = "< ip address > "
2022-03-20 12:26:01 +00:00
2022-06-16 16:10:06 +01:00
main()
2022-03-23 11:31:28 +00:00
```
2022-06-16 16:10:06 +01:00
Otherwise you must remember to call `vban.login()` , `vban.logout()` at the start/end of your code.
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
## `kind_id`
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
Pass the kind of Voicemeeter as an argument. kind_id may be:
2022-04-27 20:00:30 +01:00
- `basic`
- `banana`
- `potato`
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
## `Available commands`
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
### Channels (strip/bus)
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
The following properties exist for audio channels.
2022-02-27 18:57:16 +00:00
2022-04-27 20:00:30 +01:00
- `mono` : boolean
- `solo` : boolean
- `mute` : boolean
- `label` : string
- `gain` : float, -60 to 12
2022-06-16 16:10:06 +01:00
- `A1 - A5` , `B1 - B3` : boolean
2022-04-27 20:00:30 +01:00
- `comp` : float, from 0.0 to 10.0
- `gate` : float, from 0.0 to 10.0
- `limit` : int, from -40 to 12
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
example:
2022-04-27 20:00:30 +01:00
2022-03-18 07:40:24 +00:00
```python
2022-06-16 16:10:06 +01:00
vban.strip[3].gain = 3.7
print(strip[0].label)
vban.bus[4].mono = true
2022-03-18 07:40:24 +00:00
```
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
### Command
2022-03-18 07:40:24 +00:00
2022-06-16 16:10:06 +01:00
Certain 'special' commands are defined by the API as performing actions rather than setting values. The following methods are available:
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
- `show()` : Bring Voiceemeter GUI to the front
- `shutdown()` : Shuts down the GUI
- `restart()` : Restart the audio engine
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
The following properties are write only and accept boolean values.
2022-02-27 18:57:16 +00:00
2022-06-16 16:10:06 +01:00
- `showvbanchat` : boolean
- `lock` : boolean
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
example:
2022-04-27 20:00:30 +01:00
2022-06-16 16:10:06 +01:00
```python
vban.command.restart()
vban.command.showvbanchat = true
```
### Multiple parameters
- `apply`
Set many strip/bus parameters at once, for example:
2022-03-18 07:40:24 +00:00
2022-06-16 16:10:06 +01:00
```python
vban.apply(
{
"strip-2": {"A1": True, "B1": True, "gain": -6.0},
"bus-2": {"mute": True},
}
)
```
Or for each class you may do:
2022-04-27 20:00:30 +01:00
2022-03-18 07:40:24 +00:00
```python
2022-06-16 16:10:06 +01:00
vban.strip[0].apply(mute: true, gain: 3.2, A1: true)
vban.vban.outstream[0].apply(on: true, name: 'streamname', bit: 24)
2022-03-18 07:40:24 +00:00
```
2022-06-16 16:10:06 +01:00
## `Base Module`
### VbanCmd class
2022-04-27 20:00:30 +01:00
2022-04-29 21:57:16 +01:00
#### `vban.pdirty`
2022-04-29 22:31:22 +01:00
True iff a parameter has been changed. Typically this is checked periodically to update states.
2022-04-29 21:57:16 +01:00
2022-02-28 14:03:51 +00:00
#### `vban.set_rt(id_, param, val)`
2022-04-27 20:00:30 +01:00
2022-02-28 14:03:51 +00:00
Sends a string request RT Packet where the command would take the form:
2022-04-27 20:00:30 +01:00
2022-02-28 14:03:51 +00:00
```python
f'{id_}.{param}={val}'
```
2022-02-27 18:57:16 +00:00
2022-04-29 21:57:16 +01:00
#### `vban.public_packet`
2022-04-27 20:00:30 +01:00
2022-04-29 22:30:21 +01:00
Returns a Voicemeeter rt data packet. Designed to be used internally by the interface but available for parsing through this read only property object. States may or may not be current, use the polling parameter pdirty to be sure.
2022-03-11 19:21:26 +00:00
2022-02-27 18:57:16 +00:00
### `Errors`
2022-04-27 20:00:30 +01:00
- `errors.VMCMDErrors` : Base VMCMD error class.
2022-02-27 18:57:16 +00:00
### `Tests`
2022-04-27 20:00:30 +01:00
2022-02-27 18:57:16 +00:00
First make sure you installed the [development dependencies ](https://github.com/onyx-and-iris/vban-cmd-python#installation )
2022-04-27 20:00:30 +01:00
Then from tests directory:
2022-02-27 18:57:16 +00:00
2022-04-27 20:00:30 +01:00
`pytest -v`
2022-02-27 18:57:16 +00:00
## Resources
2022-04-27 20:00:30 +01:00
2022-04-30 16:57:47 +01:00
- [Voicemeeter VBAN TEXT ](https://vb-audio.com/Voicemeeter/VBANProtocol_Specifications.pdf#page=19 )
- [Voicemeeter RT Packet Service ](https://vb-audio.com/Voicemeeter/VBANProtocol_Specifications.pdf#page=27 )