onyx-and-iris / voicemeeter-api-python Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper around the Voiceemeter Remote API
License: MIT License
A Python wrapper around the Voiceemeter Remote API
License: MIT License
example in vban class:
@sr.setter
def sr(self, val: int):
opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
if val not in opts:
raise VMError(f"Expected one of: {opts}")
we might instead:
@sr.setter
def sr(self, val: int):
opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
if val not in opts:
self.logger.warning(f"sr got {val} but expected a value in {opts}")
it might be better for us to simply log these occurrences as warnings for the following reasons:
First of all, this is AWESOME! I can't wait to start using this project. I've been wanting to create a little web-interface so that I could interact with VoiceMeeter on a remote server, maybe even integrate with Home Assistant. I think I'll want to use this project to give that system some legs to stand on. So kudos to you on this awesome project, and THANK YOU! I can't wait to get started.
I wanted to ask, though, do you have a recommended example for using the API outside the support of a with
statement? Since I'm interested in using this with FastAPI as the web-server-backend, it would likely make the most sense to have a global VoiceMeeter context, or at least one per web-session, not spinning them up for every single request - which would seem excessive.
Looking at the __enter__
and __exit__
blocks, the pattern below seems to make the most sense. Do you have other suggestions?
# Base Framework Example
import voicemeeterlib
from fastapi import FastAPI
KIND = "banana"
app = FastAPI()
vm_api = voicemeeterlib.api(KIND)
vm_api.login()
vm_api.init_thread()
...
# Closing Down
#vm_api.end_thread()
#vm_api.logout()
Is this a reasonable approach, or would you recommend another syntax form? Thank you, again!
你好,我遇到一个问题。
在potato程序上划动音量增益推子修改数值后,使用py获取该数值。
import voicemeeterlib
KIND_ID = "potato"
with voicemeeterlib.api(KIND_ID) as vm:
print(vm.strip[3].gain)
但第一次获取的数值不是potato程序当前的数值,需要第二次重新运行py才能获取到potato程序当前的数值!
应该怎么解决呢?提前感谢作者
I've noticed that sometimes it's taking a bit longer than 1 second for the API to respond after a login (if it needs to start the audio engine first). This can cause {Remote}.login() to raise a CAPIError when in fact waiting a bit longer for a response succeeds.
Setting a timeout for login should fix this.
Currently only the Audio streams are implemented.
Traceback (most recent call last):
File "C:\Users\user\Documents\pythonProject\test208.py", line 1, in <module>
import voicemeeterlib
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\voicemeeterlib\__init__.py", line 1, in <module>
from .factory import request_remote_obj as api
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\voicemeeterlib\factory.py", line 16, in <module>
from .remote import Remote
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\voicemeeterlib\remote.py", line 8, in <module>
from .cbindings import CBindings
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\voicemeeterlib\cbindings.py", line 9, in <module>
class CBindings(metaclass=ABCMeta):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\voicemeeterlib\cbindings.py", line 36, in CBindings
vm_mdirty = libc.VBVMR_MacroButton_IsDirty
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'VBVMR_MacroButton_IsDirty' not found
This will mean introducing a breaking change, so a new major version will be required.
Also would be worth adding a mixin class for Denoiser (I think Voicemeeter devs intend to add more parameters for denoiser in future version of api)
Hey,
On my system the script starts VM on itself which is not desired.
please add an option to disable the autostart of VM to voicemeeterlib.api()
.
and, at least on my system, the startet VM version is 32bit... wich is kinda odd. ;)
so maybe a "32bit bool" might also be recommended - for 64bit by default.
like this:
voicemeeterlib.api(KIND_ID, autostart: bool = True, 32bit: bool = False)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.