audio

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AudioContextStateSuspended = AudioContextState("suspended")
	AudioContextStateRunning   = AudioContextState("running")
	AudioContextStateClosed    = AudioContextState("closed")
)
View Source
const (
	ChannelsModeMax        = ChannelsMode("max")
	ChannelsModeClampedMax = ChannelsMode("clamped-max")
	ChannelsModeExplicit   = ChannelsMode("explicit")
)
View Source
const (
	FilterTypeLowPass   = FilterType("lowpass")
	FilterTypeHighPass  = FilterType("highpass")
	FilterTypeBandPass  = FilterType("bandpass")
	FilterTypeLowShelf  = FilterType("lowshelf")
	FilterTypeHighShelf = FilterType("highshelf")
	FilterTypePeaking   = FilterType("peaking")
	FilterTypeNotch     = FilterType("notch")
	FilterTypeAllPass   = FilterType("allpass")
)
View Source
const (
	ShapeSine     = Shape("sine")
	ShapeSquare   = Shape("square")
	ShapeSawTooth = Shape("sawtooth")
	ShapeTriangle = Shape("triangle")
	ShapeCustom   = Shape("custom")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyserNode

type AnalyserNode struct {
	AudioNode
}

https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode

func (AnalyserNode) FFTSize

func (analyser AnalyserNode) FFTSize() int

FFTSize represents the window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize

func (AnalyserNode) FrequencyData

func (analyser AnalyserNode) FrequencyData() FrequencyDataBytes

func (AnalyserNode) SetFFTSize

func (analyser AnalyserNode) SetFFTSize(value int)

FFTSize represents the window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize

func (AnalyserNode) TimeDomain

func (analyser AnalyserNode) TimeDomain() TimeDomainBytes

type AtTime

type AtTime struct {
	// contains filtered or unexported fields
}

AtTime is a namespace of operations on AudioParam that are scheduled at specified time. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam#Methods

func (AtTime) Cancel

func (param AtTime) Cancel(values []float64, duration float64)

Cancel cancels all scheduled future changes to the AudioParam. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/cancelScheduledValues

func (AtTime) CancelAndHold

func (param AtTime) CancelAndHold()

CancelAndHold cancels all scheduled future changes to the AudioParam but holds its value at a given time until further changes are made using other methods. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/cancelAndHoldAtTime

func (AtTime) ExponentialRampTo

func (param AtTime) ExponentialRampTo(value float64)

ExponentialRampTo schedules a gradual exponential change in the value of the AudioParam. The change starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the `time` parameter. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/exponentialRampToValueAtTime

func (AtTime) LinearRampTo

func (param AtTime) LinearRampTo(value float64)

LinearRampTo schedules a gradual linear change in the value of the AudioParam. The change starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the `time` parameter. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/linearRampToValueAtTime

func (AtTime) Set

func (param AtTime) Set(value float64)

Set schedules an instant change to the AudioParam value at a precise time, as measured against AudioContext.CurrentTime. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueAtTime

func (AtTime) SetCurve

func (param AtTime) SetCurve(values []float64, duration float64)

SetCurve schedules the parameter's value to change following a curve defined by a list of values. The curve is a linear interpolation between the sequence of values defined in an array of floating-point values, which are scaled to fit into the given interval starting at `time` and a specific `duration`. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueCurveAtTime

func (AtTime) SetTarget

func (param AtTime) SetTarget(target, timeConstant float64)

SetTarget schedules the start of a gradual change to the AudioParam value. This is useful for decay or release portions of ADSR envelopes. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime

type AudioContext

type AudioContext struct {
	js.Value
}

AudioContext represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext https://developer.mozilla.org/en-US/docs/Web/API/AudioContext

func (AudioContext) Analyser

func (context AudioContext) Analyser() AnalyserNode

func (AudioContext) BiquadFilter

func (context AudioContext) BiquadFilter() BiquadFilterNode

func (AudioContext) CurrentTime

func (context AudioContext) CurrentTime() float64

Current time returns an ever-increasing hardware time in seconds used for scheduling. It starts at 0. https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/currentTime

func (AudioContext) Destination

func (context AudioContext) Destination() DestinationNode

Destination is the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers. https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/destination

func (AudioContext) Gain

func (context AudioContext) Gain() GainNode

Gain creates a GainNode, which can be used to control the overall volume of the audio graph. https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createGain https://developer.mozilla.org/en-US/docs/Web/API/GainNode

func (AudioContext) SampleRate

func (context AudioContext) SampleRate() int

SampleRate returns the sample rate (in samples per second) used by all nodes in this context. https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/sampleRate

func (AudioContext) State

func (context AudioContext) State() AudioContextState

type AudioContextState

type AudioContextState string

type AudioNode

type AudioNode struct {
	js.Value
}

https://developer.mozilla.org/en-US/docs/Web/API/AudioNode

func (AudioNode) Channels

func (node AudioNode) Channels() int

func (AudioNode) ChannelsInterpretation

func (node AudioNode) ChannelsInterpretation() ChannelsMode

func (AudioNode) ChannelsMode

func (node AudioNode) ChannelsMode() ChannelsMode

func (AudioNode) Connect

func (node AudioNode) Connect(destination AudioNode, inputIndex int, outputIndex int)

func (AudioNode) Context

func (node AudioNode) Context() AudioContext

Context returns the associated AudioContext, that is the object representing the processing graph the node is participating in. https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/context

func (AudioNode) Disconnect

func (node AudioNode) Disconnect(destination AudioNode)

func (AudioNode) DisconnectAll

func (node AudioNode) DisconnectAll()

func (AudioNode) Inputs

func (node AudioNode) Inputs() int

Inputs returns the number of inputs feeding the node. https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/numberOfInputs

func (AudioNode) Outputs

func (node AudioNode) Outputs() int

Outputs returns the number of outputs coming out of the node. https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/numberOfOutputs

type AudioParam

type AudioParam struct {
	// contains filtered or unexported fields
}

https://developer.mozilla.org/en-US/docs/Web/API/AudioParam

func (AudioParam) AtTime

func (param AudioParam) AtTime(time float64) AtTime

AtTime returns a namespace of operations on AudioParam that are scheduled at specified time. https://developer.mozilla.org/en-US/docs/Web/API/AudioParam#Methods

func (AudioParam) Default

func (param AudioParam) Default() float64

func (AudioParam) Get

func (param AudioParam) Get() float64

func (AudioParam) Max

func (param AudioParam) Max() float64

func (AudioParam) Min

func (param AudioParam) Min() float64

func (AudioParam) Set

func (param AudioParam) Set(value float64)

type ChannelsMode

type ChannelsMode string

type DestinationNode

type DestinationNode struct {
	AudioNode
}

func (DestinationNode) MaxChannels

func (node DestinationNode) MaxChannels() int

type FilterType

type FilterType string

type FrequencyDataBytes

type FrequencyDataBytes struct {
	Size int    // Size of the data array
	Data []byte // where to copy data from JS into Go
	// contains filtered or unexported fields
}

func (*FrequencyDataBytes) Update

func (freq *FrequencyDataBytes) Update()

Update reads the current frequency data into `Data` attribute. The frequency data is composed of integers on a scale from 0 to 255.

type GainNode

type GainNode struct {
	AudioNode
}

GainNode represents a change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. https://developer.mozilla.org/en-US/docs/Web/API/GainNode

func (GainNode) Gain

func (node GainNode) Gain() AudioParam

type MediaStream

type MediaStream struct {
	js.Value
}

func (MediaStream) JSValue added in v0.3.0

func (stream MediaStream) JSValue() js.Value

Casts audio.MediaStream to js.Value

type MediaStreamSourceNode

type MediaStreamSourceNode struct {
	AudioNode
}

https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamAudioSourceNode

func (MediaStreamSourceNode) Stream

func (node MediaStreamSourceNode) Stream() MediaStream

type OscillatorNode

type OscillatorNode struct {
	AudioNode
}

https://developer.mozilla.org/en-US/docs/Web/API/OscillatorNode

func (OscillatorNode) DeTune

func (node OscillatorNode) DeTune() AudioParam

func (OscillatorNode) Frequency

func (node OscillatorNode) Frequency() AudioParam

func (OscillatorNode) SetShape

func (node OscillatorNode) SetShape(shape Shape)

func (OscillatorNode) Shape

func (node OscillatorNode) Shape() Shape

Shape specifies the shape of waveform to play. https://developer.mozilla.org/en-US/docs/Web/API/OscillatorNode/type

type Shape

type Shape string

type TimeDomainBytes

type TimeDomainBytes struct {
	Size int    // Size of the data array
	Data []byte // where to copy data from JS into Go
	// contains filtered or unexported fields
}

func (*TimeDomainBytes) Update

func (domain *TimeDomainBytes) Update()

Update reads the current waveform or time-domain into `Data` attribute.

type Value

type Value struct {
	js.Value
}

Value is an extended js.Value with more types support

func (Value) Call

func (v Value) Call(method string, args ...any) Value

func (Value) Get

func (v Value) Get(property string) Value

func (Value) New

func (v Value) New(args ...any) Value

func (Value) OptionalString

func (v Value) OptionalString() string

OptionalString returns empty string if Value is null

func (Value) Strings

func (v Value) Strings() (items []string)

func (*Value) Values

func (v *Value) Values() (items []Value)

Jump to

Keyboard shortcuts

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