libaural2

package
v0.0.0-...-e9349c8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package libaural2 provides libs share betwene edge, server and browser.

Index

Constants

View Source
const AudioClipLen int = SamplePerClip * 2

AudioClipLen is the number of bytes in one audio clip

View Source
const BatchSize int = 7

BatchSize is the size of the one batch

View Source
const Duration int = 10

Duration of audio clip in seconds

View Source
const InputSize int = 13

InputSize is the length of the input vector, currently one MFCC

View Source
const SamplePerClip int = SampleRate * Duration

SamplePerClip is the number of samples in each clip

View Source
const SampleRate int = 16000

SampleRate of audio

View Source
const SeqLen int = 100

SeqLen is the length of sequences to be feed to the LSTM for training.

View Source
const StrideWidth int = 512

StrideWidth is the number of samples in one stride

View Source
const StridesPerClip int = SamplePerClip / StrideWidth

StridesPerClip is the number of strides per clip

Variables

This section is empty.

Functions

func GenFakeInput

func GenFakeInput(cmds [StridesPerClip]int32) (fakeMFCCs [][]float32)

GenFakeInput produces fake a mfcc list exactly matching the given cmdIdArray

Types

type AudioClip

type AudioClip [AudioClipLen]byte

AudioClip stores a `Duration` second clip of int16 raw audio

func (*AudioClip) ID

func (rawBytes *AudioClip) ID() ClipID

ID computes the hash of the audio clip

type ClipID

type ClipID [32]byte

ClipID is the hash of a clip of raw audio

func (ClipID) FSsafeString

func (hash ClipID) FSsafeString() string

FSsafeString returns an encoding of the ClipID safe for filesystems and URLs.

func (ClipID) String

func (hash ClipID) String() string

type Input

type Input [InputSize]float32

Input is the one input to the LSTM

type InputSet

type InputSet [StridesPerClip]Input

InputSet is the set of inputs for one clip.

type Label

type Label struct {
	State State
	Start float64 // the duration since the start of the clip.
	End   float64
}

Label is one period of time.

type LabelSet

type LabelSet struct {
	VocabName VocabName
	ID        ClipID
	Labels    []Label
}

LabelSet is the set of labels for one Clip

func DeserializeLabelSet

func DeserializeLabelSet(serialized []byte) (labelSet LabelSet, err error)

DeserializeLabelSet converts a []byte back into a LabelSet.

func GenFakeLabelSet

func GenFakeLabelSet() (output LabelSet)

GenFakeLabelSet creates a fake LabelSet for testing.

func (*LabelSet) IsGood

func (labels *LabelSet) IsGood() bool

IsGood returns true iff the labelsSet contains no overlaps or other bad things. Executes in O(n2) time.

func (*LabelSet) Serialize

func (labels *LabelSet) Serialize() (serialized []byte, err error)

Serialize converts a LabelSet to []byte

func (*LabelSet) ToStateArray

func (labels *LabelSet) ToStateArray() (stateArray [StridesPerClip]State)

ToStateArray converts the labelSet to a slice of States

func (*LabelSet) ToStateIDArray

func (labels *LabelSet) ToStateIDArray() (stateArray [StridesPerClip]int32)

ToStateIDArray converts the labelSet to a slice of State IDs

type Output

type Output []float32

Output is one output, the softmax array of States.

type OutputSet

type OutputSet [StridesPerClip]Output

OutputSet is the set of outputs for one clip.

func (*OutputSet) Serialize

func (outputSet *OutputSet) Serialize() (serialized []byte)

Serialize converts an outputSet to a []bytes

type State

type State int

State is one exclusive thing the NN can output

const (
	Nil State = iota
	Unknown
	Foo
	Bar
	Baz
	Yes
	No
)

Just for testing

func (State) Hue

func (state State) Hue() (hue float64)

Hue returns the hue as a float64

func (State) RGBA

func (state State) RGBA() (uint32, uint32, uint32, uint32)

RGBA implements color.Color

type StateList

type StateList [StridesPerClip]State

StateList is a list of States

type VocabName

type VocabName string

VocabName is the name of a vocabulary

type Vocabulary

type Vocabulary struct {
	Name       VocabName
	Size       int
	Names      map[State]string
	Hue        map[State]float64
	KeyMapping map[string]State
}

Vocabulary is one exclusive list of words

func (Vocabulary) Color

func (voc Vocabulary) Color(state State) (c color.Color)

Color turns a cmd into something that implements the color.Color interface

Jump to

Keyboard shortcuts

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