mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2026-04-20 13:33:32 +00:00
Compare commits
4 Commits
f7abc5248b
...
add-to-bus
| Author | SHA1 | Date | |
|---|---|---|---|
| 714d2fc972 | |||
| c797912458 | |||
|
|
f702b4feb3 | ||
|
|
f8f10e358f |
9
examples/eq_edit/README.md
Normal file
9
examples/eq_edit/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## About
|
||||
|
||||
The purpose of this script is to demonstratehow to utilize the channels and cells that are available as part of the EQ. It should take audio playing in the second virtual strip and then apply a LGF on the first physical at 500 Hz.
|
||||
|
||||
## Use
|
||||
|
||||
Configured for banana version.
|
||||
|
||||
Make sure you are playing audio into the second virtual strip and out of the first physical bus, both channels are unmuted and that you aren't monitoring another mixbus. Then run the script.
|
||||
21
examples/eq_edit/__main__.py
Normal file
21
examples/eq_edit/__main__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import time
|
||||
|
||||
import voicemeeterlib
|
||||
|
||||
def main():
|
||||
KIND_ID = 'banana'
|
||||
|
||||
with voicemeeterlib.api(KIND_ID) as vm:
|
||||
vm.bus[0].eq.on = True
|
||||
vm.bus[0].eq.channel[0].cell[0].on = True
|
||||
vm.bus[0].eq.channel[0].cell[0].f = 500
|
||||
vm.bus[0].eq.channel[0].cell[0].type = 3 # Should correspond to LPF
|
||||
|
||||
time.sleep(3)
|
||||
vm.bus[0].eq.on = False
|
||||
vm.bus[0].eq.channel[0].cell[0].on = False
|
||||
vm.bus[0].eq.channel[0].cell[0].f = 50
|
||||
vm.bus[0].eq.channel[0].cell[0].type = 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -88,6 +88,24 @@ class Bus(IRemote):
|
||||
|
||||
|
||||
class BusEQ(IRemote):
|
||||
@classmethod
|
||||
def make(cls, remote, i):
|
||||
"""
|
||||
Factory method for BusEQ.
|
||||
|
||||
Returns a BusEQ class.
|
||||
"""
|
||||
kls = (cls,)
|
||||
return type(
|
||||
'BusEQ',
|
||||
kls,
|
||||
{
|
||||
'channel': tuple(
|
||||
BusEQCh.make(remote, i, j) for j in range(remote.kind.channels)
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq'
|
||||
@@ -109,6 +127,85 @@ class BusEQ(IRemote):
|
||||
self.setter('ab', 1 if val else 0)
|
||||
|
||||
|
||||
class BusEQCh(IRemote):
|
||||
@classmethod
|
||||
def make(cls, remote, i, j):
|
||||
"""
|
||||
Factory method for Bus EQ channel.
|
||||
|
||||
Returns a BusEQCh class.
|
||||
"""
|
||||
kls = (cls,)
|
||||
return type(
|
||||
'BusEQCh',
|
||||
kls,
|
||||
{
|
||||
'cell': tuple(
|
||||
BusEQChCell(remote, i, j, k) for k in range(remote.kind.cells)
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
def __init__(self, remote, i, j):
|
||||
super().__init__(remote, i)
|
||||
self.channel_index = j
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq.channel[{self.channel_index}]'
|
||||
|
||||
|
||||
class BusEQChCell(IRemote):
|
||||
def __init__(self, remote, i, j, k):
|
||||
super().__init__(remote, i)
|
||||
self.channel_index = j
|
||||
self.cell_index = k
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return f'Bus[{self.index}].eq.channel[{self.channel_index}].cell[{self.cell_index}]'
|
||||
|
||||
@property
|
||||
def on(self) -> bool:
|
||||
return self.getter('on') == 1
|
||||
|
||||
@on.setter
|
||||
def on(self, val: bool):
|
||||
self.setter('on', 1 if val else 0)
|
||||
|
||||
@property
|
||||
def type(self) -> int:
|
||||
return int(self.getter('type'))
|
||||
|
||||
@type.setter
|
||||
def type(self, val: int):
|
||||
self.setter('type', val)
|
||||
|
||||
@property
|
||||
def f(self) -> float:
|
||||
return round(self.getter('f'), 1)
|
||||
|
||||
@f.setter
|
||||
def f(self, val: float):
|
||||
self.setter('f', val)
|
||||
|
||||
@property
|
||||
def gain(self) -> float:
|
||||
return round(self.getter('gain'), 1)
|
||||
|
||||
@gain.setter
|
||||
def gain(self, val: float):
|
||||
self.setter('gain', val)
|
||||
|
||||
@property
|
||||
def q(self) -> float:
|
||||
return round(self.getter('q'), 1)
|
||||
|
||||
@q.setter
|
||||
def q(self, val: float):
|
||||
self.setter('q', val)
|
||||
|
||||
|
||||
class PhysicalBus(Bus):
|
||||
@classmethod
|
||||
def make(cls, remote, i, kind):
|
||||
@@ -321,7 +418,7 @@ def bus_factory(is_phys_bus, remote, i) -> Union[PhysicalBus, VirtualBus]:
|
||||
{
|
||||
'levels': BusLevel(remote, i),
|
||||
'mode': BUSMODEMIXIN_cls(remote, i),
|
||||
'eq': BusEQ(remote, i),
|
||||
'eq': BusEQ.make(remote, i),
|
||||
},
|
||||
)(remote, i)
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ class KindMapClass(metaclass=SingletonType):
|
||||
asio: tuple
|
||||
insert: int
|
||||
composite: int
|
||||
channels: int
|
||||
cells: int
|
||||
|
||||
@property
|
||||
def phys_in(self) -> int:
|
||||
@@ -76,6 +78,8 @@ class BasicMap(KindMapClass):
|
||||
asio: tuple = (0, 0)
|
||||
insert: int = 0
|
||||
composite: int = 0
|
||||
channels: int = 0
|
||||
cells: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -86,6 +90,8 @@ class BananaMap(KindMapClass):
|
||||
asio: tuple = (6, 8)
|
||||
insert: int = 22
|
||||
composite: int = 8
|
||||
channels: int = 9
|
||||
cells: int = 6
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -96,6 +102,8 @@ class PotatoMap(KindMapClass):
|
||||
asio: tuple = (10, 8)
|
||||
insert: int = 34
|
||||
composite: int = 8
|
||||
channels: int = 9
|
||||
cells: int = 6
|
||||
|
||||
|
||||
def kind_factory(kind_id):
|
||||
|
||||
Reference in New Issue
Block a user