2022-03-09 06:24:46 +00:00
[![License: MIT ](https://img.shields.io/badge/License-MIT-yellow.svg )](https://github.com/onyx-and-iris/voicemeeter-api-powershell/blob/dev/LICENSE)
2022-04-30 17:46:30 +01:00
2021-04-28 17:38:36 +01:00
# Powershell Wrapper for Voicemeeter API
2022-04-30 17:46:30 +01:00
This module offers a Powershell interface for the Voicemeeter Remote C API.
2021-04-28 17:38:36 +01:00
2021-04-30 16:37:21 +01:00
For past/future changes to this project refer to: [CHANGELOG ](CHANGELOG.md )
2021-04-30 16:30:12 +01:00
2021-04-28 17:38:36 +01:00
## Tested against
2022-05-02 09:44:55 +01:00
- Basic 1.0.8.2
- Banana 2.0.6.2
- Potato 3.0.2.2
2021-04-28 17:38:36 +01:00
## Requirements
2022-04-30 17:46:30 +01:00
- [Voicemeeter ](https://voicemeeter.com/ )
- Powershell 5.1
2021-04-28 17:38:36 +01:00
2021-04-30 16:30:12 +01:00
## Installation
2022-04-30 17:46:30 +01:00
2021-05-01 22:20:21 +01:00
#### PowerShellGet:
2022-04-30 17:46:30 +01:00
2021-05-01 22:20:21 +01:00
In Powershell as admin:
2021-04-30 16:30:12 +01:00
`Install-Module Voicemeeter`
2021-05-01 22:20:21 +01:00
In Powershell as current user:
`Install-Module -Name Voicemeeter -Scope CurrentUser`
You may be asked to install NuGet provider required by PowerShellGet if you don't have it already.
When prompted you will need to accept PSGallery as a trusted repository.
More Info:
2022-04-30 17:46:30 +01:00
- [PowerShellGet ](https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7.1 )
- [NuGet ](https://www.powershellgallery.com/packages/NuGet/1.3.3 )
- [PSGallery ](https://docs.microsoft.com/en-gb/powershell/scripting/gallery/overview?view=powershell-7.1 )
2021-04-30 16:30:12 +01:00
#### Direct download:
2022-04-30 17:46:30 +01:00
2021-04-30 16:30:12 +01:00
`git clone https://github.com/onyx-and-iris/voicemeeter-api-powershell.git`
All examples in this readme assume you've installed as a module.
2021-04-30 16:37:21 +01:00
If you decide to direct download see [alternative instructions ](FROM_SOURCE.md ).
2021-04-30 16:30:12 +01:00
2021-04-28 17:38:36 +01:00
## Use
2022-04-30 17:46:30 +01:00
2021-04-29 00:48:44 +01:00
When you instantiate Remote class you will automatically be logged in. Use a
try finally block to ensure you logout at the end of your code.
2022-04-30 17:46:30 +01:00
2021-04-28 17:38:36 +01:00
```powershell
2021-04-30 16:30:12 +01:00
Import-Module Voicemeeter
2021-04-28 17:38:36 +01:00
try {
2021-04-30 16:30:12 +01:00
# Run the factory function for required Voicemeeter type
$vmr = Get-RemoteBanana
2021-04-28 17:38:36 +01:00
# Set strip and bus params
2021-04-29 00:48:44 +01:00
$vmr.strip[0].mono = $true
$vmr.strip[0].mono '=> $true'
$vmr.bus[1].mute = $false
$vmr.bus[1].mute '=> $false'
# Set macrobutton with id 4, mode state to 1
$vmr.button[4].state = $true
$vmr.button[4].state '=> $true'
2021-04-28 17:38:36 +01:00
}
2021-04-29 00:48:44 +01:00
finally { $vmr.Logout() }
2021-04-28 17:38:36 +01:00
```
2021-04-30 16:30:12 +01:00
Voicemeeter factory function can be:
2022-04-30 17:46:30 +01:00
- Get-RemoteBasic
- Get-RemoteBanana
- Get-RemotePotato
2021-04-28 17:38:36 +01:00
2022-03-08 23:04:01 +00:00
### Strip
2022-04-30 17:46:30 +01:00
2022-03-08 23:04:01 +00:00
The following strip commands are available:
2022-04-30 17:46:30 +01:00
- mute: bool
- mono: bool
- mc: bool
- k: int, from 0 to 4
- solo: bool
- A1-A5: bool
- B1-B3: bool
- limit: int, from -40 to 12
- gain: float, from -60 to 12
- comp: float, from 0 to 10
- gate: float, from 0 to 10
- gainlayer0-gainlayer7: float
2022-03-08 23:08:56 +00:00
2022-03-08 23:04:01 +00:00
for example:
2022-03-08 23:08:32 +00:00
2022-03-08 23:04:01 +00:00
```
$vmr.strip[5].gainlayer1 = -8.3
```
A,B commands depend on Voicemeeter type.
2022-03-08 23:10:11 +00:00
2022-03-08 23:04:01 +00:00
gainlayers defined for Potato version only.
2022-03-08 23:10:11 +00:00
2022-03-08 23:04:01 +00:00
mc, k for virtual strips only.
### Bus
2022-04-30 17:46:30 +01:00
2022-03-08 23:50:50 +00:00
The following bus commands are available:
2022-04-30 17:46:30 +01:00
- mute: bool
- mono: bool
- eq: bool
- limit: int, from -40 to 12
- gain: float, from -60 to 12
- mode\_: bool, any of the following:
@('normal', 'amix', 'bmix', 'repeat', 'composite', 'tvmix', 'upmix21',
'upmix41', 'upmix61', 'centeronly', 'lfeonly', 'rearonly')
2022-03-08 23:04:01 +00:00
2022-03-08 23:08:32 +00:00
for example:
```
2022-03-08 23:50:50 +00:00
$vmr.bus[3].mode_repeat = $true
2022-03-08 23:08:32 +00:00
```
2021-05-05 19:02:20 +01:00
2022-06-25 23:12:02 +01:00
### Strip|Bus
- `FadeTo(amount, time)` : float, int
- `FadeBy(amount, time)` : float, int
Modify gain to or by the selected amount in db over a time interval in ms.
for example:
```
$vmr.strip[3].FadeTo(-18.7, 1000)
$vmr.bus[0].FadeBy(-10, 500)
```
2021-04-28 17:38:36 +01:00
### Macrobuttons
2022-04-30 17:46:30 +01:00
2021-04-28 17:38:36 +01:00
Three modes defined: state, stateonly and trigger.
2022-04-30 17:46:30 +01:00
- State runs associated scripts
- Stateonly does not run associated scripts
- Index range (0, 69)
2021-04-28 17:38:36 +01:00
```
2021-04-29 00:48:44 +01:00
$vmr.button[3].state = $true
2021-04-28 17:38:36 +01:00
2021-04-29 00:48:44 +01:00
$vmr.button[4].stateonly = $false
2021-04-28 17:38:36 +01:00
2021-04-29 00:48:44 +01:00
$vmr.button[5].trigger = $true
2021-04-28 17:38:36 +01:00
```
2021-05-11 19:17:27 +01:00
### VBAN
2022-04-30 17:46:30 +01:00
- vmr.vban.enable: Toggle VBAN on or off. Accepts a boolean value.
2022-01-11 17:19:51 +00:00
2021-05-11 19:17:27 +01:00
For each vban in/out stream the following parameters are defined:
2022-04-30 17:46:30 +01:00
- on: boolean
- name: string
- ip: string
- port: int from 1024 - 65535
- sr: int (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
- channel: int from 1 to 8
- bit: int 16 or 24
- quality: int from 0 to 4
- route: int from 0 to 8
2021-05-11 19:17:27 +01:00
SR, channel and bit are defined as readonly for instreams. Attempting to write
to those parameters will throw an error. They are read and write for outstreams.
example:
2022-04-30 17:46:30 +01:00
2021-05-11 19:17:27 +01:00
```powershell
2022-01-11 17:19:51 +00:00
$vmr.vban.enable = $true
2022-01-06 15:29:23 +00:00
$vmr.vban.instream[0].on = $true
$vmr.vban.instream[2].port = 6990
$vmr.vban.outstream[3].bit = 16
2021-05-11 19:17:27 +01:00
```
2022-01-19 05:20:53 +00:00
### Command
2022-04-30 17:46:30 +01:00
2022-01-11 17:19:51 +00:00
Certain 'special' commands are defined by the API as performing actions rather than setting values.
The following methods are available:
2022-04-30 17:46:30 +01:00
- show
- hide
- restart
- shutdown
2022-01-11 17:19:51 +00:00
The following properties are write only and accept boolean values:
2022-04-30 17:46:30 +01:00
- showvbanchat
- lock
2022-01-11 17:19:51 +00:00
example:
2022-04-30 17:46:30 +01:00
2021-08-23 15:24:05 +01:00
```powershell
$vmr.command.show
2022-01-11 17:19:51 +00:00
$vmr.command.lock = $true
2021-08-23 15:24:05 +01:00
```
2022-03-08 23:50:50 +00:00
### Recorder
2022-04-30 17:46:30 +01:00
2022-03-08 23:50:50 +00:00
The following methods are available:
2022-04-30 17:46:30 +01:00
- play
- stop
- pause
- record
- ff
2022-06-25 15:20:36 +01:00
- rew
2022-03-08 23:51:23 +00:00
2022-03-08 23:50:50 +00:00
The following properties accept boolean values.
2022-04-30 17:46:30 +01:00
- loop
- A1 - A5
- B1 - B3
2022-03-08 23:50:50 +00:00
example:
2022-04-30 17:46:30 +01:00
2022-03-08 23:50:50 +00:00
```powershell
$vmr.recorder.play
$vmr.recorder.loop = $true
```
2022-01-19 21:57:48 +00:00
### Multiple parameters
2022-04-30 17:46:30 +01:00
2022-01-19 21:57:48 +00:00
Set many strip/bus/macrobutton/vban parameters at once, for Example
2022-04-30 17:46:30 +01:00
2022-01-19 21:57:48 +00:00
```powershell
Import-Module Voicemeeter
try {
$vmr = Get-RemoteBanana
$hash = @{
strip_0 = @{mute = $true; mono = $true};
strip_2 = @{mute = $true; mono = $true};
bus_1 = @{mute = $true; mono = $true};
button_34 = @{state = $true};
button_12 = @{trigger = $false};
vban_instream_3 = @{name = 'streamname'};
vban_outstream_0 = @{on = $false};
}
$vmr.Set_Multi($hash)
}
finally { $vmr.Logout() }
```
2022-01-19 22:48:26 +00:00
### Remote class
2022-04-30 17:46:30 +01:00
2022-01-19 22:48:26 +00:00
Access to lower level Getters and Setters are provided with these functions:
2022-04-30 17:46:30 +01:00
- `$vmr.Getter(param)` : For getting the value of a parameter expected to return a value other than string.
- `$vmr.Getter_String(param)` : For getting the value of any parameter expected to return a string.
- `$vmr.Setter(param, value)` : For setting the value of any parameter.
2022-01-19 22:48:26 +00:00
Access to lower level polling functions are provided with these functions:
2022-04-30 17:46:30 +01:00
- `$vmr.PDirty` : Returns true if a parameter has been updated.
- `$vmr.MDirty` : Returns true if a macrobutton has been updated.
2022-01-19 22:48:26 +00:00
example:
2022-04-30 17:46:30 +01:00
2022-01-19 22:48:26 +00:00
```powershell
$vmr.Getter('Strip[2].Mute')
$vmr.Getter_String('Bus[1].Label')
$vmr.Setter('Strip[4].Label', 'stripname')
$vmr.Setter('Strip[0].Gain', -3.6)
```
2022-01-24 20:01:12 +00:00
### Config Files
2022-04-30 17:46:30 +01:00
2022-01-24 20:01:12 +00:00
`$vmr.Set_Profile('config')`
2022-04-30 17:46:30 +01:00
You may load config files in psd1 format. An example profile has been included with the package. Remember to save current settings before loading a profile. To test simply rename \_profiles directory to profiles. It will be loaded into memory but not set. To set one you may do:
2022-01-24 20:01:12 +00:00
```powershell
Import-Module Voicemeeter
try {
$vmr = Get-RemoteBanana
$vmr.Set_Profile("config")
}
finally { $vmr.Logout() }
```
2022-04-30 17:46:30 +01:00
2022-01-24 20:01:12 +00:00
will load a config file at profiles/banana/config.psd1 for Voicemeeter Banana.
2021-04-28 17:38:36 +01:00
### Run tests
2022-04-30 17:46:30 +01:00
2021-05-01 22:20:21 +01:00
Run tests using .\runall.ps1 which accepts two parameters:
2022-04-30 17:46:30 +01:00
- tag Run tests of this type
- num Run this number of tests
2021-04-28 17:38:36 +01:00
Current test types are 'higher' and 'lower'
Example:
`.\runall.ps1 -tag 'higher' -num 3`
2021-05-01 22:20:21 +01:00
Results will be logged and summary file written.
2022-01-19 21:57:48 +00:00
### Official Documentation
2022-04-30 17:46:30 +01:00
2022-06-25 23:12:02 +01:00
- [Voicemeeter Remote C API ](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf )