tone 15.2.0 → 15.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tone/component/analysis/Follower.test.ts +38 -42
- package/Tone/component/channel/Channel.test.ts +3 -4
- package/Tone/component/channel/Merge.test.ts +5 -6
- package/Tone/component/channel/MidSideSplit.test.ts +21 -25
- package/Tone/component/channel/Mono.test.ts +18 -20
- package/Tone/component/channel/PanVol.test.ts +3 -4
- package/Tone/component/channel/Panner.test.ts +28 -32
- package/Tone/component/channel/Recorder.ts +1 -1
- package/Tone/component/channel/Volume.test.ts +9 -12
- package/Tone/component/dynamics/Gate.test.ts +10 -14
- package/Tone/component/envelope/AmplitudeEnvelope.test.ts +7 -9
- package/Tone/component/envelope/Envelope.test.ts +347 -384
- package/Tone/component/filter/BiquadFilter.test.ts +5 -6
- package/Tone/component/filter/Convolver.test.ts +6 -9
- package/Tone/component/filter/FeedbackCombFilter.test.ts +14 -16
- package/Tone/component/filter/Filter.test.ts +5 -6
- package/Tone/component/filter/LowpassCombFilter.test.ts +15 -17
- package/Tone/core/clock/Clock.test.ts +12 -15
- package/Tone/core/clock/TickSignal.test.ts +18 -21
- package/Tone/core/clock/Transport.test.ts +133 -162
- package/Tone/core/clock/TransportEvent.test.ts +3 -4
- package/Tone/core/clock/TransportRepeatEvent.test.ts +6 -6
- package/Tone/core/context/Context.test.ts +8 -10
- package/Tone/core/context/Context.ts +8 -4
- package/Tone/core/context/Destination.test.ts +3 -4
- package/Tone/core/context/Offline.test.ts +23 -41
- package/Tone/core/context/OfflineContext.test.ts +20 -22
- package/Tone/core/context/Param.test.ts +33 -40
- package/Tone/core/context/ToneAudioBuffer.test.ts +3 -10
- package/Tone/core/context/ToneAudioBuffers.test.ts +9 -13
- package/Tone/core/worklet/ToneAudioWorklet.ts +3 -1
- package/Tone/effect/AutoFilter.test.ts +10 -12
- package/Tone/effect/AutoPanner.test.ts +10 -12
- package/Tone/effect/Chorus.test.ts +10 -14
- package/Tone/effect/FrequencyShifter.test.ts +6 -7
- package/Tone/effect/Reverb.test.ts +12 -15
- package/Tone/effect/Tremolo.test.ts +10 -12
- package/Tone/event/Loop.test.ts +29 -36
- package/Tone/event/Part.test.ts +152 -180
- package/Tone/event/Pattern.test.ts +16 -20
- package/Tone/event/Sequence.test.ts +86 -101
- package/Tone/event/ToneEvent.test.ts +60 -70
- package/Tone/instrument/MonoSynth.test.ts +3 -4
- package/Tone/instrument/PolySynth.test.ts +62 -74
- package/Tone/instrument/Sampler.test.ts +39 -48
- package/Tone/instrument/Synth.test.ts +40 -47
- package/Tone/signal/AudioToGain.test.ts +4 -5
- package/Tone/signal/Signal.test.ts +120 -143
- package/Tone/signal/SyncedSignal.test.ts +108 -122
- package/Tone/signal/ToneConstantSource.test.ts +21 -25
- package/Tone/signal/WaveShaper.test.ts +5 -6
- package/Tone/source/Source.test.ts +42 -48
- package/Tone/source/buffer/GrainPlayer.test.ts +29 -35
- package/Tone/source/buffer/Player.test.ts +162 -191
- package/Tone/source/buffer/Players.test.ts +44 -50
- package/Tone/source/buffer/ToneBufferSource.test.ts +176 -211
- package/Tone/source/oscillator/LFO.test.ts +49 -61
- package/Tone/source/oscillator/Oscillator.test.ts +24 -28
- package/Tone/source/oscillator/PulseOscillator.test.ts +36 -40
- package/Tone/source/oscillator/ToneOscillatorNode.test.ts +25 -29
- package/Tone/version.ts +1 -1
- package/build/Tone.js +1 -1
- package/build/Tone.js.map +1 -1
- package/build/esm/component/channel/Recorder.js.map +1 -1
- package/build/esm/core/context/Context.js +6 -3
- package/build/esm/core/context/Context.js.map +1 -1
- package/build/esm/core/worklet/ToneAudioWorklet.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -143,8 +143,8 @@ describe("Signal", () => {
|
|
|
143
143
|
expect(buffer.getValueAtTime(1)).to.be.closeTo(0, 0.001);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
it("can disconnect from all the connected notes", () => {
|
|
147
|
-
|
|
146
|
+
it("can disconnect from all the connected notes", async () => {
|
|
147
|
+
await ConstantOutput(async (context) => {
|
|
148
148
|
const output0 = new Signal(1).toDestination();
|
|
149
149
|
const output1 = new Signal(1).toDestination();
|
|
150
150
|
const sig = new Signal(0).connect(output0);
|
|
@@ -156,8 +156,8 @@ describe("Signal", () => {
|
|
|
156
156
|
}, 0);
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
it("can disconnect from a specific node", () => {
|
|
160
|
-
|
|
159
|
+
it("can disconnect from a specific node", async () => {
|
|
160
|
+
await ConstantOutput(async (context) => {
|
|
161
161
|
const output = new Signal(1).toDestination();
|
|
162
162
|
const sig = new Signal(0).connect(output);
|
|
163
163
|
sig.disconnect(output);
|
|
@@ -166,8 +166,9 @@ describe("Signal", () => {
|
|
|
166
166
|
sig.linearRampToValueAtTime(0, 1);
|
|
167
167
|
}, 0);
|
|
168
168
|
});
|
|
169
|
+
|
|
169
170
|
it("can schedule multiple automations from a connected signal through a multiple nodes", async () => {
|
|
170
|
-
const buffer = await Offline(() => {
|
|
171
|
+
const buffer = await Offline(async () => {
|
|
171
172
|
const output = new Signal(0).toDestination();
|
|
172
173
|
const proxy = new Signal(0).connect(output);
|
|
173
174
|
const gain = new Gain(1).connect(proxy);
|
|
@@ -192,6 +193,7 @@ describe("Signal", () => {
|
|
|
192
193
|
sig.cancelScheduledValues(0);
|
|
193
194
|
}, 1);
|
|
194
195
|
});
|
|
196
|
+
|
|
195
197
|
it("can cancel and hold a linear automation curve", async () => {
|
|
196
198
|
const buffer = await Offline(() => {
|
|
197
199
|
const sig = new Signal(0).toDestination();
|
|
@@ -204,188 +206,164 @@ describe("Signal", () => {
|
|
|
204
206
|
expect(buffer.getValueAtTime(0.75)).to.be.closeTo(1, 0.1);
|
|
205
207
|
});
|
|
206
208
|
|
|
207
|
-
it("can cancel and hold an exponential automation curve", () => {
|
|
208
|
-
|
|
209
|
+
it("can cancel and hold an exponential automation curve", async () => {
|
|
210
|
+
const buffer = await Offline(() => {
|
|
209
211
|
const sig = new Signal(1).toDestination();
|
|
210
212
|
sig.exponentialRampTo(2, 1);
|
|
211
213
|
sig.cancelAndHoldAtTime(0.5);
|
|
212
|
-
}, 1)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
214
|
+
}, 1);
|
|
215
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(1, 0.1);
|
|
216
|
+
expect(buffer.getValueAtTime(0.25)).to.be.closeTo(1.2, 0.1);
|
|
217
|
+
expect(buffer.getValueAtTime(0.5)).to.be.closeTo(1.4, 0.1);
|
|
218
|
+
expect(buffer.getValueAtTime(0.75)).to.be.closeTo(1.4, 0.1);
|
|
218
219
|
});
|
|
219
220
|
|
|
220
|
-
it("can set a linear ramp from the current time", () => {
|
|
221
|
-
|
|
221
|
+
it("can set a linear ramp from the current time", async () => {
|
|
222
|
+
const buffer = await Offline(() => {
|
|
222
223
|
const sig = new Signal(0).toDestination();
|
|
223
224
|
sig.linearRampTo(2, 0.3);
|
|
224
|
-
}, 0.5)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
});
|
|
225
|
+
}, 0.5);
|
|
226
|
+
buffer.forEach((sample, time) => {
|
|
227
|
+
if (time > 0.3) {
|
|
228
|
+
expect(sample).to.be.closeTo(2, 0.02);
|
|
229
|
+
}
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
|
|
233
|
-
it("can set an linear ramp in the future", () => {
|
|
234
|
-
|
|
233
|
+
it("can set an linear ramp in the future", async () => {
|
|
234
|
+
const buffer = await Offline(() => {
|
|
235
235
|
const sig = new Signal(1).toDestination();
|
|
236
236
|
sig.linearRampTo(50, 0.3, 0.2);
|
|
237
|
-
}, 0.7)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
});
|
|
237
|
+
}, 0.7);
|
|
238
|
+
buffer.forEach((sample, time) => {
|
|
239
|
+
if (time >= 0.6) {
|
|
240
|
+
expect(sample).to.be.closeTo(50, 0.5);
|
|
241
|
+
} else if (time < 0.2) {
|
|
242
|
+
expect(sample).to.closeTo(1, 0.01);
|
|
243
|
+
}
|
|
245
244
|
});
|
|
246
245
|
});
|
|
247
246
|
|
|
248
|
-
it("can set a exponential approach ramp from the current time", () => {
|
|
249
|
-
|
|
247
|
+
it("can set a exponential approach ramp from the current time", async () => {
|
|
248
|
+
const buffer = await Offline(() => {
|
|
250
249
|
const sig = new Signal(0).toDestination();
|
|
251
250
|
sig.targetRampTo(1, 0.3);
|
|
252
|
-
}, 0.5)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
});
|
|
251
|
+
}, 0.5);
|
|
252
|
+
expect(buffer.getValueAtTime(0)).to.be.below(0.0001);
|
|
253
|
+
expect(buffer.getValueAtTime(0.3)).to.be.closeTo(1, 0.02);
|
|
256
254
|
});
|
|
257
255
|
|
|
258
|
-
it("can set an exponential approach ramp in the future", () => {
|
|
259
|
-
|
|
256
|
+
it("can set an exponential approach ramp in the future", async () => {
|
|
257
|
+
const buffer = await Offline(() => {
|
|
260
258
|
const sig = new Signal(1).toDestination();
|
|
261
259
|
sig.targetRampTo(50, 0.3, 0.2);
|
|
262
|
-
}, 0.7)
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
});
|
|
260
|
+
}, 0.7);
|
|
261
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(1, 0.0001);
|
|
262
|
+
expect(buffer.getValueAtTime(0.2)).to.be.closeTo(1, 0.0001);
|
|
263
|
+
expect(buffer.getValueAtTime(0.6)).to.be.closeTo(50, 0.5);
|
|
267
264
|
});
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
|
|
266
|
+
it("can set an exponential ramp from the current time", async () => {
|
|
267
|
+
const buffer = await Offline(() => {
|
|
270
268
|
const sig = new Signal(1).toDestination();
|
|
271
269
|
sig.exponentialRampTo(50, 0.4);
|
|
272
|
-
}, 0.6)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
270
|
+
}, 0.6);
|
|
271
|
+
buffer.forEach((sample, time) => {
|
|
272
|
+
if (time >= 0.4) {
|
|
273
|
+
expect(sample).to.be.closeTo(50, 0.5);
|
|
274
|
+
} else if (time < 0.39) {
|
|
275
|
+
expect(sample).to.be.lessThan(50);
|
|
276
|
+
}
|
|
280
277
|
});
|
|
281
278
|
});
|
|
282
279
|
|
|
283
|
-
it("can set an exponential ramp in the future", () => {
|
|
284
|
-
|
|
280
|
+
it("can set an exponential ramp in the future", async () => {
|
|
281
|
+
const buffer = await Offline(() => {
|
|
285
282
|
const sig = new Signal(1).toDestination();
|
|
286
283
|
sig.exponentialRampTo(50, 0.3, 0.2);
|
|
287
|
-
}, 0.8)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
});
|
|
284
|
+
}, 0.8);
|
|
285
|
+
buffer.forEach((sample, time) => {
|
|
286
|
+
if (time >= 0.6) {
|
|
287
|
+
expect(sample).to.be.closeTo(50, 0.5);
|
|
288
|
+
} else if (time < 0.2) {
|
|
289
|
+
expect(sample).to.equal(1);
|
|
290
|
+
}
|
|
295
291
|
});
|
|
296
292
|
});
|
|
297
293
|
|
|
298
|
-
it("rampTo ramps from the current value", () => {
|
|
299
|
-
|
|
294
|
+
it("rampTo ramps from the current value", async () => {
|
|
295
|
+
const buffer = await Offline(() => {
|
|
300
296
|
const sig = new Signal(3).toDestination();
|
|
301
297
|
sig.rampTo(0.2, 0.1);
|
|
302
|
-
}, 0.4)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
298
|
+
}, 0.4);
|
|
299
|
+
buffer.forEach((sample, time) => {
|
|
300
|
+
if (time >= 0.1) {
|
|
301
|
+
expect(sample).to.be.closeTo(0.2, 0.1);
|
|
302
|
+
} else {
|
|
303
|
+
expect(sample).to.be.greaterThan(0.2);
|
|
304
|
+
}
|
|
310
305
|
});
|
|
311
306
|
});
|
|
312
307
|
|
|
313
|
-
it("rampTo ramps from the current value at a specific time", () => {
|
|
314
|
-
|
|
308
|
+
it("rampTo ramps from the current value at a specific time", async () => {
|
|
309
|
+
const buffer = await Offline(() => {
|
|
315
310
|
const sig = new Signal(0).toDestination();
|
|
316
311
|
sig.rampTo(2, 0.1, 0.4);
|
|
317
|
-
}, 0.6)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
});
|
|
312
|
+
}, 0.6);
|
|
313
|
+
buffer.forEach((sample, time) => {
|
|
314
|
+
if (time < 0.4) {
|
|
315
|
+
expect(sample).to.be.closeTo(0, 0.1);
|
|
316
|
+
} else if (time > 0.5) {
|
|
317
|
+
expect(sample).to.be.closeTo(2, 0.1);
|
|
318
|
+
}
|
|
325
319
|
});
|
|
326
320
|
});
|
|
327
321
|
|
|
328
|
-
it("can set a value curve", () => {
|
|
329
|
-
|
|
322
|
+
it("can set a value curve", async () => {
|
|
323
|
+
const buffer = await Offline(() => {
|
|
330
324
|
const sig = new Signal(0).toDestination();
|
|
331
325
|
sig.setValueCurveAtTime([0, 1, 0.5, 0.2], 0, 1);
|
|
332
|
-
}, 1)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
expect(buffer.getValueAtTime(0.33)).to.be.closeTo(1, 0.02);
|
|
339
|
-
expect(buffer.getValueAtTime(0.66)).to.be.closeTo(0.5, 0.02);
|
|
340
|
-
expect(buffer.getValueAtTime(0.99)).to.be.closeTo(0.2, 0.02);
|
|
341
|
-
});
|
|
326
|
+
}, 1);
|
|
327
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.01);
|
|
328
|
+
expect(buffer.getValueAtTime(0.33 / 2)).to.be.closeTo(0.5, 0.01);
|
|
329
|
+
expect(buffer.getValueAtTime(0.33)).to.be.closeTo(1, 0.02);
|
|
330
|
+
expect(buffer.getValueAtTime(0.66)).to.be.closeTo(0.5, 0.02);
|
|
331
|
+
expect(buffer.getValueAtTime(0.99)).to.be.closeTo(0.2, 0.02);
|
|
342
332
|
});
|
|
343
333
|
|
|
344
|
-
it("can set a value curve in the future", () => {
|
|
345
|
-
|
|
334
|
+
it("can set a value curve in the future", async () => {
|
|
335
|
+
const buffer = await Offline(() => {
|
|
346
336
|
const sig = new Signal(0).toDestination();
|
|
347
337
|
sig.setValueCurveAtTime([0, 1, 0.5, 0.2], 0.5, 1);
|
|
348
|
-
}, 1.5)
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
);
|
|
362
|
-
expect(buffer.getValueAtTime(0.99 + 0.5)).to.be.closeTo(
|
|
363
|
-
0.2,
|
|
364
|
-
0.02
|
|
365
|
-
);
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
it("can set an exponential approach", () => {
|
|
370
|
-
return Offline(() => {
|
|
338
|
+
}, 1.5);
|
|
339
|
+
expect(buffer.getValueAtTime(0 + 0.5)).to.be.closeTo(0, 0.01);
|
|
340
|
+
expect(buffer.getValueAtTime(0.33 / 2 + 0.5)).to.be.closeTo(
|
|
341
|
+
0.5,
|
|
342
|
+
0.01
|
|
343
|
+
);
|
|
344
|
+
expect(buffer.getValueAtTime(0.33 + 0.5)).to.be.closeTo(1, 0.02);
|
|
345
|
+
expect(buffer.getValueAtTime(0.66 + 0.5)).to.be.closeTo(0.5, 0.02);
|
|
346
|
+
expect(buffer.getValueAtTime(0.99 + 0.5)).to.be.closeTo(0.2, 0.02);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it("can set an exponential approach", async () => {
|
|
350
|
+
const buffer = await Offline(() => {
|
|
371
351
|
const sig = new Signal(0).toDestination();
|
|
372
352
|
sig.exponentialApproachValueAtTime(2, 0.1, 0.5);
|
|
373
|
-
}, 1)
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
});
|
|
353
|
+
}, 1);
|
|
354
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.01);
|
|
355
|
+
expect(buffer.getValueAtTime(0.1)).to.be.closeTo(0, 0.01);
|
|
356
|
+
expect(buffer.getValueAtTime(0.4)).to.be.closeTo(1.9, 0.1);
|
|
357
|
+
expect(buffer.getValueAtTime(0.6)).to.be.closeTo(2, 0.01);
|
|
379
358
|
});
|
|
380
359
|
|
|
381
|
-
it("can set a target at time", () => {
|
|
382
|
-
|
|
360
|
+
it("can set a target at time", async () => {
|
|
361
|
+
const buffer = await Offline(() => {
|
|
383
362
|
const sig = new Signal(0).toDestination();
|
|
384
363
|
sig.setTargetAtTime(2, 0.1, 0.1);
|
|
385
|
-
}, 1)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
});
|
|
364
|
+
}, 1);
|
|
365
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.01);
|
|
366
|
+
expect(buffer.getValueAtTime(0.6)).to.be.closeTo(2, 0.1);
|
|
389
367
|
});
|
|
390
368
|
});
|
|
391
369
|
|
|
@@ -507,20 +485,19 @@ describe("Signal", () => {
|
|
|
507
485
|
}, 0);
|
|
508
486
|
});
|
|
509
487
|
|
|
510
|
-
it("can ramp along with the bpm", () => {
|
|
511
|
-
|
|
488
|
+
it("can ramp along with the bpm", async () => {
|
|
489
|
+
const buffer = await Offline(({ transport }) => {
|
|
512
490
|
transport.bpm.value = 120;
|
|
513
491
|
const sig = new Signal(2).toDestination();
|
|
514
492
|
transport.syncSignal(sig);
|
|
515
493
|
transport.bpm.rampTo(240, 0.5);
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
});
|
|
494
|
+
});
|
|
495
|
+
buffer.forEach((sample, time) => {
|
|
496
|
+
if (time >= 0.5) {
|
|
497
|
+
expect(sample).to.be.closeTo(4, 0.04);
|
|
498
|
+
} else if (time < 0.4) {
|
|
499
|
+
expect(sample).to.be.within(1.95, 3);
|
|
500
|
+
}
|
|
524
501
|
});
|
|
525
502
|
});
|
|
526
503
|
|