AudioBufferSourceNode class
The interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. This interface is especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. To play sounds which require accurate timing but must be streamed from the network or played from disk, use a AudioWorkletNode to implement its playback.
EventTarget
AudioNode
AudioScheduledSourceNode
AudioBufferSourceNode
An has no inputs and exactly one output, which has the same
number of channels as the AudioBuffer indicated by its buffer
property. If there's no buffer set—that is, if buffer is
null
—the output contains a single channel of silence (every
sample is 0).
An can only be played once; after each call to start()
, you
have to create a new node if you want to play the same sound
again. Fortunately, these nodes are very inexpensive to create,
and the actual AudioBuffers can be reused for multiple plays of
the sound. Indeed, you can use these nodes in a "fire and forget"
manner: create the node, call start()
to begin playing the
sound, and don't even bother to hold a reference to it. It will
automatically be garbage-collected at an appropriate time, which
won't be until sometime after the sound has finished playing.
Multiple calls to stop()
are allowed. The most recent call
replaces the previous one, if the has not already reached the end
of the buffer.
Number of inputs
0
Number of outputs
1
Channel count defined by the associated AudioBuffer
- Implemented types
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- AudioBufferSourceNode(BaseAudioContext context, [AudioBufferSourceOptions? options])
-
factory
Properties
- buffer ↔ AudioBuffer?
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
getter/setter pair - channelCount ↔ int
-
Available on AudioNode, provided by the PropsAudioNode extension
getter/setter pair - channelCountMode ↔ ChannelCountMode
-
Available on AudioNode, provided by the PropsAudioNode extension
getter/setter pair - channelInterpretation ↔ ChannelInterpretation
-
Available on AudioNode, provided by the PropsAudioNode extension
getter/setter pair - context → BaseAudioContext
-
Available on AudioNode, provided by the PropsAudioNode extension
no setter - detune → AudioParam
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- loop ↔ bool
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
getter/setter pair - loopEnd ↔ double
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
getter/setter pair - loopStart ↔ double
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
getter/setter pair - numberOfInputs → int
-
Available on AudioNode, provided by the PropsAudioNode extension
no setter - numberOfOutputs → int
-
Available on AudioNode, provided by the PropsAudioNode extension
no setter -
onended
↔ EventHandlerNonNull<
Event> ? -
Available on AudioScheduledSourceNode, provided by the PropsAudioScheduledSourceNode extension
getter/setter pair - playbackRate → AudioParam
-
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addEventListener(
String type, EventListener? callback, [dynamic options]) → void -
Available on EventTarget, provided by the PropsEventTarget extension
-
connect(
AudioNode destinationNode, [int? output = 0, int? input = 0]) → AudioNode -
Available on AudioNode, provided by the PropsAudioNode extension
-
disconnect(
[AudioNode? destinationNode, int? output, int? input]) → void -
Available on AudioNode, provided by the PropsAudioNode extension
-
dispatchEvent(
Event event) → bool -
Available on EventTarget, provided by the PropsEventTarget extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEventListener(
String type, EventListener? callback, [dynamic options]) → void -
Available on EventTarget, provided by the PropsEventTarget extension
-
start(
[double? when = 0, double? offset, double? duration]) → void -
Available on AudioBufferSourceNode, provided by the PropsAudioBufferSourceNode extension
-
start(
[double? when = 0]) → void -
Available on AudioScheduledSourceNode, provided by the PropsAudioScheduledSourceNode extension
-
stop(
[double? when = 0]) → void -
Available on AudioScheduledSourceNode, provided by the PropsAudioScheduledSourceNode extension
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited