-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathPulse.java
More file actions
54 lines (47 loc) · 1.46 KB
/
Pulse.java
File metadata and controls
54 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package processing.sound;
import com.jsyn.unitgen.PulseOscillator;
import processing.core.PApplet;
/**
* This is a simple Pulse oscillator.
* @webref Oscillators:Pulse
* @webBrief This is a simple Pulse oscillator.
**/
public class Pulse extends Oscillator<PulseOscillator> {
/**
* @param parent typically use "this"
*/
public Pulse(PApplet parent) {
super(parent, new PulseOscillator());
}
/**
* Changes the pulse width of the pulse oscillator. Allowed values are between 0.0 and 1.0.
*
* @webref Oscillators:Pulse
* @webBrief Changes the pulse width of the pulse oscillator.
* @param width
* The relative pulse width of the oscillator as a float value
* between 0.0 and 1.0 (exclusive)
**/
public void width(float width) {
this.oscillator.width.set(width);
}
/**
* Set multiple parameters at once
*
* @webref Oscillators:Pulse
* @param freq
* The frequency value of the oscillator in Hz.
* @param width
* The pulse width of the oscillator as a value between 0.0 and 1.0.
* @param amp
* The amplitude of the oscillator as a value between 0.0 and 1.0.
* @param add Offset the output of the oscillator by given value
* @param pos
* The panoramic position of the oscillator as a float from -1.0 to
* 1.0.
**/
public void set(float freq, float width, float amp, float add, float pos) {
this.width(width);
this.set(freq, amp, add, pos);
}
}