FileSink
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| AudioSink anyvoice.base Abstract base class for audio output backends. |
⋔ Inheritance diagram¶
graph TD
364532337["sinks.FileSink"]
3407701203["base.AudioSink"]
925645236["abc.ABC"]
2751680898["builtins.object"]
3407701203 --> 364532337
925645236 --> 3407701203
2751680898 --> 925645236
🛈 DocStrings¶
Bases: AudioSink
Audio sink that writes PCM audio to a WAV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike[str]
|
Path to the output WAV file. |
required |
sample_rate
|
int
|
Audio sample rate in Hz. Defaults to 24000. |
24000
|
channels
|
int
|
Number of audio channels. Defaults to 1 (mono). |
1
|
Source code in src/anyvoice/sinks.py
__aenter__
async
¶
__aexit__
async
¶
__aexit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None
Write collected audio to WAV file.
Source code in src/anyvoice/sinks.py
write
async
¶
Buffer audio chunk for later writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunk
|
bytes
|
PCM audio data to save. |
required |