@@ -9,10 +9,11 @@ export abstract class AbstractParam<TypeName extends UnitName> {
9
9
* Schedules a parameter value change at the given time.
10
10
* @param value The value to set the signal.
11
11
* @param time The time when the change should occur.
12
+ * @offline 0.5 1
12
13
* @example
13
- * const osc = new Tone.Oscillator().toDestination().start();
14
- * // set the frequency to "G4" in exactly 1 second from now.
15
- * osc.frequency.setValueAtTime("G4", "+1" );
14
+ * const osc = new Tone.Oscillator(20 ).toDestination().start();
15
+ * // set the frequency to 40 at exactly 0.25 seconds
16
+ * osc.frequency.setValueAtTime(40, 0.25 );
16
17
*/
17
18
abstract setValueAtTime ( value : UnitMap [ TypeName ] , time : Time ) : this;
18
19
@@ -21,12 +22,14 @@ export abstract class AbstractParam<TypeName extends UnitName> {
21
22
* may invalidate the returned value.
22
23
* @param time When to get the value
23
24
* @example
24
- * const osc = new Tone.Oscillator().toDestination().start();
25
- * // set the frequency to "G4" in exactly 1 second from now.
26
- * osc.frequency.setValueAtTime("G4", "+1");
25
+ * const signal = new Tone.Signal().toDestination();
26
+ * // ramp up to '8' over 3 seconds
27
+ * signal.rampTo(8, 3);
28
+ * // ramp back down to '0' over 3 seconds
29
+ * signal.rampTo(0, 3, "+3");
27
30
* setInterval(() => {
28
31
* // check the value every 100 ms
29
- * osc.frequency .getValueAtTime(Tone.now());
32
+ * console.log(signal .getValueAtTime(Tone.now() ));
30
33
* }, 100);
31
34
*/
32
35
abstract getValueAtTime ( time : Time ) : UnitMap [ TypeName ] ;
@@ -49,12 +52,24 @@ export abstract class AbstractParam<TypeName extends UnitName> {
49
52
/**
50
53
* Schedules a linear continuous change in parameter value from the
51
54
* previous scheduled parameter value to the given value.
55
+ * @offline 0.5 1
56
+ * @example
57
+ * const signal = new Tone.Signal(0).toDestination();
58
+ * // the ramp is starts from the previously scheduled value
59
+ * signal.setValueAtTime(0, 0.1);
60
+ * signal.linearRampToValueAtTime(1, 0.4);
52
61
*/
53
62
abstract linearRampToValueAtTime ( value : UnitMap [ TypeName ] , time : Time ) : this;
54
63
55
64
/**
56
65
* Schedules an exponential continuous change in parameter value from
57
66
* the previous scheduled parameter value to the given value.
67
+ * @offline 0.5 1
68
+ * @example
69
+ * const signal = new Tone.Signal(0).toDestination();
70
+ * // the ramp is starts from the previously scheduled value
71
+ * signal.setValueAtTime(0, 0.1);
72
+ * signal.exponentialRampToValueAtTime(1, 0.4);
58
73
*/
59
74
abstract exponentialRampToValueAtTime ( value : UnitMap [ TypeName ] , time : Time ) : this;
60
75
@@ -85,12 +100,10 @@ export abstract class AbstractParam<TypeName extends UnitName> {
85
100
* value to ramp from it's current value
86
101
* @param startTime When the ramp should start.
87
102
* @returns {Param } this
103
+ * @offline 0.5 1
88
104
* @example
89
- * const delay = new Tone.FeedbackDelay(0.5, 0.98).toDestination();
90
- * // a short burst of noise through the feedback delay
91
- * const noise = new Tone.Noise().connect(delay).start().stop("+0.1");
92
- * // linearly ramp to the value 4 over 3 seconds.
93
- * delay.delayTime.linearRampTo(4, 3);
105
+ * const signal = new Tone.Signal(1).toDestination();
106
+ * signal.linearRampTo(0, 0.3, 0.1);
94
107
*/
95
108
abstract linearRampTo ( value : UnitMap [ TypeName ] , rampTime : Time , startTime ?: Time ) : this;
96
109
@@ -103,9 +116,10 @@ export abstract class AbstractParam<TypeName extends UnitName> {
103
116
* value to ramp from it's current value
104
117
* @param startTime When the ramp should start.
105
118
* @example
106
- * import { Oscillator } from "tone";
107
- * const osc = new Oscillator().toDestination().start();
108
- * osc.frequency.targetRampTo("C4", 4);
119
+ * @offline 0.5 1
120
+ * @example
121
+ * const signal = new Tone.Signal(1).toDestination();
122
+ * signal.targetRampTo(0, 0.3, 0.1);
109
123
*/
110
124
abstract targetRampTo ( value : UnitMap [ TypeName ] , rampTime : Time , startTime ?: Time ) : this;
111
125
@@ -141,18 +155,36 @@ export abstract class AbstractParam<TypeName extends UnitName> {
141
155
* @param startTime
142
156
* @param duration
143
157
* @param scaling If the values in the curve should be scaled by some value
158
+ * @offline 0.5 1
159
+ * @example
160
+ * const signal = new Tone.Signal(1).toDestination();
161
+ * signal.setValueCurveAtTime([1, 0.2, 0.8, 0.1, 0], 0.2, 0.3);
144
162
*/
145
163
abstract setValueCurveAtTime ( values : UnitMap [ TypeName ] [ ] , startTime : Time , duration : Time , scaling ?: number ) : this;
146
164
147
165
/**
148
166
* Cancels all scheduled parameter changes with times greater than or
149
167
* equal to startTime.
168
+ * @offline 0.5 1
169
+ * @example
170
+ * const signal = new Tone.Signal(0).toDestination();
171
+ * signal.setValueAtTime(0.1, 0.1);
172
+ * signal.setValueAtTime(0.2, 0.2);
173
+ * signal.setValueAtTime(0.3, 0.3);
174
+ * signal.setValueAtTime(0.4, 0.4);
175
+ * // cancels the last two scheduled changes
176
+ * signal.cancelScheduledValues(0.3);
150
177
*/
151
178
abstract cancelScheduledValues ( time : Time ) : this;
152
179
153
180
/**
154
181
* This is similar to [[cancelScheduledValues]] except
155
182
* it holds the automated value at time until the next automated event.
183
+ * @offline 0.5 1
184
+ * @example
185
+ * const signal = new Tone.Signal(0).toDestination();
186
+ * signal.linearRampTo(1, 0.5, 0);
187
+ * signal.cancelAndHoldAtTime(0.3);
156
188
*/
157
189
abstract cancelAndHoldAtTime ( time : Time ) : this;
158
190
0 commit comments