Module: ninty.audio
def interleave(channels: list[bytes]) -> bytes
Interleaves the given PCM-16 channels. Every channel must contain the same number of samples.
def deinterleave(data: bytes, channels: int) -> list[bytes]
Deinterleaves the given PCM-16 samples into the given number of channels.
def decode_pcm8(data: bytes) -> bytes
Decodes PCM-8 samples to PCM-16.
def encode_pcm8(data: bytes) -> bytes
Encodes PCM-16 samples as PCM-8. This is a lossy compression algorithm.
def decode_adpcm(data: bytes, samples: int, coefs: list[int]) -> bytes
Decompresses the given number of ADPCM samples to PCM-16 using the given ADPCM coefficients.
def encode_adpcm(data: bytes) -> tuple[bytes, list[int]]
Compresses the given PCM-16 samples as ADPCM. The returned tuple contains the compressed samples and ADPCM coefficients. This is a lossy compression algorithm.
def get_adpcm_context(data: bytes, samples: int, coefs: list[int]) -> tuple[int, int, int]
Determines the state of the ADPCM algorithm at the given sample. The returned tuple contains the current pred/scale byte, and the previous two samples.