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.
-
ClassDescriptionExposes the recent signal and its spectrum for visualisation, passing its input through unchanged: the Web Audio
AnalyserNode.PlaysAudioData, the Web AudioAudioBufferSourceNode.Renders an audio graph to the device's speaker in real time, the Web AudioAudioContext.The life cycle state of an audio context.In-memory PCM audio: one float array per channel, samples nominally in the range -1 to 1.The end of every audio graph: the speaker for anAudioContext, the renderedAudioDatafor anOfflineAudioContext.The position and orientation of the listener everyPannerNodeof a context is heard from, the Web AudioAudioListener.A processing block of an audio graph, the Web AudioAudioNode.A platform audio output stream that pulls samples from anAudioRenderCallback.A value of anAudioNodethat can be scheduled ahead of time and modulated by other nodes, the Web AudioAudioParam.Custom DSP in Java, the Codename One counterpart of the Web AudioAudioWorkletProcessor.Runs anAudioProcessorin the graph, the Web AudioAudioWorkletNode.Supplies the samples anAudioOutputPeerplays.A source node that is started and stopped at scheduled times, the Web AudioAudioScheduledSourceNode.Whether anAudioParamis computed for every sample or once per render quantum.WhatAudioContext(real time, to the speaker) andOfflineAudioContext(as fast as possible, to memory) share: the clock, the destination and the factory methods for every node, the Web AudioBaseAudioContext.A second order filter, the Web AudioBiquadFilterNode: low and high pass, band pass, shelves, peaking, notch and all pass.The response of aBiquadFilterNode.How anAudioNodedecides the number of channels it mixes its inputs to, matching the Web AudioChannelCountModeenumeration.How channels are up-mixed or down-mixed when a connection has a different number of channels than the input it feeds, matching the Web AudioChannelInterpretationenumeration.Merges mono inputs into one output with a channel per input, the Web AudioChannelMergerNode.Splits the channels of its input into mono outputs, the Web AudioChannelSplitterNode.A mono source whose output isConstantSourceNode.getOffset(), the Web AudioConstantSourceNode.Convolves its input with an impulse response, for reverb and cabinet or room simulation: the Web AudioConvolverNode.Delays its input byDelayNode.getDelayTime(), the Web AudioDelayNode.How aPannerNodeattenuates a source with distance, using itsrefDistance,maxDistanceandrolloffFactor.Lowers the volume of loud passages so the mix stays clear of clipping: the Web AudioDynamicsCompressorNode.Multiplies its input byGainNode.getGain(), the Web AudioGainNode.A general infinite impulse response filter with fixed coefficients, the Web AudioIIRFilterNode.Live captured audio as a graph source, the Codename One counterpart of the Web AudioMediaStreamAudioSourceNodefor a microphone.Renders an audio graph to memory as fast as the device can, the Web AudioOfflineAudioContext.A band-limited periodic waveform, the Web AudioOscillatorNode.The waveform anOscillatorNodegenerates.How much aWaveShaperNodeoversamples while it applies its curve: the Web Audio"none","2x"and"4x".Positions a source in 3D space relative to the context'sAudioListener, the Web AudioPannerNode.How aPannerNodeplaces a source in the stereo output.A custom oscillator waveform given by its Fourier coefficients, the Web AudioPeriodicWave.Places mono or stereo input in the stereo field with an equal-power law, the Web AudioStereoPannerNode.Applies a transfer curve to every sample, for distortion and saturation: the Web AudioWaveShaperNode.