Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public abstract class AudioNode

  1. Object
  2. AudioNode

Known subtypesAnalyserNode, AudioDestinationNode, AudioProcessorNode, AudioScheduledSourceNode, BiquadFilterNode, ChannelMergerNode, ChannelSplitterNode, ConvolverNode, DelayNode, DynamicsCompressorNode, GainNode, IIRFilterNode, MicrophoneSourceNode, PannerNode, StereoPannerNode, WaveShaperNode

A processing block of an audio graph, the Web Audio AudioNode.

Nodes are created by a context (context.createGain() and so on) and wired with connect(AudioNode); audio is heard once a path reaches BaseAudioContext.getDestination(). Each input mixes everything connected to it to a channel count decided by getChannelCountMode(), getChannelCount() and getChannelInterpretation(), following the specification’s mixing rules.

A cycle in the graph must contain a DelayNode; a cycle without one is rendered as silence, as the specification requires. Every method may be called from any thread; changes reach the renderer at its next render quantum.

Methods

public BaseAudioContext getContext()The context that created this node.
public int getNumberOfInputs()The number of inputs.
public int getNumberOfOutputs()The number of outputs.
public int getChannelCount()The channel count inputs are mixed to, subject to the channel count mode.
public void setChannelCount(int count)Sets the channel count.
public ChannelCountMode getChannelCountMode()How the channel count of each input is decided.
public void setChannelCountMode(ChannelCountMode mode)Sets how the channel count of each input is decided.
public ChannelInterpretation getChannelInterpretation()How channels are up-mixed and down-mixed.
public void setChannelInterpretation(ChannelInterpretation interpretation)Sets how channels are up-mixed and down-mixed.
public AudioNode connect(AudioNode destination)Connects output 0 to input 0 of destination.
public AudioNode connect(AudioNode destination, int output, int input)Connects an output of this node to an input of destination.
public void connect(AudioParam param)Connects output 0 to an AudioParam, whose value then has this output, mixed down to mono, added to it.
public void connect(AudioParam param, int output)Connects an output to an AudioParam.
public void disconnect()Removes every outgoing connection.
public void disconnect(int output)Removes every connection from one output.
public void disconnect(AudioNode destination)Removes every connection to destination.
public void disconnect(AudioNode destination, int output, int input)Removes one connection.
public void disconnect(AudioParam param)Removes every connection to param.

Inherited methods

Method details

getContext

public BaseAudioContext getContext()
The context that created this node.

Returns

the context

getNumberOfInputs

public int getNumberOfInputs()
The number of inputs.

Returns

0 for a source node

getNumberOfOutputs

public int getNumberOfOutputs()
The number of outputs.

Returns

0 for the destination

getChannelCount

public int getChannelCount()
The channel count inputs are mixed to, subject to the channel count mode.

Returns

the channel count

setChannelCount

public void setChannelCount(int count)
Sets the channel count.

Parameters

count int
1 to 32, or less for nodes that restrict it

getChannelCountMode

public ChannelCountMode getChannelCountMode()
How the channel count of each input is decided.

Returns

the mode

setChannelCountMode

public void setChannelCountMode(ChannelCountMode mode)
Sets how the channel count of each input is decided.

Parameters

mode ChannelCountMode
the mode

getChannelInterpretation

public ChannelInterpretation getChannelInterpretation()
How channels are up-mixed and down-mixed.

Returns

the interpretation

setChannelInterpretation

public void setChannelInterpretation(ChannelInterpretation interpretation)
Sets how channels are up-mixed and down-mixed.

Parameters

interpretation ChannelInterpretation
the interpretation

connect

public AudioNode connect(AudioNode destination)
Connects output 0 to input 0 of destination.

Parameters

destination AudioNode
the node to feed

Returns

destination, so connections can be chained

connect

public AudioNode connect(AudioNode destination, int output, int input)
Connects an output of this node to an input of destination. Connecting the same pair twice has no further effect.

Parameters

destination AudioNode
the node to feed
output int
the output of this node
input int
the input of destination

Returns

destination

connect

public void connect(AudioParam param)
Connects output 0 to an AudioParam, whose value then has this output, mixed down to mono, added to it.

Parameters

param AudioParam
the parameter to modulate

connect

public void connect(AudioParam param, int output)
Connects an output to an AudioParam.

Parameters

param AudioParam
the parameter to modulate
output int
the output of this node

disconnect

public void disconnect()
Removes every outgoing connection.

disconnect

public void disconnect(int output)
Removes every connection from one output.

Parameters

output int
the output of this node

disconnect

public void disconnect(AudioNode destination)
Removes every connection to destination.

Parameters

destination AudioNode
the node to stop feeding

disconnect

public void disconnect(AudioNode destination, int output, int input)
Removes one connection.

Parameters

destination AudioNode
the node fed
output int
the output of this node
input int
the input of destination

disconnect

public void disconnect(AudioParam param)
Removes every connection to param.

Parameters

param AudioParam
the parameter to stop modulating