waveform

package
v0.0.0-...-844f318 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package waveform implements encoding and decoding of a Telegram waveform.

Telegram waveforms consist of packed 5-bit values. The values are packed into a byte stream, meaning that the actual values cross the byte boundary.

The following diagram explains the format:

[210|43210][0|43210|43][3210|4321][10|43210|4]...
[111|00000][3|22222|11][4444|3333][66|55555|4]...

Explanation of diagram:

  • The []'s enclose byte boundaries.
  • The |s represent separation between waveform values.
  • The numbers in the first row indicate the binary power.
  • The numbers in the second row indicate the corresponding waveform index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(waveform []byte) []int

Decode decodes a Telegram waveform into a waveform usable by Matrix.

func Encode

func Encode(waveform []int) []byte

Encode normalizes and encodes the input Matrix waveform into a Telegram waveform.

func NormalizeWaveform

func NormalizeWaveform(waveform []int) (normalized []byte)

NormalizeWaveform normalizes a waveform by bounding the values to the range [0, 32] which is required for the encoding to work.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL