diff --git a/README.md b/README.md index adfada4..f5cf897 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ## Latest News 🔥 -- [2025/07] We support **Python inference** on **macOS** with usage of the prebuilt-lib! +- [2025/07] We support **Python inference** on **macOS** and **Windows** with usage of the prebuilt-lib! - [2025/06] We **finally** released and **open-sourced** the **ONNX** model and the corresponding **preprocessing code**! Now you can deploy **TEN VAD** on **any platform** and **any hardware architecture**! - [2025/06] We are excited to announce the release of **WASM+JS** for Web WASM Support. @@ -285,7 +285,7 @@ The project supports five major platforms with dynamic library linking. ### **Python Usage** -#### **1. Linux / macOS** +#### **1. Linux / macOS / Windows** #### **Requirements** diff --git a/include/ten_vad.py b/include/ten_vad.py index 573f24c..13beec1 100644 --- a/include/ten_vad.py +++ b/include/ten_vad.py @@ -40,6 +40,33 @@ def __init__(self, hop_size: int = 256, threshold: float = 0.5): "./ten_vad_library/libten_vad" ) self.vad_library = CDLL(pip_path) + elif platform.system().upper() == 'WINDOWS': + if platform.machine().upper() in ['X64', 'X86_64', 'AMD64']: + git_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "../lib/Windows/x64/ten_vad.dll" + ) + if os.path.exists(git_path): + self.vad_library = CDLL(git_path) + else: + pip_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "./ten_vad_library/ten_vad.dll" + ) + self.vad_library = CDLL(pip_path) + else: + git_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "../lib/Windows/x86/ten_vad.dll" + ) + if os.path.exists(git_path): + self.vad_library = CDLL(git_path) + else: + pip_path = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "./ten_vad_library/ten_vad.dll" + ) + self.vad_library = CDLL(pip_path) else: raise NotImplementedError(f"Unsupported platform: {platform.system()} {platform.machine()}") self.vad_handler = c_void_p(0) diff --git a/setup.py b/setup.py index fa3baa7..839f57a 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,15 @@ def run(self): shutil.copy("lib/macOS/ten_vad.framework/Versions/A/ten_vad", os.path.join(target_dir, "libten_vad")) print(f"macOS library installed to: {target_dir}") + elif platform.system().upper() == 'WINDOWS': + if platform.machine().upper() in ['X64', 'X86_64', 'AMD64']: + shutil.copy("lib/Windows/x64/ten_vad.dll", + os.path.join(target_dir, "ten_vad.dll")) + print(f"Windows x64 library installed to: {target_dir}") + else: + shutil.copy("lib/Windows/x86/ten_vad.dll", + os.path.join(target_dir, "ten_vad.dll")) + print(f"Windows x86 library installed to: {target_dir}") else: raise NotImplementedError(f"Unsupported platform: {platform.system()} {platform.machine()}")