2022-02-27 18:57:16 +00:00
# VBAN CMD
2022-03-04 14:44:07 +00:00
This package offers a Python interface for the [Voicemeeter RT Packet Service ](https://vb-audio.com/Voicemeeter/VBANProtocol_Specifications.pdf ). 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
## Tested against
2022-02-27 18:57:16 +00:00
- Basic 1.0.8.1
- Banana 2.0.6.1
- Potato 3.0.2.1
## Prerequisites
- Voicemeeter 1 (Basic), 2 (Banana) or 3 (Potato)
- Python 3.9+
## Installation
```
git clone https://github.com/onyx-and-iris/vban-cmd-python
cd vban-cmd-python
```
2022-03-05 06:17:12 +00:00
Just the interface:
2022-02-27 18:57:16 +00:00
```
pip install .
```
With development dependencies:
```
pip install -e .['development']
```
2022-02-28 18:15:37 +00:00
#### Connection:
2022-03-04 14:44:07 +00:00
For sending a text command several configuration options are available:
2022-02-28 18:15:37 +00:00
- `ip` : remote address
- `streamname` : default 'Command1'
- `port` : default 6990
2022-03-03 11:34:45 +00:00
- `channel` : from 0 to 255
2022-02-28 18:15:37 +00:00
- `bps` : bitrate of stream, default 0 should be safe for most cases.
2022-03-03 11:35:49 +00:00
2022-03-03 11:34:45 +00:00
only applies to `sendtext` :
- `delay` : default 0.001
2022-02-28 18:15:37 +00:00
2022-02-27 18:57:16 +00:00
#### Use with a context manager:
2022-03-04 14:44:07 +00:00
It is advised to use this code with a context manager.
2022-03-05 06:17:12 +00:00
Parameter coverage is not as extensive for the RT Packet Service as with the Remote API.
2022-03-02 23:28:42 +00:00
2022-02-27 18:57:16 +00:00
### Example 1
```python
2022-03-04 14:22:29 +00:00
import vbancmd
2022-02-27 18:57:16 +00:00
class ManyThings:
def __init__ (self, vban):
self.vban = vban
def things(self):
# Set the mapping of the second input strip
self.vban.strip[1].A3 = True
print(f'Output A3 of Strip {self.vban.strip[1].label}: {self.vban.strip[1].A3}')
def other_things(self):
# Toggle mute for the leftmost output bus
self.vban.bus[0].mute = not self.vban.bus[0].mute
def main():
2022-03-04 14:22:29 +00:00
with vbancmd.connect(kind_id, ip=ip) as vban:
2022-02-27 18:57:16 +00:00
do = ManyThings(vban)
do.things()
do.other_things()
if __name__ == '__main__':
kind_id = 'potato'
ip = '< ip address > '
main()
```
## API
### Kinds
A *kind* specifies a major Voicemeeter version. Currently this encompasses
- `basic`
- `banana`
- `potato`
2022-02-28 14:03:51 +00:00
#### `vban_cmd.connect(kind_id, ip=ip) -> '(VbanCmd)'`
2022-02-27 18:57:16 +00:00
Factory function for remotes.
- `ip` : remote pc you wish to send requests to.
### `VbanCmd` (higher level)
#### `vban.type`
The kind of the Voicemeeter instance.
#### `vban.version`
A tuple of the form `(v1, v2, v3, v4)` .
#### `vban.strip`
An `InputStrip` tuple, containing both physical and virtual.
#### `vban.bus`
An `OutputBus` tuple, containing both physical and virtual.
2022-03-03 11:34:45 +00:00
2022-02-27 18:57:16 +00:00
#### `vban.show()`
2022-03-04 14:22:29 +00:00
Shows Voicemeeter if it's hidden. No effect otherwise.
2022-02-27 18:57:16 +00:00
#### `vban.hide()`
Hides Voicemeeter if it's shown. No effect otherwise.
#### `vban.shutdown()`
Closes Voicemeeter.
#### `vban.restart()`
Restarts Voicemeeter's audio engine.
2022-03-04 14:33:11 +00:00
#### `vban.sendtext(cmd)`
Sends a TEXT command, for example:
```python
# Use ';' or ',' for delimiters.
vban.sendtext('Strip[0].Mute=1;Strip[3].A3=0;Bus[2].Mute=0;Bus[3].Eq.On=1')
```
2022-02-27 18:57:16 +00:00
### `Strip`
The following properties are gettable and settable:
- `mono` : boolean
- `solo` : boolean
- `mute` : boolean
- `label` : string
2022-02-28 14:03:51 +00:00
- `gainlayer` : float, -60 to 12
2022-03-02 21:06:39 +00:00
- `gain` : float, -60 to 12
2022-02-27 18:57:16 +00:00
- Output mapping (e.g. `A1` , `B3` , etc.): boolean, depends on the Voicemeeter kind
The following properties are settable:
- `comp` : float, from 0.0 to 10.0
- `gate` : float, from 0.0 to 10.0
- `limit` : int, from -40 to 12
### `Bus`
The following properties are gettable and settable:
- `mute` : boolean
- `mono` : boolean
- `eq` : boolean
- `eq_ab` : boolean
- `label` : string
2022-02-28 14:03:51 +00:00
- `gain` : float, -60 to 12
2022-02-27 18:57:16 +00:00
2022-02-28 14:03:51 +00:00
### `VbanCmd` (lower level)
#### `vban.set_rt(id_, param, val)`
Sends a string request RT Packet where the command would take the form:
```python
f'{id_}.{param}={val}'
```
2022-02-27 18:57:16 +00:00
2022-03-02 23:28:42 +00:00
#### `vban._get_rt()`
Used for updating the RT data packet, used internally by the Interface.
```python
vban.public_packet = vban._get_rt()
```
2022-02-27 18:57:16 +00:00
### `Errors`
- `errors.VMCMDErrors` : Base VMCMD error class.
### `Tests`
First make sure you installed the [development dependencies ](https://github.com/onyx-and-iris/vban-cmd-python#installation )
To run the tests from tests directory:
`nosetests --r test -v`
## Resources
- [Voicemeeter RT Packet Service ](https://vb-audio.com/Voicemeeter/VBANProtocol_Specifications.pdf )