askbob.speech.listener package

Submodules

askbob.speech.listener.file module

class askbob.speech.listener.file.FileUtteranceService(filename: str, aggressiveness: int = 1, lowpass_frequency: int = 65, highpass_frequency: int = 4000)

Bases: askbob.speech.listener.listener.UtteranceService

chunk: int = 320

askbob.speech.listener.listener module

class askbob.speech.listener.listener.UtteranceService(aggressiveness: int = 1, lowpass_frequency: int = 65, highpass_frequency: int = 4000)

Bases: object

The UtteranceService is responsible for compiling complete utterances for the speech transcriber.

block_size: int = 320
blocks_per_second: int = 50
buffer_queue: queue.Queue
channels: int = 1
property frame_duration_ms
input_rate: int
reset_buffer_queue: bool = True
sample_rate: int = 16000
utterances(padding_ms=300, ratio=0.75)

This is a generator that yields series of consecutive audio frames for each utterence, separated by a single None.

It determines the level of voice activity using the ratio of frames in padding_ms. It uses a buffer to include padding_ms prior to being triggered.

Example: (frame, …, frame, None, frame, …, frame, None, …)
utterence | | utterence |
vad: webrtcvad.Vad
write_wav(filename: str, data)

Writes audio frames to a .wav file.

Parameters
  • filename (str) – The filename of the .wav file to be written.

  • data – The audio frames.

askbob.speech.listener.mic module

class askbob.speech.listener.mic.MicUtteranceService(aggressiveness: int = 1, device_index: Optional[int] = None, input_rate: int = 16000, lowpass_frequency: int = 65, highpass_frequency: int = 4000)

Bases: askbob.speech.listener.listener.UtteranceService

device_index: int
pa: pyaudio.PyAudio
stream: pyaudio.Stream

Module contents