Skip to content

Sys

Raw FFI bindings for libsymphonia, the Rust wrapper around Symphonia built from this package's native/ folder. Prefer Symphonia.Decoder over calling the library directly.

opus and sodium load their library when they are required, and dave swaps in a stub module without FFI. Symphonia loads lazily instead: requiring it, or audio, never downloads a 2 to 3 MB library that a bot which plays no files would never use. load loads it on its first call.

Sys.library  :: Lib?

The loaded library, nil until a load succeeds.

Sys.loading  :: boolean

Whether a load is in flight.

Sys.waitingThreads  :: { thread }

The threads waiting on the load in flight, resumed with its result.

Sys.logger  :: Logger

The loader's logger, named Symphonia and at Info.

Sys.infoField  :: {
sampleRate: number,
channels: number,
isOpus: number,
durationMilliseconds: number,
skippedPackets: number,
isFailed: number,
endedEarly: number,
state: number,
}

The field numbers symphonia_info takes. endedEarly (6) is 1 when decoding ended short of the length the file states, because the file is truncated or damaged packets were skipped. state (7) is 0 while a stream probes, 1 once open, 2 at the end and 3 after a failure; isFailed (5) is 1 exactly when it is 3.

Sys.describeField  :: {
codec: number,
container: number,
failure: number,
}

The field numbers symphonia_describe takes. failure (2) is the failure text, empty until the state is 3.

Sys . load ( )  -> Lib

Returns the library, loading it on the first call and caching it. The load runs in its own deferred thread and every caller waits for it, so the first call always yields, and callers that arrive while it is in flight share its result; a caller cancelled while it waits never strands the others. The first load may download the library and checks its sha256, which takes about 360 ms of Luau for a 3 MB file; call it at startup to take that cost early. A failed load is not cached, so the next call tries again.

Raises Symphonia requires FFI which is not available on this runtime without FFI, and libsymphonia ABI version <n> does not match 3; update the symphonia package for a library this package cannot use.

Returns

Lib