Class OscillatorNode
java.lang.Object
com.codename1.media.audio.AudioNode
com.codename1.media.audio.AudioScheduledSourceNode
com.codename1.media.audio.OscillatorNode
A band-limited periodic waveform, the Web Audio OscillatorNode. Mono.
OfflineAudioContext audio = new OfflineAudioContext(2, 44100, 44100);
OscillatorNode osc = audio.createOscillator();
osc.setType(OscillatorType.SAWTOOTH);
osc.getFrequency().setValue(220);
osc.connect(audio.getDestination());
osc.start();
osc.stop(audio.getCurrentTime() + 1);
-
Method Summary
Modifier and TypeMethodDescriptionA detune in cents applied on top of the frequency, 0 by default; an audio rate parameter.The frequency in Hz, 440 by default; an audio rate parameter.getType()The waveform.voidsetPeriodicWave(PeriodicWave wave) Plays a custom waveform; the type becomesCUSTOM.voidsetType(OscillatorType type) Selects a standard waveform.Methods inherited from class AudioScheduledSourceNode
setOnEnded, start, start, stop, stopMethods inherited from class AudioNode
connect, connect, connect, connect, disconnect, disconnect, disconnect, disconnect, disconnect, getChannelCount, getChannelCountMode, getChannelInterpretation, getContext, getNumberOfInputs, getNumberOfOutputs, setChannelCount, setChannelCountMode, setChannelInterpretation
-
Method Details
-
getFrequency
The frequency in Hz, 440 by default; an audio rate parameter.
Returns
the parameter
-
getDetune
A detune in cents applied on top of the frequency, 0 by default; an audio rate parameter.
Returns
the parameter
-
getType
-
setType
Selects a standard waveform.
Parameters
type: any type butCUSTOM
Throws
IllegalArgumentException: forCUSTOM; usesetPeriodicWave(PeriodicWave)
-
setPeriodicWave
Plays a custom waveform; the type becomes
CUSTOM.Parameters
wave: the waveform
-