Package: vban-cmd
VBAN CMDThis python interface allows you to transmit Voicemeeter parameters over a network.It may be used standalone or to extend theVoicemeeter Remote Python APIThere is no support for audio transfer in this package, only parameters.For an outline of past/future changes refer to:CHANGELOGTested againstBasic 1.0.8.8Banana 2.0.6.8Potato 3.0.2.8RequirementsVoicemeeterPython 3.10 or greaterInstallationpip install vban-cmdUseConnectionLoad VBAN connection info from toml config. A validvban.tomlmight look like this:[connection]ip="gamepc.local"port=6980streamname="Command1"It should be placed in <user home directory> / "Documents" / "Voicemeeter" / "configs"Alternatively you may passip,port,streamnameas keyword arguments.__main__.pySimplest use case, use a context manager to request a VbanCmd class of a kind.Login and logout are handled for you in this scenario.importvban_cmdclassManyThings:def__init__(self,vban):self.vban=vbandefthings(self):self.vban.strip[0].label="podmic"self.vban.strip[0].mute=Trueprint(f"strip 0 ({self.vban.strip[0].label}) mute has been set to{self.vban.strip[0].mute}")defother_things(self):self.vban.bus[3].gain=-6.3self.vban.bus[4].eq.on=Trueinfo=(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.on}",)print("\n".join(info))defmain():KIND_ID="banana"withvban_cmd.api(KIND_ID,ip="gamepc.local",port=6980,streamname="Command1")asvban:do=ManyThings(vban)do.things()do.other_things()# set many parameters at oncevban.apply({"strip-2":{"A1":True,"B1":True,"gain":-6.0},"bus-2":{"mute":True,"eq":{"on":True}},"vban-in-0":{"on":True},})if__name__=="__main__":main()Otherwise you must remember to callvban.login(),vban.logout()at the start/end of your code.KIND_IDPass the kind of Voicemeeter as an argument. KIND_ID may be:basicbananapotatoAvailable commandsStripThe following properties are available.mono: booleansolo: booleanmute: booleanlabel: stringgain: float, -60 to 12A1 - A5,B1 - B3: booleanlimit: int, from -40 to 12example:vban.strip[3].gain=3.7print(vban.strip[0].label)The following methods are available.appgain(name, value): string, float, from 0.0 to 1.0Set the gain in db by value for the app matching name.appmute(name, value): string, boolSet mute state as value for the app matching name.example:vban.strip[5].appmute("Spotify",True)vban.strip[5].appgain("Spotify",0.5)Strip.CompThe following properties are available.knob: float, from 0.0 to 10.0gainin: float, from -24.0 to 24.0ratio: float, from 1.0 to 8.0threshold: float, from -40.0 to -3.0attack: float, from 0.0 to 200.0release: float, from 0.0 to 5000.0knee: float, from 0.0 to 1.0gainout: float, from -24.0 to 24.0makeup: booleanexample:print(vban.strip[4].comp.knob)Strip Comp properties are defined as write only.knobdefined for all versions, all other parameters potato only.Strip.GateThe following properties are available.knob: float, from 0.0 to 10.0threshold: float, from -60.0 to -10.0damping: float, from -60.0 to -10.0bpsidechain: int, from 100 to 4000attack: float, from 0.0 to 1000.0hold: float, from 0.0 to 5000.0release: float, from 0.0 to 5000.0example:vban.strip[2].gate.attack=300.8Strip Gate properties are defined as write only, potato version only.knobdefined for all versions, all other parameters potato only.Strip.DenoiserThe following properties are available.knob: float, from 0.0 to 10.0strip.denoiser properties are defined as write only, potato version only.Strip.EQThe following properties are available.on: booleanab: booleanStrip EQ properties are defined as write only, potato version only.Gainlayersgain: float, from -60.0 to 12.0example:vban.strip[3].gainlayer[3].gain=3.7Gainlayers are defined for potato version only.LevelsThe following properties are available.prefaderexample:print(vban.strip[3].levels.prefader)Level properties will return -200.0 if no audio detected.BusThe following properties are available.mono: booleanmute: booleanlabel: stringgain: float, -60 to 12example:print(vban.bus[0].label)Bus.EQThe following properties are available.on: booleanab: booleanvban.bus[4].eq.on=trueModesThe following properties are available.normal: booleanamix: booleanbmix: booleancomposite: booleantvmix: booleanupmix21: booleanupmix41: booleanupmix61: booleancenteronly: booleanlfeonly: booleanrearonly: booleanThe following methods are available.get(): Returns the current bus modeexample:vban.bus[4].mode.amix=Trueprint(vban.bus[2].mode.get())LevelsThe following properties are available.allexample:print(vban.bus[0].levels.all)levels.allwill return -200.0 if no audio detected.Strip | BusThe following methods are available.fadeto(amount, time): float, intfadeby(amount, time): float, intModify gain to or by the selected amount in db over a time interval in ms.example:vban.strip[0].fadeto(-10.3,1000)vban.bus[3].fadeby(-5.6,500)CommandCertain 'special' commands are defined by the API as performing actions rather than setting values. The following methods are available:show(): Bring Voiceemeter GUI to the frontshutdown(): Shuts down the GUIrestart(): Restart the audio enginereset(): Applies theresetconfig. (phys strip B1, virt strip A1, gains, comp, gate 0.0, mute, mono, solo, eq false)The following properties are write only and accept boolean values.showvbanchat: booleanlock: booleanexample:vban.command.restart()vban.command.showvbanchat=trueMultiple parametersapplySet many strip/bus parameters at once, for example:vban.apply({"strip-0":{"A1":True,"B1":True,"gain":-6.0},"bus-1":{"mute":True,"mode":"composite"},"bus-2":{"eq":{"on":True}},"vban-in-0":{"on":True},})Or for each class you may do:vban.strip[0].apply({"mute":True,"gain":3.2,"A1":True})vban.vban.outstream[0].apply({"on":True,"name":"streamname","bit":24})Config Filesvban.apply_config(<configname>)You may load config files in TOML format.
Three example configs have been included with the package. Remember to save
current settings before loading a user config. To load one you may do:importvban_cmdwithvban_cmd.api('banana')asvban:vban.apply_config('example')will load a config file at configs/banana/example.toml for Voicemeeter Banana.Your configs may be located in one of the following paths:<current working directory> / "configs" / kind_id<user home directory> / ".config" / "vban-cmd" / kind_id<user home directory> / "Documents" / "Voicemeeter" / "configs" / kind_idIf a config with the same name is located in multiple locations, only the first one found is loaded into memory, in the above order.config extendsYou may also load a config that extends another config with overrides or additional parameters.You just need to define a keyextendsin the config TOML, that names the config to be extended.Three example 'extender' configs are included with the repo. You may load them with:importvoicemeeterlibwithvoicemeeterlib.api('banana')asvm:vm.apply_config('extender')EventsLevel updates are considered high volume, by default they are NOT listened for. Usesubskeyword arg to initialize event updates.example:importvban_cmdopts={"ip":"<ip address>","streamname":"Command1","port":6980,}withvban_cmd.api('banana',ldirty=True,**opts)asvban:...vban.subjectUse the Subject class to register an app as event observer.The following methods are available:add: registers an app as an event observerremove: deregisters an app as an event observerexample:# register an app to receive updatesclassApp():def__init__(self,vban):vban.subject.add(self)...vban.eventUse the event class to toggle updates as necessary.The following properties are available:pdirty: booleanldirty: booleanexample:vban.event.ldirty=Truevban.event.pdirty=FalseOr add, remove a list of events.The following methods are available:add()remove()get()example:vban.event.remove(["pdirty","ldirty"])# get a list of currently subscribedprint(vban.event.get())VbanCmd classvban_cmd.api(kind_id: str, **opts)You may pass the following optional keyword arguments:ip: str, ip or hostname of remote machinestreamname: str, name of the stream to connect to.port: int=6980, vban udp port of remote machine.pdirty: boolean=False, parameter updatesldirty: boolean=False, level updatestimeout: int=5, amount of time (seconds) to wait for an incoming RT data packet (parameter states).outbound: boolean=False, setTrueif you are only interested in sending commands. (no rt packets will be received)vban.pdirtyTrue iff a parameter has been changed.vban.ldirtyTrue iff a level value has been changed.vban.sendtext(script)Sends a script block as a string request, for example:vban.sendtext("Strip[0].Mute=1;Bus[0].Mono=1")vban.public_packetReturns aVbanRtPacket. Designed to be used internally by the interface but available for parsing through this read only property object.States not guaranteed to be current (requires use of dirty parameters to confirm).Errorserrors.VBANCMDError: Base VBANCMD Exception class.errors.VBANCMDConnectionError: Exception raised when connection/timeout errors occur.LoggingIt's possible to see the messages sent by the interface's setters and getters, may be useful for debugging.example:importvban_cmdlogging.basicConfig(level=logging.DEBUG)opts={"ip":"ip.local","port":6980,"streamname":"Command1"}withvban_cmd.api('banana',**opts)asvban:...TestsFirst make sure you installed thedevelopment dependenciesThen from tests directory:pytest -vResourcesVoicemeeter VBAN TEXTVoicemeeter RT Packet Service