Documentation
¶
Index ¶
Constants ¶
const DownsampleRatio = 4
DownsampleRatio is the default down sample ratio (4)
const MaxFreq = 5000.0
MaxFreq is 5kHz
const SampleSize = 1024.0
SampleSize is the default sample size (1024)
const TableValueSize = 8
TableValueSize represents the TableValueSize when encoded in bytes
Variables ¶
This section is empty.
Functions ¶
func SongNameFromPath ¶
SongNameFromPath returns the song file name from the given path (removing the path and the extension)
Types ¶
type AnchorKey ¶
type AnchorKey struct { // Frequency of the anchor point for the given point's target zone AnchorFreq float64 // Frequency of the given point PointFreq float64 // Delta time between the anchor point and the given point DeltaT float64 }
AnchorKey represents a anchor key
func NewAnchorKey ¶
func NewAnchorKey(anchor, point ConstellationPoint) *AnchorKey
NewAnchorKey creates a new anchor key from the given anchor and the given point
func (*AnchorKey) Encode ¶
func (tk *AnchorKey) Encode() EncodedKey
Encode encodes the anchor key using: 9 bits for the “frequency of the anchor”: fa 9 bits for the ” frequency of the point”: fp 14 bits for the ”delta time between the anchor and the point”: dt The result is then dt | fa | fp XXX: this only works if frequencies are coded in 9 bits or less (if we used a 1024 samples FFT, it will be the case)
type ConstellationPoint ¶
ConstellationPoint represents a point in the constellation map (time + frequency)
func (ConstellationPoint) String ¶
func (cp ConstellationPoint) String() string
type TableValue ¶
type TableValue struct { // AnchorTimeMs is the time of the anchor in the related song in milliseconds AnchorTimeMs uint32 // SongID is an ID representing the related song SongID uint32 }
TableValue represents a table value
func NewTableValue ¶
func NewTableValue(song uint32, anchor ConstellationPoint) *TableValue
NewTableValue creates a new table value from the given song ID and anchor point
func ValuesFromBytes ¶
func ValuesFromBytes(b []byte) ([]TableValue, error)
ValuesFromBytes decodes a list of table values from the given byte array
func (*TableValue) Bytes ¶
func (tv *TableValue) Bytes() []byte
Bytes encodes the given table value in bytes
func (TableValue) String ¶
func (tv TableValue) String() string
String returns a string representation of a TableValue