Listener device to capture audio from microphone and convert any speech to text and send to callback method.
__init__(self, speechModel=None, speechScorer=None, audioChannels=1, audioSampleRate=16000, vadAggressiveness=1, speechRatio=0.75, speechBufferSize=50, speechBufferPadding=350, audioDeviceIndex=None, callback=None)
special
Listener Initialization
Parameters: |
speechModel (str ) – Path and filename of Deepspeech Speech Model file. If not set then listener will do a basic seach for the PBMM or TFLite file.
speechScorer (str ) – Path and filename of Deepspeech Scorer file. Okay for this to be None as scorer file is not required.
audioChannels (int ) – Audio channels for audio source. VAD requires this to be 1 channel.
audioSampleRate (int ) – Audio sample rate of audio source. VAD requires this to be 16000.
vadAggressiveness (int ) – Voice Activity Detection (VAD) aggressiveness for filtering noise. Accepts 1 thru 3.
speechRatio (float ) – Must be between 0 and 1 as a decimal
speechBufferSize (int ) – Buffer size for speech frames
speechBufferPadding (int ) – Padding, in milliseconds, of speech frames
audioDeviceIndex (int ) – Listening device index number. If not set then will use default audio capture device.
callback (function ) – Callback function for which to send capture text
|
start(self, useThreads=True)
Starts the listener to listen to the default audio device
stop(self)
Stops the listener and any active audio streams
wait(self, seconds=0)
Waits for any active listeners to complete before closing