kino-pcm

kino-pcm

Standalone PCM sample conversion and G.711 companding, with no shard dependencies.

require "kino-pcm"

sample = Kino::PCM.decode_sample(Bytes[0, 128], 0, 2) # little-endian PCM16
sample = Kino::PCM.decode_sample(Bytes[0x80, 0], 0, 2, big_endian: true)
silence = Kino::PCM::G711.decode_ulaw(255_u8)

Integer samples support 8/16/24/32-bit signed PCM and unsigned 8-bit PCM. Float samples support 32/64-bit PCM. Set float: true, unsigned: true, big_endian: true, or companding: "ulaw" / "alaw" as appropriate. Offsets and widths are checked. Output is normalized Float32.

WAV, AIFF/CAF and MP4 adapters can reuse this shard without depending on each other or on the all-format kino facade. Run crystal spec to test it.

Repository

kino-pcm

Owner
Statistic
  • 0
  • 0
  • 0
  • 3
  • 0
  • about 2 hours ago
  • December 4, 2026
License

MIT License

Links
Synced at

Fri, 04 Dec 2026 15:28:26 GMT

Languages