two dots are rust specific thinks, I'm not sure if it's familiar for Python developers.
This commit is contained in:
@@ -37,7 +37,7 @@ class AICFilter(BaseAudioFilter):
|
|||||||
"""Audio filter using ai-coustics' AIC SDK for real-time enhancement.
|
"""Audio filter using ai-coustics' AIC SDK for real-time enhancement.
|
||||||
|
|
||||||
Buffers incoming audio to the model's preferred block size and processes
|
Buffers incoming audio to the model's preferred block size and processes
|
||||||
frames using float32 samples normalized to the -1..+1 range.
|
frames using float32 samples normalized to the range -1 to +1.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This class requires aic-sdk ~= 2.0.0 (uses 'aic_sdk' module).
|
This class requires aic-sdk ~= 2.0.0 (uses 'aic_sdk' module).
|
||||||
@@ -90,7 +90,9 @@ class AICFilter(BaseAudioFilter):
|
|||||||
# Audio format constants
|
# Audio format constants
|
||||||
self._bytes_per_sample = 2 # int16 = 2 bytes
|
self._bytes_per_sample = 2 # int16 = 2 bytes
|
||||||
self._dtype = np.int16
|
self._dtype = np.int16
|
||||||
self._scale = 32768.0 # 2^15, for normalizing int16 (-32768..32767) to float32 (-1.0..1.0)
|
self._scale = (
|
||||||
|
32768.0 # 2^15, for normalizing int16 (-32768 to 32767) to float32 (-1.0 to 1.0)
|
||||||
|
)
|
||||||
|
|
||||||
# AIC SDK objects
|
# AIC SDK objects
|
||||||
self._model = None
|
self._model = None
|
||||||
@@ -125,13 +127,13 @@ class AICFilter(BaseAudioFilter):
|
|||||||
AIC VAD parameters:
|
AIC VAD parameters:
|
||||||
- speech_hold_duration:
|
- speech_hold_duration:
|
||||||
How long VAD continues detecting after speech ends (in seconds).
|
How long VAD continues detecting after speech ends (in seconds).
|
||||||
Range: 0.0 .. 20x model window length, Default (SDK): 0.05s
|
Range: 0.0 to 20x model window length, Default (SDK): 0.05s
|
||||||
- minimum_speech_duration:
|
- minimum_speech_duration:
|
||||||
Minimum duration of speech required before VAD reports speech detected
|
Minimum duration of speech required before VAD reports speech detected
|
||||||
(in seconds). Range: 0.0 .. 1.0, Default (SDK): 0.0s
|
(in seconds). Range: 0.0 to 1.0, Default (SDK): 0.0s
|
||||||
- sensitivity:
|
- sensitivity:
|
||||||
Energy threshold sensitivity. Energy threshold = 10 ** (-sensitivity).
|
Energy threshold sensitivity. Energy threshold = 10 ** (-sensitivity).
|
||||||
Range: 1.0 .. 15.0, Default (SDK): 6.0
|
Range: 1.0 to 15.0, Default (SDK): 6.0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
speech_hold_duration: Optional speech hold duration to configure on the VAD.
|
speech_hold_duration: Optional speech hold duration to configure on the VAD.
|
||||||
@@ -139,7 +141,7 @@ class AICFilter(BaseAudioFilter):
|
|||||||
minimum_speech_duration: Optional minimum speech duration before VAD reports
|
minimum_speech_duration: Optional minimum speech duration before VAD reports
|
||||||
speech detected. If None, SDK default (0.0s) is used.
|
speech detected. If None, SDK default (0.0s) is used.
|
||||||
sensitivity: Optional sensitivity (energy threshold) to configure on the VAD.
|
sensitivity: Optional sensitivity (energy threshold) to configure on the VAD.
|
||||||
Range: 1.0 .. 15.0. If None, SDK default (6.0) is used.
|
Range: 1.0 to 15.0. If None, SDK default (6.0) is used.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A lazily-initialized AICVADAnalyzer that will bind to the VAD context
|
A lazily-initialized AICVADAnalyzer that will bind to the VAD context
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This module provides VAD analyzer implementations that query the AIC SDK's
|
|||||||
is_speech_detected() and map it to a float confidence (1.0/0.0).
|
is_speech_detected() and map it to a float confidence (1.0/0.0).
|
||||||
|
|
||||||
Classes:
|
Classes:
|
||||||
AICVADAnalyzer: For aic-sdk >= 2.0.0 (uses 'aic_sdk' module)
|
AICVADAnalyzer: For aic-sdk (uses 'aic_sdk' module)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional
|
||||||
@@ -27,16 +27,16 @@ class AICVADAnalyzer(VADAnalyzer):
|
|||||||
- speech_hold_duration:
|
- speech_hold_duration:
|
||||||
Controls for how long the VAD continues to detect speech after the audio signal
|
Controls for how long the VAD continues to detect speech after the audio signal
|
||||||
no longer contains speech (in seconds).
|
no longer contains speech (in seconds).
|
||||||
Range: 0.0 .. 20x model window length
|
Range: 0.0 to 20x model window length
|
||||||
Default (SDK): 0.05s (50ms)
|
Default (SDK): 0.05s (50ms)
|
||||||
- minimum_speech_duration:
|
- minimum_speech_duration:
|
||||||
Controls for how long speech needs to be present in the audio signal before the VAD considers it speech (in seconds).
|
Controls for how long speech needs to be present in the audio signal before the VAD considers it speech (in seconds).
|
||||||
Range: 0.0 .. 1.0
|
Range: 0.0 to 1.0
|
||||||
Default (SDK): 0.0s
|
Default (SDK): 0.0s
|
||||||
- sensitivity:
|
- sensitivity:
|
||||||
Controls the energy threshold sensitivity. Higher values make the detector
|
Controls the energy threshold sensitivity. Higher values make the detector
|
||||||
less sensitive (require more energy to count as speech).
|
less sensitive (require more energy to count as speech).
|
||||||
Range: 1.0 .. 15.0
|
Range: 1.0 to 15.0
|
||||||
Formula: Energy threshold = 10 ** (-sensitivity)
|
Formula: Energy threshold = 10 ** (-sensitivity)
|
||||||
Default (SDK): 6.0
|
Default (SDK): 6.0
|
||||||
|
|
||||||
@@ -61,16 +61,16 @@ class AICVADAnalyzer(VADAnalyzer):
|
|||||||
will retry on set_sample_rate/first use.
|
will retry on set_sample_rate/first use.
|
||||||
speech_hold_duration:
|
speech_hold_duration:
|
||||||
Optional override for AIC VAD speech hold duration (in seconds).
|
Optional override for AIC VAD speech hold duration (in seconds).
|
||||||
Range: 0.0 .. 20x model window length.
|
Range: 0.0 to 20x model window length.
|
||||||
If None, the SDK default (0.05s) is used.
|
If None, the SDK default (0.05s) is used.
|
||||||
minimum_speech_duration:
|
minimum_speech_duration:
|
||||||
Optional override for minimum speech duration before VAD reports
|
Optional override for minimum speech duration before VAD reports
|
||||||
speech detected (in seconds).
|
speech detected (in seconds).
|
||||||
Range: 0.0 .. 20x model window length.
|
Range: 0.0 to 20x model window length.
|
||||||
If None, the SDK default (0.0s) is used.
|
If None, the SDK default (0.0s) is used.
|
||||||
sensitivity:
|
sensitivity:
|
||||||
Optional override for AIC VAD sensitivity (energy threshold).
|
Optional override for AIC VAD sensitivity (energy threshold).
|
||||||
Range: 1.0 .. 15.0. Energy threshold = 10 ** (-sensitivity).
|
Range: 1.0 to 15.0. Energy threshold = 10 ** (-sensitivity).
|
||||||
If None, the SDK default (6.0) is used.
|
If None, the SDK default (6.0) is used.
|
||||||
"""
|
"""
|
||||||
# Use fixed VAD parameters for AIC: no user override
|
# Use fixed VAD parameters for AIC: no user override
|
||||||
|
|||||||
Reference in New Issue
Block a user