Transcriber#

class Transcriber(default_microphone: str = 'list')[source]#

Bases: object

Real-time transcription of user microphone input

Methods

clear_recording_buffer

Clear the recording buffer

get_microphone

Get speech recognition microphone device

run

Return the most recent single phrase of microphone input

Attributes

record_timeout

How real-time the recording is.

phrase_timeout

Delay before ending user monologue.

energy_threshold

Microphone energy threshold for background noise.

default_microphone

Default microphone name.

phrase_time

The last time a recording was retreived from the queue.

last_sample

Current raw audio bytes.

data_queue

Thread-safe Queue for passing data from the threaded recording callback.

recorder

SpeechRecognizer to record and detect when speech ends.

temp_file

File for sending to OpenAI Whisper API.

clear_recording_buffer() → None[source]#

Clear the recording buffer

data_queue: Queue#

Thread-safe Queue for passing data from the threaded recording callback.

default_microphone: str#

Default microphone name.

energy_threshold: int#

Microphone energy threshold for background noise.

get_microphone() → Microphone[source]#

Get speech recognition microphone device

last_sample: bytes#

Current raw audio bytes.

phrase_time: datetime | None#

The last time a recording was retreived from the queue.

phrase_timeout: float#

Delay before ending user monologue.

record_timeout: float#

How real-time the recording is.

recorder: Recognizer#

SpeechRecognizer to record and detect when speech ends.

run() → str[source]#

Return the most recent single phrase of microphone input

temp_file: str#

File for sending to OpenAI Whisper API.