voicebox.sinks package
Submodules
voicebox.sinks.distributor module
voicebox.sinks.sink module
voicebox.sinks.sounddevice module
- class voicebox.sinks.sounddevice.SoundDevice(device: int | str = None, blocking: bool = True, latency: float | Literal['low', 'high'] = 0.1)[source]
Bases:
SinkAn audio sink that uses the sounddevice library to play audio through the default audio device.
- Parameters:
device (Device) – Device index or query string specifying the device to be used. If
None(default), a device will be selected automatically. Seesounddevice.query_devices()for valid choices.blocking (bool) – Whether to wait for playback to finish before returning.
latency (float | 'low' | 'high') – The desired latency in seconds. The special values ‘low’ and ‘high’ select the device’s default low and high latency, respectively. Lower latency reduces time to playback; higher latency improves stability.
- blocking: bool = True
- device: int | str = None
- latency: float | Literal['low', 'high'] = 0.1
voicebox.sinks.wavefile module
- class voicebox.sinks.wavefile.WaveFile(file: IO[bytes] | str | Path, append: bool = False, sample_width: int = 2)[source]
Bases:
SinkWrites audio to a WAV file.
- Parameters:
file (FileOrPath) – The file to write to. If a path is given, the file will be opened in write mode. If a file-like object is given, it will be written to directly.
append (bool) – Whether to append to an existing file. If
True, the file must already exist and the sample rate must match the existing file.sample_width (int) – The number of bytes to use per sample. Must be 1, 2, or 4.
- append: bool = False
- file: IO[bytes] | str | Path
- sample_width: int = 2