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

package com.codename1.media.audio

A real-time and offline audio graph modelled on the W3C Web Audio API.

Sources (AudioBufferSourceNode, OscillatorNode, ConstantSourceNode) feed processing nodes (GainNode, DelayNode, BiquadFilterNode, IIRFilterNode, StereoPannerNode, ChannelSplitterNode, ChannelMergerNode) that end at the context’s destination. Node parameters are AudioParams with sample-accurate automation and can be modulated by other nodes.

ConvolverNode (reverb), DynamicsCompressorNode, WaveShaperNode (distortion) and AnalyserNode (spectrum and waveform for visualisers) complete the processing set.

PannerNode places a source in 3D around the context’s AudioListener, with the specification’s distance models and sound cones. Its PanningModel.HRTF mode renders binaurally for headphones from a structural head model (interaural delay, head shadow and pinna echoes), so it is the same portable code, with the same result, on every platform.

OfflineAudioContext renders to memory on every platform. AudioContext plays to the speaker where the platform has a real-time output; call AudioContext.isSupported() first. Names and behaviour follow the specification, so Web Audio material applies with Java naming: gain.gain.value = 0.5 becomes gain.getGain().setValue(0.5f).

The graph is rendered by portable code, so a graph sounds the same on every platform it runs on.

Types

class AnalyserNodeExposes the recent signal and its spectrum for visualisation, passing its input through unchanged: the Web Audio AnalyserNode.
class AudioBufferSourceNodePlays AudioData, the Web Audio AudioBufferSourceNode.
class AudioContextRenders an audio graph to the device’s speaker in real time, the Web Audio AudioContext.
enum AudioContextStateThe life cycle state of an audio context.
class AudioDataIn-memory PCM audio: one float array per channel, samples nominally in the range -1 to 1. This is the Web Audio AudioBuffer, named differently so it does not clash with the microphone capture class com.codename1.media.AudioBuffer.
class AudioDestinationNodeThe end of every audio graph: the speaker for an AudioContext, the rendered AudioData for an OfflineAudioContext.
class AudioListenerThe position and orientation of the listener every PannerNode of a context is heard from, the Web Audio AudioListener.
class AudioNodeA processing block of an audio graph, the Web Audio AudioNode.
interface AudioOutputPeerA platform audio output stream that pulls samples from an AudioRenderCallback.
class AudioParamA value of an AudioNode that can be scheduled ahead of time and modulated by other nodes, the Web Audio AudioParam.
class AudioParamDescriptorDeclares one AudioParam of an AudioProcessorNode, the Web Audio AudioParamDescriptor.
interface AudioProcessorCustom DSP in Java, the Codename One counterpart of the Web Audio AudioWorkletProcessor.
class AudioProcessorNodeRuns an AudioProcessor in the graph, the Web Audio AudioWorkletNode.
interface AudioRenderCallbackSupplies the samples an AudioOutputPeer plays.
class AudioScheduledSourceNodeA source node that is started and stopped at scheduled times, the Web Audio AudioScheduledSourceNode.
enum AutomationRateWhether an AudioParam is computed for every sample or once per render quantum.
class BaseAudioContextWhat AudioContext (real time, to the speaker) and OfflineAudioContext (as fast as possible, to memory) share: the clock, the destination and the factory methods for every node, the Web Audio BaseAudioContext.
class BiquadFilterNodeA second order filter, the Web Audio BiquadFilterNode: low and high pass, band pass, shelves, peaking, notch and all pass.
enum BiquadFilterTypeThe response of a BiquadFilterNode.
enum ChannelCountModeHow an AudioNode decides the number of channels it mixes its inputs to, matching the Web Audio ChannelCountMode enumeration.
enum ChannelInterpretationHow channels are up-mixed or down-mixed when a connection has a different number of channels than the input it feeds, matching the Web Audio ChannelInterpretation enumeration.
class ChannelMergerNodeMerges mono inputs into one output with a channel per input, the Web Audio ChannelMergerNode.
class ChannelSplitterNodeSplits the channels of its input into mono outputs, the Web Audio ChannelSplitterNode.
class ConstantSourceNodeA mono source whose output is getOffset(), the Web Audio ConstantSourceNode.
class ConvolverNodeConvolves its input with an impulse response, for reverb and cabinet or room simulation: the Web Audio ConvolverNode.
class DelayNodeDelays its input by getDelayTime(), the Web Audio DelayNode.
enum DistanceModelTypeHow a PannerNode attenuates a source with distance, using its refDistance, maxDistance and rolloffFactor.
class DynamicsCompressorNodeLowers the volume of loud passages so the mix stays clear of clipping: the Web Audio DynamicsCompressorNode.
class GainNodeMultiplies its input by getGain(), the Web Audio GainNode.
class IIRFilterNodeA general infinite impulse response filter with fixed coefficients, the Web Audio IIRFilterNode.
class MicrophoneSourceNodeLive captured audio as a graph source, the Codename One counterpart of the Web Audio MediaStreamAudioSourceNode for a microphone.
class OfflineAudioContextRenders an audio graph to memory as fast as the device can, the Web Audio OfflineAudioContext.
class OscillatorNodeA band-limited periodic waveform, the Web Audio OscillatorNode.
enum OscillatorTypeThe waveform an OscillatorNode generates.
enum OverSampleTypeHow much a WaveShaperNode oversamples while it applies its curve: the Web Audio "none", "2x" and "4x".
class PannerNodePositions a source in 3D space relative to the context’s AudioListener, the Web Audio PannerNode.
enum PanningModelHow a PannerNode places a source in the stereo output.
class PeriodicWaveA custom oscillator waveform given by its Fourier coefficients, the Web Audio PeriodicWave.
class StereoPannerNodePlaces mono or stereo input in the stereo field with an equal-power law, the Web Audio StereoPannerNode.
class WaveShaperNodeApplies a transfer curve to every sample, for distortion and saturation: the Web Audio WaveShaperNode.