> ## Documentation Index
> Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# logger.Utils

> Utility functions and helpers for Logger integration.

[View module source on GitHub](https://github.com/maximhq/maxim-py/blob/main/maxim/logger/utils.py)

#### is\_silence

```python theme={null}
def is_silence(pcm_bytes, threshold=500, min_silence_ratio=0.95)
```

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

```python theme={null}
def pcm16_to_wav_bytes(pcm_bytes: bytes,
                       num_channels: int = 1,
                       sample_rate: int = 24000) -> 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

```python theme={null}
def make_object_serializable(obj: Any) -> Any
```

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
