sound

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: BSD-3-Clause Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	BigEndian    = iota // Samples are big endian byte order
	LittleEndian        // Samples are little endian byte order
)
View Source
const (
	Unknown   = iota // Not set
	SignedInt        // Samples are signed integers
	UnSignedInt
	Float
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Endian

type Endian int32

type SoundSampleType

type SoundSampleType int32

type Wave

type Wave struct {
	Buf *audio.IntBuffer
}

func (*Wave) Channels

func (snd *Wave) Channels() int

Channels returns the number of channels in the wav data or 0 is snd is nil

func (*Wave) GetFloatAtIdx

func (snd *Wave) GetFloatAtIdx(buf *audio.IntBuffer, idx int) float32

GetFloatAtIdx

func (*Wave) Load

func (snd *Wave) Load(fn string) error

Load loads the sound file and decodes it

func (*Wave) SampleRate

func (snd *Wave) SampleRate() int

SampleRate returns the sample rate of the sound or 0 is snd is nil

func (*Wave) SampleSize

func (snd *Wave) SampleSize() int

SampleSize returns the sample rate of the sound or 0 is snd is nil

func (*Wave) SampleType

func (snd *Wave) SampleType() SoundSampleType

todo: return to this SampleType

func (*Wave) SoundToTensor

func (snd *Wave) SoundToTensor(samples *etensor.Float32, channel int) bool

SoundToTensor converts sound data to floating point etensor with normalized -1..1 values (unless sound is stored as a float natively, in which case it is not guaranteed to be normalized) -- for use in signal processing routines -- can optionally select a specific channel (formats sound_data as a single-dimensional matrix of frames size), and -1 gets all available channels (formats sound_data as two-dimensional matrix with outer dimension as channels and inner dimension frames

func (*Wave) WriteWave

func (snd *Wave) WriteWave(fn string) error

WriteWave encodes the signal data and writes it to file using the sample rate and other values of the buf object

Jump to

Keyboard shortcuts

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