-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Josh Stovall edited this page Dec 21, 2020
·
1 revision
Welcome to the synth.js wiki!
create an oscillator
var oscillator = new Oscillator({
frequency: 440,
gain: 0.5,
});
Oscillator
attribute | type | options | description |
---|---|---|---|
type |
string |
sine square sawtooth triangle
|
shape of waveform |
frequency |
float | 120 |
set the frequency (in hertz) |
gain |
float |
0 to 1
|
set gain (volume) |
set the frequency
// create an oscillator at 440 Hz
var osc = new Oscillator({
frequency: 440,
});
// change frequency to 200 Hz
osc.setFrequency(200);
returns the current frequency
// create an oscillator at 440 Hz
var osc = new Oscillator({ frequency: 440, });
// change frequency to 200 Hz
osc.getFrequency();
// ==> 440
set or get frequency
if blank, it will return the current frequency
osc.hz();
// 440
or pass a value to set the frequency
osc.hz(200);
smoothly ramp a value
new Ramp({
at: osc,
gain: 0.1,
frequency: 600,
duration: 2000
});
Name | Type | Options | Default | Description |
---|---|---|---|---|
type |
string |
absolue relative
|
0 |
|
at |
object or array
|
object to apply the ramp | ||
repeat |
int | 0 |
number of times to repeat | |
yoyo |
bool | false |
repeat animation yoyo style | |
delay |
int | 0 |
on-set delay (ms) | |
ease |
string |
back bounce circ cubic elastic exponential linear quad quart quint sine
|
linear |
ease type |
direction |
string |
in out inout
|
intout |
ease direction |
gain |
float | null |
end gain | |
frequency |
float | null |
end frequency |