Logger
logger.Utils
Utility functions and helpers for Logger integration.
is_silence
Detects if the given PCM16 byte buffer is mostly silence.
Arguments:
Name | Type | Description |
---|---|---|
pcm_bytes | bytes | PCM16LE audio data. |
threshold | int | Max absolute value to consider as silence. |
min_silence_ratio | float | Minimum ratio of silent samples to consider the buffer as silence. |
Returns:
Name | Description |
---|---|
bool | True if buffer is mostly silence, False otherwise. |
pcm16_to_wav_bytes
Convert PCM-16 audio data to WAV format bytes.
Arguments:
Name | Type | Description |
---|---|---|
pcm_bytes | bytes | Raw PCM-16 audio data |
num_channels | int | Number of audio channels (default: 1) |
sample_rate | int | Sample rate in Hz (default: 24000) |
Returns:
Name | Description |
---|---|
bytes | WAV format audio data |
make_object_serializable
Convert any Python object into a JSON-serializable format while preserving as much information as possible about the original object.
Arguments:
Name | Description |
---|---|
obj | Any Python object |
Returns:
A JSON-serializable representation of the object