Metadata-Version: 2.4
Name: tatolab-opus
Version: 0.68.29
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Multimedia :: Sound/Audio
Requires-Dist: tatolab-stream>=0.68.7
License-File: LICENSE
License-File: THIRD-PARTY-NOTICES.md
Summary: Opus encode and decode nodes for Tatolab streams.
Author-email: Jonathan Fontanez <fontanezj1@gmail.com>
License: BUSL-1.1
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://tatolab.com
Project-URL: Install, https://tatolab.com/docs/install
Project-URL: Source, https://github.com/tatolab/streamlib

# tatolab-opus

Opus encode and decode for [Tatolab](https://tatolab.com) streams, as an extension wheel:
libopus and the codec state in Rust inside, two ordinary `@node` classes as the binding.

> **New to Tatolab? Install the Tatolab app first.** This package adds two nodes to a stream
> project; the Tatolab runtime, which comes with the app, is what runs them. See
> [Install Tatolab](https://tatolab.com/docs/install) and the
> [Quickstart](https://tatolab.com/docs/quickstart).

In a stream project:

```bash
uv add tatolab-opus
```

```python
from tatolab.opus import OpusDecoder, OpusEncoder
```

`OpusEncoder` takes audio on `audio`, which declares a 20 ms window at 48 kHz in `f32` and
follows the source's channel count (one to eight), and writes one media frame per Opus packet
on `encoded_audio` — hang's legacy container, a QUIC varint timestamp in microseconds and then
the packet. The port's catalog entry carries the channel count and the `OpusHead`. Its config
is optional: `bitrate_bps`, and `application` (`audio`, `voip` or `lowdelay`).

`OpusDecoder` takes those media frames on `encoded_audio` and writes `AudioBlock` messages on
`audio`, at 48 kHz in the stream's own channel count.

Each node runs in its own processor interpreter, and libopus runs in that process.

