Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class OscillatorNode
- Object
- AudioNode
- AudioScheduledSourceNode
- 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);Methods
public AudioParam getFrequency() | The frequency in Hz, 440 by default; an audio rate parameter. |
public AudioParam getDetune() | A detune in cents applied on top of the frequency, 0 by default; an audio rate parameter. |
public OscillatorType getType() | The waveform. |
public void setType(OscillatorType type) | Selects a standard waveform. |
public void setPeriodicWave(PeriodicWave wave) | Plays a custom waveform; the type becomes CUSTOM. |
Inherited methods
From AudioScheduledSourceNode
start, start, stop, stop, setOnEnded
Method details
getFrequency
public AudioParam getFrequency()The frequency in Hz, 440 by default; an audio rate parameter.
Returns
the parameter
getDetune
public AudioParam getDetune()A detune in cents applied on top of the frequency, 0 by default; an
audio rate parameter.
Returns
the parameter
getType
public OscillatorType getType()The waveform.
Returns
the type,
CUSTOM after setPeriodicWave(PeriodicWave)setType
public void setType(OscillatorType type)Selects a standard waveform.
Parameters
typeOscillatorType- any type but
CUSTOM
Throws
IllegalArgumentException- for
CUSTOM; usesetPeriodicWave(PeriodicWave)
setPeriodicWave
public void setPeriodicWave(PeriodicWave wave)Plays a custom waveform; the type becomes
CUSTOM.Parameters
wavePeriodicWave- the waveform