catvox
catvox.utils
catvox.utils.classproperty
classproperty Objects
class classproperty()
Our old friend, the class property.
catvox.utils.monkeypipe
catvox.transcribe
catvox.transcribe.whisper
Whisper Objects
class Whisper()
transcribe
def transcribe(audio, max_length, duration)
Run the transcription loop in the foreground:
- Read audio from
audio.read() - Accumulate until
durationseconds have passed, then runmodel.transcribe(buffer) - If stable, print transcript.
- If max_length reached, print whatever we have.
catvox.inputs
Input Objects
class Input(abc.ABC)
start
@abc.abstractmethod
def start(device=None)
Start capturing audio.
stop
@abc.abstractmethod
def stop()
Stop capturing audio.
is_running
@property
def is_running()
Return True if audio capture is currently running.
sample_rate
@property
def sample_rate()
Return the samplerate of the audio source.
devices
@property
def devices()
Return a copy of the devices dictionary. Key and description.
device
@property
def device()
Return the current device identifier.
read
@abc.abstractmethod
def read(timeout=None)
Return a chunk of audio samples as a NumPy array, or None if:
- No data is available within ‘timeout’, or
- The audio is stopped and no more data is forthcoming.
Blocks up to timeout seconds if no data is immediately available.
catvox.inputs.sounddevice
SoundDevice Objects
class SoundDevice(Input)
Audio source using the sounddevice library.
start
def start(device=None)
Start capturing audio from the selected device.
stop
def stop()
Stop capturing audio.
read
def read(timeout=None)
Return a chunk of audio samples as a flat float32 NumPy array. If no data is available within ‘timeout’, returns None. If the source is stopped and no data is left, returns None.