-
Notifications
You must be signed in to change notification settings - Fork 44
enhance ten vad python and c interfaces with robustness, async support, and framework integration. #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lincuan
wants to merge
5
commits into
TEN-framework:main
Choose a base branch
from
lincuan:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…improvements - add dynamic library path loading for cross-platform support (linux, windows, macos). - replace assert with proper error handling and logging for robustness. - enhance input validation in get\_input\_data to handle edge cases (empty arrays, non-contiguous memory). - improve memory management by retaining audio data reference to prevent garbage collection issues. - introduce async processing with process\_async method for real-time applications. - add comprehensive docstrings and type hints for better usability. - implement dynamic threshold adjustment with set\_threshold method. - add callback support for integration with ten framework. - maintain original functionality while improving maintainability and extensibility.
- add ten_vad_error_t enum for detailed error codes (invalid param, out of memory, etc.). - enhance documentation with detailed parameter constraints, error cases, and usage examples. - add ten_vad_set_threshold function for dynamic threshold adjustment. - introduce ten_vad_register_callback for event-driven integration with ten framework. - add ten_vad_version_t and ten_vad_get_version_struct for structured version information. - improve handle safety documentation for ten_vad_destroy. - maintain compatibility with existing ten_vad.py interface.
- add test_ten_vad_enhanced.py with comprehensive unit tests: - test initialization with valid and invalid parameters (hop_size, threshold). - validate process and process_async methods with valid and invalid inputs (wrong shape, type, empty arrays). - test set_threshold method for valid and invalid threshold values. - verify callback functionality in process and process_async. - test error handling for invalid library paths using TEN_VAD_LIB_PATH. - ensure tests cover robustness, edge cases, and TEN framework integration. - use unittest framework and numpy for test data generation.
- add test_ten_vad.c with comprehensive unit tests using Check framework: - test ten_vad_create and ten_vad_destroy with valid and invalid parameters, including repeated destruction safety. - validate ten_vad_process with valid and invalid inputs (NULL pointers, incorrect audio_data_length). - test ten_vad_set_threshold with valid and invalid threshold values. - verify ten_vad_register_callback triggers correctly during processing. - test ten_vad_get_version and ten_vad_get_version_struct for version retrieval. - ensure tests cover robustness, edge cases, and TEN framework integration requirements. - tests designed to validate new interfaces and error handling introduced in ten_vad_enhanced.h.
Refer to text.md for comprehensive test coverage, execution instructions, and implementation notes. |
Thanks for your PR! We are currently validating the code :-) |
good morning and don’t hesitate to contact me if any issues arise during code review. |
ysdede
added a commit
to ysdede/ten-vad
that referenced
this pull request
May 19, 2025
Merge PR TEN-framework#7 from lincuan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR enhances the TEN VAD framework's Python (ten_vad.py) and C header (ten_vad.h) interfaces to improve robustness, performance, usability, and integration with the broader TEN framework. The changes maintain backward compatibility while addressing limitations and adding features for real-time, cross-platform, and multimodal conversational AI applications. Files are renamed to ten_vad_enhanced.py and ten_vad_enhanced.h to reflect improvements.
Changes
Python Interface (ten_vad_enhanced.py)
C Header Interface (ten_vad_enhanced.h)
Motivation
The original ten_vad.py and ten_vad.h had limitations:
These enhancements align with the TEN framework's goals of real-time, multimodal, and low-latency conversational AI, as highlighted in community discussions (e.g., X posts on VAD sensitivity and language support).
Testing
Additional Notes
Checklist