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.
Files changed (69) hide show
  1. package/Tone/component/analysis/Follower.test.ts +38 -42
  2. package/Tone/component/channel/Channel.test.ts +3 -4
  3. package/Tone/component/channel/Merge.test.ts +5 -6
  4. package/Tone/component/channel/MidSideSplit.test.ts +21 -25
  5. package/Tone/component/channel/Mono.test.ts +18 -20
  6. package/Tone/component/channel/PanVol.test.ts +3 -4
  7. package/Tone/component/channel/Panner.test.ts +28 -32
  8. package/Tone/component/channel/Recorder.ts +1 -1
  9. package/Tone/component/channel/Volume.test.ts +9 -12
  10. package/Tone/component/dynamics/Gate.test.ts +10 -14
  11. package/Tone/component/envelope/AmplitudeEnvelope.test.ts +7 -9
  12. package/Tone/component/envelope/Envelope.test.ts +347 -384
  13. package/Tone/component/filter/BiquadFilter.test.ts +5 -6
  14. package/Tone/component/filter/Convolver.test.ts +6 -9
  15. package/Tone/component/filter/FeedbackCombFilter.test.ts +14 -16
  16. package/Tone/component/filter/Filter.test.ts +5 -6
  17. package/Tone/component/filter/LowpassCombFilter.test.ts +15 -17
  18. package/Tone/core/clock/Clock.test.ts +12 -15
  19. package/Tone/core/clock/TickSignal.test.ts +18 -21
  20. package/Tone/core/clock/Transport.test.ts +133 -162
  21. package/Tone/core/clock/TransportEvent.test.ts +3 -4
  22. package/Tone/core/clock/TransportRepeatEvent.test.ts +6 -6
  23. package/Tone/core/context/Context.test.ts +8 -10
  24. package/Tone/core/context/Context.ts +8 -4
  25. package/Tone/core/context/Destination.test.ts +3 -4
  26. package/Tone/core/context/Offline.test.ts +23 -41
  27. package/Tone/core/context/OfflineContext.test.ts +20 -22
  28. package/Tone/core/context/Param.test.ts +33 -40
  29. package/Tone/core/context/ToneAudioBuffer.test.ts +3 -10
  30. package/Tone/core/context/ToneAudioBuffers.test.ts +9 -13
  31. package/Tone/core/worklet/ToneAudioWorklet.ts +3 -1
  32. package/Tone/effect/AutoFilter.test.ts +10 -12
  33. package/Tone/effect/AutoPanner.test.ts +10 -12
  34. package/Tone/effect/Chorus.test.ts +10 -14
  35. package/Tone/effect/FrequencyShifter.test.ts +6 -7
  36. package/Tone/effect/Reverb.test.ts +12 -15
  37. package/Tone/effect/Tremolo.test.ts +10 -12
  38. package/Tone/event/Loop.test.ts +29 -36
  39. package/Tone/event/Part.test.ts +152 -180
  40. package/Tone/event/Pattern.test.ts +16 -20
  41. package/Tone/event/Sequence.test.ts +86 -101
  42. package/Tone/event/ToneEvent.test.ts +60 -70
  43. package/Tone/instrument/MonoSynth.test.ts +3 -4
  44. package/Tone/instrument/PolySynth.test.ts +62 -74
  45. package/Tone/instrument/Sampler.test.ts +39 -48
  46. package/Tone/instrument/Synth.test.ts +40 -47
  47. package/Tone/signal/AudioToGain.test.ts +4 -5
  48. package/Tone/signal/Signal.test.ts +120 -143
  49. package/Tone/signal/SyncedSignal.test.ts +108 -122
  50. package/Tone/signal/ToneConstantSource.test.ts +21 -25
  51. package/Tone/signal/WaveShaper.test.ts +5 -6
  52. package/Tone/source/Source.test.ts +42 -48
  53. package/Tone/source/buffer/GrainPlayer.test.ts +29 -35
  54. package/Tone/source/buffer/Player.test.ts +162 -191
  55. package/Tone/source/buffer/Players.test.ts +44 -50
  56. package/Tone/source/buffer/ToneBufferSource.test.ts +176 -211
  57. package/Tone/source/oscillator/LFO.test.ts +49 -61
  58. package/Tone/source/oscillator/Oscillator.test.ts +24 -28
  59. package/Tone/source/oscillator/PulseOscillator.test.ts +36 -40
  60. package/Tone/source/oscillator/ToneOscillatorNode.test.ts +25 -29
  61. package/Tone/version.ts +1 -1
  62. package/build/Tone.js +1 -1
  63. package/build/Tone.js.map +1 -1
  64. package/build/esm/component/channel/Recorder.js.map +1 -1
  65. package/build/esm/core/context/Context.js +6 -3
  66. package/build/esm/core/context/Context.js.map +1 -1
  67. package/build/esm/core/worklet/ToneAudioWorklet.js.map +1 -1
  68. package/build/esm/version.js +1 -1
  69. package/package.json +1 -1
@@ -27,21 +27,19 @@ describe("Envelope", () => {
27
27
  env.dispose();
28
28
  });
29
29
 
30
- it("passes no signal before being triggered", () => {
31
- return Offline(() => {
30
+ it("passes no signal before being triggered", async () => {
31
+ const buffer = await Offline(() => {
32
32
  new Envelope().toDestination();
33
- }).then((buffer) => {
34
- expect(buffer.isSilent()).to.equal(true);
35
33
  });
34
+ expect(buffer.isSilent()).to.equal(true);
36
35
  });
37
36
 
38
- it("passes signal once triggered", () => {
39
- return Offline(() => {
37
+ it("passes signal once triggered", async () => {
38
+ const buffer = await Offline(() => {
40
39
  const env = new Envelope().toDestination();
41
40
  env.triggerAttack(0.05);
42
- }, 0.1).then((buffer) => {
43
- expect(buffer.getTimeOfFirstSound()).to.be.closeTo(0.05, 0.001);
44
- });
41
+ }, 0.1);
42
+ expect(buffer.getTimeOfFirstSound()).to.be.closeTo(0.05, 0.001);
45
43
  });
46
44
 
47
45
  it("can take parameters as both an object and as arguments", () => {
@@ -138,21 +136,20 @@ describe("Envelope", () => {
138
136
  env2.dispose();
139
137
  });
140
138
 
141
- it("can set release to exponential or linear", () => {
142
- return Offline(() => {
139
+ it("can set release to exponential or linear", async () => {
140
+ const buffer = await Offline(() => {
143
141
  const env = new Envelope({
144
142
  release: 0,
145
143
  });
146
144
  env.toDestination();
147
145
  env.triggerAttackRelease(0.4, 0);
148
- }, 0.7).then((buffer) => {
149
- expect(buffer.getValueAtTime(0.3)).to.be.above(0);
150
- expect(buffer.getValueAtTime(0.401)).to.equal(0);
151
- });
146
+ }, 0.7);
147
+ expect(buffer.getValueAtTime(0.3)).to.be.above(0);
148
+ expect(buffer.getValueAtTime(0.401)).to.equal(0);
152
149
  });
153
150
 
154
- it("schedule a release at the moment when the attack portion is done", () => {
155
- return Offline(() => {
151
+ it("schedule a release at the moment when the attack portion is done", async () => {
152
+ const buffer = await Offline(() => {
156
153
  const env = new Envelope({
157
154
  attack: 0.5,
158
155
  decay: 0.0,
@@ -160,24 +157,23 @@ describe("Envelope", () => {
160
157
  release: 0.5,
161
158
  }).toDestination();
162
159
  env.triggerAttackRelease(0.5);
163
- }, 0.7).then((buffer) => {
164
- // make sure that it's got the rising edge
165
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(0.2, 0.01);
166
- expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.4, 0.01);
167
- expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.6, 0.01);
168
- expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.8, 0.01);
169
- expect(buffer.getValueAtTime(0.5)).to.be.be.closeTo(1, 0.001);
170
- });
160
+ }, 0.7);
161
+ // make sure that it's got the rising edge
162
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(0.2, 0.01);
163
+ expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.4, 0.01);
164
+ expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.6, 0.01);
165
+ expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.8, 0.01);
166
+ expect(buffer.getValueAtTime(0.5)).to.be.be.closeTo(1, 0.001);
171
167
  });
172
168
 
173
- it("correctly schedules an exponential attack", () => {
169
+ it("correctly schedules an exponential attack", async () => {
174
170
  const e = {
175
171
  attack: 0.01,
176
172
  decay: 0.4,
177
173
  release: 0.1,
178
174
  sustain: 0.5,
179
175
  };
180
- return Offline(() => {
176
+ const buffer = await Offline(() => {
181
177
  const env = new Envelope(
182
178
  e.attack,
183
179
  e.decay,
@@ -187,35 +183,34 @@ describe("Envelope", () => {
187
183
  env.attackCurve = "exponential";
188
184
  env.toDestination();
189
185
  env.triggerAttack(0);
190
- }, 0.7).then((buffer) => {
191
- buffer.forEachBetween(
192
- (sample) => {
193
- expect(sample).to.be.within(0, 1);
194
- },
195
- 0,
196
- e.attack
197
- );
198
- buffer.forEachBetween(
199
- (sample) => {
200
- expect(sample).to.be.within(e.sustain - 0.001, 1);
201
- },
202
- e.attack,
203
- e.attack + e.decay
204
- );
205
- buffer.forEachBetween((sample) => {
206
- expect(sample).to.be.closeTo(e.sustain, 0.01);
207
- }, e.attack + e.decay);
208
- });
209
- });
210
-
211
- it("correctly schedules a linear release", () => {
186
+ }, 0.7);
187
+ buffer.forEachBetween(
188
+ (sample) => {
189
+ expect(sample).to.be.within(0, 1);
190
+ },
191
+ 0,
192
+ e.attack
193
+ );
194
+ buffer.forEachBetween(
195
+ (sample) => {
196
+ expect(sample).to.be.within(e.sustain - 0.001, 1);
197
+ },
198
+ e.attack,
199
+ e.attack + e.decay
200
+ );
201
+ buffer.forEachBetween((sample) => {
202
+ expect(sample).to.be.closeTo(e.sustain, 0.01);
203
+ }, e.attack + e.decay);
204
+ });
205
+
206
+ it("correctly schedules a linear release", async () => {
212
207
  const e = {
213
208
  attack: 0.01,
214
209
  decay: 0.4,
215
210
  release: 0.1,
216
211
  sustain: 0.5,
217
212
  };
218
- return Offline(() => {
213
+ const buffer = await Offline(() => {
219
214
  const env = new Envelope(
220
215
  e.attack,
221
216
  e.decay,
@@ -225,26 +220,25 @@ describe("Envelope", () => {
225
220
  env.attackCurve = "exponential";
226
221
  env.toDestination();
227
222
  env.triggerAttack(0);
228
- }, 0.7).then((buffer) => {
229
- buffer.forEachBetween(
230
- (sample, time) => {
231
- const target = 1 - (time - 0.2) * 10;
232
- expect(sample).to.be.closeTo(target, 0.01);
233
- },
234
- 0.2,
235
- 0.2
236
- );
237
- });
238
- });
239
-
240
- it("correctly schedules a linear decay", () => {
223
+ }, 0.7);
224
+ buffer.forEachBetween(
225
+ (sample, time) => {
226
+ const target = 1 - (time - 0.2) * 10;
227
+ expect(sample).to.be.closeTo(target, 0.01);
228
+ },
229
+ 0.2,
230
+ 0.2
231
+ );
232
+ });
233
+
234
+ it("correctly schedules a linear decay", async () => {
241
235
  const e = {
242
236
  attack: 0.1,
243
237
  decay: 0.5,
244
238
  release: 0.1,
245
239
  sustain: 0,
246
240
  };
247
- return Offline(() => {
241
+ const buffer = await Offline(() => {
248
242
  const env = new Envelope(
249
243
  e.attack,
250
244
  e.decay,
@@ -254,25 +248,24 @@ describe("Envelope", () => {
254
248
  env.decayCurve = "linear";
255
249
  env.toDestination();
256
250
  env.triggerAttack(0);
257
- }, 0.7).then((buffer) => {
258
- expect(buffer.getValueAtTime(0.05)).to.be.closeTo(0.5, 0.01);
259
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
260
- expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.8, 0.01);
261
- expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.6, 0.01);
262
- expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.4, 0.01);
263
- expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.2, 0.01);
264
- expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0, 0.01);
265
- });
251
+ }, 0.7);
252
+ expect(buffer.getValueAtTime(0.05)).to.be.closeTo(0.5, 0.01);
253
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
254
+ expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.8, 0.01);
255
+ expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.6, 0.01);
256
+ expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.4, 0.01);
257
+ expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.2, 0.01);
258
+ expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0, 0.01);
266
259
  });
267
260
 
268
- it("correctly schedules an exponential decay", () => {
261
+ it("correctly schedules an exponential decay", async () => {
269
262
  const e = {
270
263
  attack: 0.1,
271
264
  decay: 0.5,
272
265
  release: 0.1,
273
266
  sustain: 0,
274
267
  };
275
- return Offline(() => {
268
+ const buffer = await Offline(() => {
276
269
  const env = new Envelope(
277
270
  e.attack,
278
271
  e.decay,
@@ -282,24 +275,23 @@ describe("Envelope", () => {
282
275
  env.decayCurve = "exponential";
283
276
  env.toDestination();
284
277
  env.triggerAttack(0);
285
- }, 0.7).then((buffer) => {
286
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
287
- expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.27, 0.01);
288
- expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.07, 0.01);
289
- expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.02, 0.01);
290
- expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.005, 0.01);
291
- expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0, 0.01);
292
- });
278
+ }, 0.7);
279
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
280
+ expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.27, 0.01);
281
+ expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.07, 0.01);
282
+ expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.02, 0.01);
283
+ expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.005, 0.01);
284
+ expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0, 0.01);
293
285
  });
294
286
 
295
- it("can schedule a very short attack", () => {
287
+ it("can schedule a very short attack", async () => {
296
288
  const e = {
297
289
  attack: 0.001,
298
290
  decay: 0.01,
299
291
  release: 0.1,
300
292
  sustain: 0.1,
301
293
  };
302
- return Offline(() => {
294
+ const buffer = await Offline(() => {
303
295
  const env = new Envelope(
304
296
  e.attack,
305
297
  e.decay,
@@ -309,40 +301,38 @@ describe("Envelope", () => {
309
301
  env.attackCurve = "exponential";
310
302
  env.toDestination();
311
303
  env.triggerAttack(0);
312
- }, 0.2).then((buffer) => {
313
- buffer.forEachBetween(
314
- (sample) => {
315
- expect(sample).to.be.within(0, 1);
316
- },
317
- 0,
318
- e.attack
319
- );
320
- buffer.forEachBetween(
321
- (sample) => {
322
- expect(sample).to.be.within(e.sustain - 0.001, 1);
323
- },
324
- e.attack,
325
- e.attack + e.decay
326
- );
327
- buffer.forEachBetween((sample) => {
328
- expect(sample).to.be.closeTo(e.sustain, 0.01);
329
- }, e.attack + e.decay);
330
- });
331
- });
332
-
333
- it("can schedule an attack of time 0", () => {
334
- return Offline(() => {
304
+ }, 0.2);
305
+ buffer.forEachBetween(
306
+ (sample) => {
307
+ expect(sample).to.be.within(0, 1);
308
+ },
309
+ 0,
310
+ e.attack
311
+ );
312
+ buffer.forEachBetween(
313
+ (sample) => {
314
+ expect(sample).to.be.within(e.sustain - 0.001, 1);
315
+ },
316
+ e.attack,
317
+ e.attack + e.decay
318
+ );
319
+ buffer.forEachBetween((sample) => {
320
+ expect(sample).to.be.closeTo(e.sustain, 0.01);
321
+ }, e.attack + e.decay);
322
+ });
323
+
324
+ it("can schedule an attack of time 0", async () => {
325
+ const buffer = await Offline(() => {
335
326
  const env = new Envelope(0, 0.1);
336
327
  env.toDestination();
337
328
  env.triggerAttack(0.1);
338
- }, 0.2).then((buffer) => {
339
- expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.001);
340
- expect(buffer.getValueAtTime(0.0999)).to.be.closeTo(0, 0.001);
341
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.001);
342
- });
329
+ }, 0.2);
330
+ expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.001);
331
+ expect(buffer.getValueAtTime(0.0999)).to.be.closeTo(0, 0.001);
332
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.001);
343
333
  });
344
334
 
345
- it("correctly schedule a release", () => {
335
+ it("correctly schedule a release", async () => {
346
336
  const e = {
347
337
  attack: 0.001,
348
338
  decay: 0.01,
@@ -350,7 +340,7 @@ describe("Envelope", () => {
350
340
  sustain: 0.5,
351
341
  };
352
342
  const releaseTime = 0.2;
353
- return Offline(() => {
343
+ const buffer = await Offline(() => {
354
344
  const env = new Envelope(
355
345
  e.attack,
356
346
  e.decay,
@@ -360,38 +350,36 @@ describe("Envelope", () => {
360
350
  env.attackCurve = "exponential";
361
351
  env.toDestination();
362
352
  env.triggerAttackRelease(releaseTime);
363
- }, 0.6).then((buffer) => {
364
- const sustainStart = e.attack + e.decay;
365
- const sustainEnd = sustainStart + releaseTime;
366
- buffer.forEachBetween(
367
- (sample) => {
368
- expect(sample).to.be.below(e.sustain + 0.01);
369
- },
370
- sustainStart,
371
- sustainEnd
372
- );
373
- buffer.forEachBetween((sample) => {
374
- expect(sample).to.be.closeTo(0, 0.01);
375
- }, releaseTime + e.release);
376
- });
377
- });
378
-
379
- it("can retrigger a short attack at the same time as previous release", () => {
380
- return Offline(() => {
353
+ }, 0.6);
354
+ const sustainStart = e.attack + e.decay;
355
+ const sustainEnd = sustainStart + releaseTime;
356
+ buffer.forEachBetween(
357
+ (sample) => {
358
+ expect(sample).to.be.below(e.sustain + 0.01);
359
+ },
360
+ sustainStart,
361
+ sustainEnd
362
+ );
363
+ buffer.forEachBetween((sample) => {
364
+ expect(sample).to.be.closeTo(0, 0.01);
365
+ }, releaseTime + e.release);
366
+ });
367
+
368
+ it("can retrigger a short attack at the same time as previous release", async () => {
369
+ const buffer = await Offline(() => {
381
370
  const env = new Envelope(0.001, 0.1, 0.5);
382
371
  env.attackCurve = "linear";
383
372
  env.toDestination();
384
373
  env.triggerAttack(0);
385
374
  env.triggerRelease(0.4);
386
375
  env.triggerAttack(0.4);
387
- }, 0.6).then((buffer) => {
388
- expect(buffer.getValueAtTime(0.4)).be.closeTo(0.5, 0.01);
389
- expect(buffer.getValueAtTime(0.40025)).be.closeTo(0.75, 0.01);
390
- expect(buffer.getValueAtTime(0.4005)).be.closeTo(1, 0.01);
391
- });
376
+ }, 0.6);
377
+ expect(buffer.getValueAtTime(0.4)).be.closeTo(0.5, 0.01);
378
+ expect(buffer.getValueAtTime(0.40025)).be.closeTo(0.75, 0.01);
379
+ expect(buffer.getValueAtTime(0.4005)).be.closeTo(1, 0.01);
392
380
  });
393
381
 
394
- it("is silent before and after triggering", () => {
382
+ it("is silent before and after triggering", async () => {
395
383
  const e = {
396
384
  attack: 0.001,
397
385
  decay: 0.01,
@@ -400,7 +388,7 @@ describe("Envelope", () => {
400
388
  };
401
389
  const releaseTime = 0.2;
402
390
  const attackTime = 0.1;
403
- return Offline(() => {
391
+ const buffer = await Offline(() => {
404
392
  const env = new Envelope(
405
393
  e.attack,
406
394
  e.decay,
@@ -411,40 +399,36 @@ describe("Envelope", () => {
411
399
  env.toDestination();
412
400
  env.triggerAttack(attackTime);
413
401
  env.triggerRelease(releaseTime);
414
- }, 0.6).then((buffer) => {
415
- expect(buffer.getValueAtTime(attackTime - 0.001)).to.equal(0);
416
- expect(
417
- buffer.getValueAtTime(
418
- e.attack + e.decay + releaseTime + e.release
419
- )
420
- ).to.be.below(0.01);
421
- });
402
+ }, 0.6);
403
+ expect(buffer.getValueAtTime(attackTime - 0.001)).to.equal(0);
404
+ expect(
405
+ buffer.getValueAtTime(
406
+ e.attack + e.decay + releaseTime + e.release
407
+ )
408
+ ).to.be.below(0.01);
422
409
  });
423
410
 
424
- it("is silent after decay if sustain is 0", () => {
411
+ it("is silent after decay if sustain is 0", async () => {
425
412
  const e = {
426
413
  attack: 0.01,
427
414
  decay: 0.04,
428
415
  sustain: 0,
429
416
  };
430
417
  const attackTime = 0.1;
431
- return Offline(() => {
418
+ const buffer = await Offline(() => {
432
419
  const env = new Envelope(e.attack, e.decay, e.sustain);
433
420
  env.toDestination();
434
421
  env.triggerAttack(attackTime);
435
- }, 0.4).then((buffer) => {
436
- buffer.forEach((sample, time) => {
437
- expect(buffer.getValueAtTime(attackTime - 0.001)).to.equal(
438
- 0
439
- );
440
- expect(
441
- buffer.getValueAtTime(attackTime + e.attack + e.decay)
442
- ).to.be.below(0.01);
443
- });
422
+ }, 0.4);
423
+ buffer.forEach((sample, time) => {
424
+ expect(buffer.getValueAtTime(attackTime - 0.001)).to.equal(0);
425
+ expect(
426
+ buffer.getValueAtTime(attackTime + e.attack + e.decay)
427
+ ).to.be.below(0.01);
444
428
  });
445
429
  });
446
430
 
447
- it("correctly schedule an attack release envelope", () => {
431
+ it("correctly schedule an attack release envelope", async () => {
448
432
  const e = {
449
433
  attack: 0.08,
450
434
  decay: 0.2,
@@ -452,7 +436,7 @@ describe("Envelope", () => {
452
436
  sustain: 0.1,
453
437
  };
454
438
  const releaseTime = 0.4;
455
- return Offline(() => {
439
+ const buffer = await Offline(() => {
456
440
  const env = new Envelope(
457
441
  e.attack,
458
442
  e.decay,
@@ -462,24 +446,23 @@ describe("Envelope", () => {
462
446
  env.toDestination();
463
447
  env.triggerAttack(0);
464
448
  env.triggerRelease(releaseTime);
465
- }).then((buffer) => {
466
- buffer.forEach((sample, time) => {
467
- if (time < e.attack) {
468
- expect(sample).to.be.within(0, 1);
469
- } else if (time < e.attack + e.decay) {
470
- expect(sample).to.be.within(e.sustain, 1);
471
- } else if (time < releaseTime) {
472
- expect(sample).to.be.closeTo(e.sustain, 0.1);
473
- } else if (time < releaseTime + e.release) {
474
- expect(sample).to.be.within(0, e.sustain + 0.01);
475
- } else {
476
- expect(sample).to.be.below(0.0001);
477
- }
478
- });
449
+ });
450
+ buffer.forEach((sample, time) => {
451
+ if (time < e.attack) {
452
+ expect(sample).to.be.within(0, 1);
453
+ } else if (time < e.attack + e.decay) {
454
+ expect(sample).to.be.within(e.sustain, 1);
455
+ } else if (time < releaseTime) {
456
+ expect(sample).to.be.closeTo(e.sustain, 0.1);
457
+ } else if (time < releaseTime + e.release) {
458
+ expect(sample).to.be.within(0, e.sustain + 0.01);
459
+ } else {
460
+ expect(sample).to.be.below(0.0001);
461
+ }
479
462
  });
480
463
  });
481
464
 
482
- it("can schedule a combined AttackRelease", () => {
465
+ it("can schedule a combined AttackRelease", async () => {
483
466
  const e = {
484
467
  attack: 0.1,
485
468
  decay: 0.2,
@@ -488,7 +471,7 @@ describe("Envelope", () => {
488
471
  };
489
472
  const releaseTime = 0.4;
490
473
  const duration = 0.4;
491
- return Offline(() => {
474
+ const buffer = await Offline(() => {
492
475
  const env = new Envelope(
493
476
  e.attack,
494
477
  e.decay,
@@ -498,24 +481,23 @@ describe("Envelope", () => {
498
481
  env.toDestination();
499
482
  env.triggerAttack(0);
500
483
  env.triggerRelease(releaseTime);
501
- }, 0.7).then((buffer) => {
502
- buffer.forEach((sample, time) => {
503
- if (time < e.attack) {
504
- expect(sample).to.be.within(0, 1);
505
- } else if (time < e.attack + e.decay) {
506
- expect(sample).to.be.within(e.sustain - 0.001, 1);
507
- } else if (time < duration) {
508
- expect(sample).to.be.closeTo(e.sustain, 0.1);
509
- } else if (time < duration + e.release) {
510
- expect(sample).to.be.within(0, e.sustain + 0.01);
511
- } else {
512
- expect(sample).to.be.below(0.0015);
513
- }
514
- });
515
- });
516
- });
517
-
518
- it("can schedule a combined AttackRelease with velocity", () => {
484
+ }, 0.7);
485
+ buffer.forEach((sample, time) => {
486
+ if (time < e.attack) {
487
+ expect(sample).to.be.within(0, 1);
488
+ } else if (time < e.attack + e.decay) {
489
+ expect(sample).to.be.within(e.sustain - 0.001, 1);
490
+ } else if (time < duration) {
491
+ expect(sample).to.be.closeTo(e.sustain, 0.1);
492
+ } else if (time < duration + e.release) {
493
+ expect(sample).to.be.within(0, e.sustain + 0.01);
494
+ } else {
495
+ expect(sample).to.be.below(0.0015);
496
+ }
497
+ });
498
+ });
499
+
500
+ it("can schedule a combined AttackRelease with velocity", async () => {
519
501
  const e = {
520
502
  attack: 0.1,
521
503
  decay: 0.2,
@@ -525,7 +507,7 @@ describe("Envelope", () => {
525
507
  const releaseTime = 0.4;
526
508
  const duration = 0.4;
527
509
  const velocity = 0.4;
528
- return Offline(() => {
510
+ const buffer = await Offline(() => {
529
511
  const env = new Envelope(
530
512
  e.attack,
531
513
  e.decay,
@@ -535,37 +517,33 @@ describe("Envelope", () => {
535
517
  env.toDestination();
536
518
  env.triggerAttack(0, velocity);
537
519
  env.triggerRelease(releaseTime);
538
- }, 0.7).then((buffer) => {
539
- buffer.forEach((sample, time) => {
540
- if (time < e.attack) {
541
- expect(sample).to.be.within(0, velocity + 0.01);
542
- } else if (time < e.attack + e.decay) {
543
- expect(sample).to.be.within(
544
- e.sustain * velocity - 0.01,
545
- velocity + 0.01
546
- );
547
- } else if (time < duration) {
548
- expect(sample).to.be.closeTo(e.sustain * velocity, 0.1);
549
- } else if (time < duration + e.release) {
550
- expect(sample).to.be.within(
551
- 0,
552
- e.sustain * velocity + 0.01
553
- );
554
- } else {
555
- expect(sample).to.be.below(0.01);
556
- }
557
- });
520
+ }, 0.7);
521
+ buffer.forEach((sample, time) => {
522
+ if (time < e.attack) {
523
+ expect(sample).to.be.within(0, velocity + 0.01);
524
+ } else if (time < e.attack + e.decay) {
525
+ expect(sample).to.be.within(
526
+ e.sustain * velocity - 0.01,
527
+ velocity + 0.01
528
+ );
529
+ } else if (time < duration) {
530
+ expect(sample).to.be.closeTo(e.sustain * velocity, 0.1);
531
+ } else if (time < duration + e.release) {
532
+ expect(sample).to.be.within(0, e.sustain * velocity + 0.01);
533
+ } else {
534
+ expect(sample).to.be.below(0.01);
535
+ }
558
536
  });
559
537
  });
560
538
 
561
- it("can schedule multiple envelopes", () => {
539
+ it("can schedule multiple envelopes", async () => {
562
540
  const e = {
563
541
  attack: 0.1,
564
542
  decay: 0.2,
565
543
  release: 0.1,
566
544
  sustain: 0.0,
567
545
  };
568
- return Offline(() => {
546
+ const buffer = await Offline(() => {
569
547
  const env = new Envelope(
570
548
  e.attack,
571
549
  e.decay,
@@ -575,20 +553,19 @@ describe("Envelope", () => {
575
553
  env.toDestination();
576
554
  env.triggerAttack(0);
577
555
  env.triggerAttack(0.5);
578
- }, 0.85).then((buffer) => {
579
- // first trigger
580
- expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.01);
581
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
582
- expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0, 0.01);
583
- // second trigger
584
- expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0, 0.01);
585
- expect(buffer.getValueAtTime(0.6)).to.be.closeTo(1, 0.01);
586
- expect(buffer.getValueAtTime(0.8)).to.be.closeTo(0, 0.01);
587
- });
588
- });
589
-
590
- it("can schedule multiple attack/releases with no discontinuities", () => {
591
- return Offline(() => {
556
+ }, 0.85);
557
+ // first trigger
558
+ expect(buffer.getValueAtTime(0)).to.be.closeTo(0, 0.01);
559
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(1, 0.01);
560
+ expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0, 0.01);
561
+ // second trigger
562
+ expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0, 0.01);
563
+ expect(buffer.getValueAtTime(0.6)).to.be.closeTo(1, 0.01);
564
+ expect(buffer.getValueAtTime(0.8)).to.be.closeTo(0, 0.01);
565
+ });
566
+
567
+ it("can schedule multiple attack/releases with no discontinuities", async () => {
568
+ const buffer = await Offline(() => {
592
569
  const env = new Envelope(0.1, 0.2, 0.2, 0.4).toDestination();
593
570
  env.triggerAttackRelease(0, 0.4);
594
571
  env.triggerAttackRelease(0.4, 0.11);
@@ -596,20 +573,19 @@ describe("Envelope", () => {
596
573
  env.triggerAttackRelease(1.1, 0.09);
597
574
  env.triggerAttackRelease(1.5, 0.3);
598
575
  env.triggerAttackRelease(1.8, 0.29);
599
- }, 2).then((buffer) => {
600
- // test for discontinuities
601
- let lastSample = 0;
602
- buffer.forEach((sample, time) => {
603
- expect(sample).to.be.at.most(1);
604
- const diff = Math.abs(lastSample - sample);
605
- expect(diff).to.be.lessThan(0.001);
606
- lastSample = sample;
607
- });
576
+ }, 2);
577
+ // test for discontinuities
578
+ let lastSample = 0;
579
+ buffer.forEach((sample, time) => {
580
+ expect(sample).to.be.at.most(1);
581
+ const diff = Math.abs(lastSample - sample);
582
+ expect(diff).to.be.lessThan(0.001);
583
+ lastSample = sample;
608
584
  });
609
585
  });
610
586
 
611
- it("can schedule multiple 'linear' attack/releases with no discontinuities", () => {
612
- return Offline(() => {
587
+ it("can schedule multiple 'linear' attack/releases with no discontinuities", async () => {
588
+ const buffer = await Offline(() => {
613
589
  const env = new Envelope(0.1, 0.2, 0.2, 0.4).toDestination();
614
590
  env.attackCurve = "linear";
615
591
  env.releaseCurve = "linear";
@@ -619,20 +595,19 @@ describe("Envelope", () => {
619
595
  env.triggerAttackRelease(1.1, 0.09);
620
596
  env.triggerAttackRelease(1.5, 0.3);
621
597
  env.triggerAttackRelease(1.8, 0.29);
622
- }, 2).then((buffer) => {
623
- // test for discontinuities
624
- let lastSample = 0;
625
- buffer.forEach((sample, time) => {
626
- expect(sample).to.be.at.most(1);
627
- const diff = Math.abs(lastSample - sample);
628
- expect(diff).to.be.lessThan(0.001);
629
- lastSample = sample;
630
- });
598
+ }, 2);
599
+ // test for discontinuities
600
+ let lastSample = 0;
601
+ buffer.forEach((sample, time) => {
602
+ expect(sample).to.be.at.most(1);
603
+ const diff = Math.abs(lastSample - sample);
604
+ expect(diff).to.be.lessThan(0.001);
605
+ lastSample = sample;
631
606
  });
632
607
  });
633
608
 
634
- it("can schedule multiple 'exponential' attack/releases with no discontinuities", () => {
635
- return Offline(() => {
609
+ it("can schedule multiple 'exponential' attack/releases with no discontinuities", async () => {
610
+ const buffer = await Offline(() => {
636
611
  const env = new Envelope(0.1, 0.2, 0.2, 0.4).toDestination();
637
612
  env.attackCurve = "exponential";
638
613
  env.releaseCurve = "exponential";
@@ -642,20 +617,19 @@ describe("Envelope", () => {
642
617
  env.triggerAttackRelease(1.1, 0.09);
643
618
  env.triggerAttackRelease(1.5, 0.3);
644
619
  env.triggerAttackRelease(1.8, 0.29);
645
- }, 2).then((buffer) => {
646
- // test for discontinuities
647
- let lastSample = 0;
648
- buffer.forEach((sample, time) => {
649
- expect(sample).to.be.at.most(1);
650
- const diff = Math.abs(lastSample - sample);
651
- expect(diff).to.be.lessThan(0.0035);
652
- lastSample = sample;
653
- });
620
+ }, 2);
621
+ // test for discontinuities
622
+ let lastSample = 0;
623
+ buffer.forEach((sample, time) => {
624
+ expect(sample).to.be.at.most(1);
625
+ const diff = Math.abs(lastSample - sample);
626
+ expect(diff).to.be.lessThan(0.0035);
627
+ lastSample = sample;
654
628
  });
655
629
  });
656
630
 
657
- it("can schedule multiple 'sine' attack/releases with no discontinuities", () => {
658
- return Offline(() => {
631
+ it("can schedule multiple 'sine' attack/releases with no discontinuities", async () => {
632
+ const buffer = await Offline(() => {
659
633
  const env = new Envelope(0.1, 0.2, 0.2, 0.4).toDestination();
660
634
  env.attackCurve = "sine";
661
635
  env.releaseCurve = "sine";
@@ -665,20 +639,19 @@ describe("Envelope", () => {
665
639
  env.triggerAttackRelease(1.1, 0.09);
666
640
  env.triggerAttackRelease(1.5, 0.3);
667
641
  env.triggerAttackRelease(1.8, 0.29);
668
- }, 2).then((buffer) => {
669
- // test for discontinuities
670
- let lastSample = 0;
671
- buffer.forEach((sample, time) => {
672
- expect(sample).to.be.at.most(1);
673
- const diff = Math.abs(lastSample - sample);
674
- expect(diff).to.be.lessThan(0.0035);
675
- lastSample = sample;
676
- });
642
+ }, 2);
643
+ // test for discontinuities
644
+ let lastSample = 0;
645
+ buffer.forEach((sample, time) => {
646
+ expect(sample).to.be.at.most(1);
647
+ const diff = Math.abs(lastSample - sample);
648
+ expect(diff).to.be.lessThan(0.0035);
649
+ lastSample = sample;
677
650
  });
678
651
  });
679
652
 
680
- it("can schedule multiple 'cosine' attack/releases with no discontinuities", () => {
681
- return Offline(() => {
653
+ it("can schedule multiple 'cosine' attack/releases with no discontinuities", async () => {
654
+ const buffer = await Offline(() => {
682
655
  const env = new Envelope(0.1, 0.2, 0.2, 0.4).toDestination();
683
656
  env.attackCurve = "cosine";
684
657
  env.releaseCurve = "cosine";
@@ -688,20 +661,19 @@ describe("Envelope", () => {
688
661
  env.triggerAttackRelease(1.1, 0.09);
689
662
  env.triggerAttackRelease(1.5, 0.3);
690
663
  env.triggerAttackRelease(1.8, 0.29);
691
- }, 2).then((buffer) => {
692
- // test for discontinuities
693
- let lastSample = 0;
694
- buffer.forEach((sample, time) => {
695
- expect(sample).to.be.at.most(1);
696
- const diff = Math.abs(lastSample - sample);
697
- expect(diff).to.be.lessThan(0.002);
698
- lastSample = sample;
699
- });
664
+ }, 2);
665
+ // test for discontinuities
666
+ let lastSample = 0;
667
+ buffer.forEach((sample, time) => {
668
+ expect(sample).to.be.at.most(1);
669
+ const diff = Math.abs(lastSample - sample);
670
+ expect(diff).to.be.lessThan(0.002);
671
+ lastSample = sample;
700
672
  });
701
673
  });
702
674
 
703
- it("reports its current envelope value (.value)", () => {
704
- return Offline(() => {
675
+ it("reports its current envelope value (.value)", async () => {
676
+ const buffer = await Offline(() => {
705
677
  const env = new Envelope(1, 0.2, 1).toDestination();
706
678
  expect(env.value).to.be.closeTo(0, 0.01);
707
679
  env.triggerAttack();
@@ -711,14 +683,13 @@ describe("Envelope", () => {
711
683
  }, 0.5);
712
684
  });
713
685
 
714
- it("can cancel a schedule envelope", () => {
715
- return Offline(() => {
686
+ it("can cancel a schedule envelope", async () => {
687
+ const buffer = await Offline(() => {
716
688
  const env = new Envelope(0.1, 0.2, 1).toDestination();
717
689
  env.triggerAttack(0.2);
718
690
  env.cancel(0.2);
719
- }, 0.3).then((buffer) => {
720
- expect(buffer.isSilent()).to.be.true;
721
- });
691
+ }, 0.3);
692
+ expect(buffer.isSilent()).to.be.true;
722
693
  });
723
694
  });
724
695
 
@@ -751,8 +722,8 @@ describe("Envelope", () => {
751
722
  env.dispose();
752
723
  });
753
724
 
754
- it("outputs a signal when the attack/release curves are set to 'bounce'", () => {
755
- return Offline(() => {
725
+ it("outputs a signal when the attack/release curves are set to 'bounce'", async () => {
726
+ const buffer = await Offline(() => {
756
727
  const env = new Envelope({
757
728
  attack: 0.3,
758
729
  attackCurve: "bounce",
@@ -762,19 +733,18 @@ describe("Envelope", () => {
762
733
  sustain: 1,
763
734
  }).toDestination();
764
735
  env.triggerAttackRelease(0.3, 0.1);
765
- }, 0.8).then((buffer) => {
766
- buffer.forEachBetween(
767
- (sample) => {
768
- expect(sample).to.be.above(0);
769
- },
770
- 0.101,
771
- 0.7
772
- );
773
- });
774
- });
775
-
776
- it("outputs a signal when the attack/release curves are set to 'ripple'", () => {
777
- return Offline(() => {
736
+ }, 0.8);
737
+ buffer.forEachBetween(
738
+ (sample) => {
739
+ expect(sample).to.be.above(0);
740
+ },
741
+ 0.101,
742
+ 0.7
743
+ );
744
+ });
745
+
746
+ it("outputs a signal when the attack/release curves are set to 'ripple'", async () => {
747
+ const buffer = await Offline(() => {
778
748
  const env = new Envelope({
779
749
  attack: 0.3,
780
750
  attackCurve: "ripple",
@@ -784,19 +754,18 @@ describe("Envelope", () => {
784
754
  sustain: 1,
785
755
  }).toDestination();
786
756
  env.triggerAttackRelease(0.3, 0.1);
787
- }, 0.8).then((buffer) => {
788
- buffer.forEachBetween(
789
- (sample) => {
790
- expect(sample).to.be.above(0);
791
- },
792
- 0.101,
793
- 0.7
794
- );
795
- });
796
- });
797
-
798
- it("outputs a signal when the attack/release curves are set to 'sine'", () => {
799
- return Offline(() => {
757
+ }, 0.8);
758
+ buffer.forEachBetween(
759
+ (sample) => {
760
+ expect(sample).to.be.above(0);
761
+ },
762
+ 0.101,
763
+ 0.7
764
+ );
765
+ });
766
+
767
+ it("outputs a signal when the attack/release curves are set to 'sine'", async () => {
768
+ const buffer = await Offline(() => {
800
769
  const env = new Envelope({
801
770
  attack: 0.3,
802
771
  attackCurve: "sine",
@@ -806,19 +775,18 @@ describe("Envelope", () => {
806
775
  sustain: 1,
807
776
  }).toDestination();
808
777
  env.triggerAttackRelease(0.3, 0.1);
809
- }, 0.8).then((buffer) => {
810
- buffer.forEachBetween(
811
- (sample) => {
812
- expect(sample).to.be.above(0);
813
- },
814
- 0.101,
815
- 0.7
816
- );
817
- });
818
- });
819
-
820
- it("outputs a signal when the attack/release curves are set to 'cosine'", () => {
821
- return Offline(() => {
778
+ }, 0.8);
779
+ buffer.forEachBetween(
780
+ (sample) => {
781
+ expect(sample).to.be.above(0);
782
+ },
783
+ 0.101,
784
+ 0.7
785
+ );
786
+ });
787
+
788
+ it("outputs a signal when the attack/release curves are set to 'cosine'", async () => {
789
+ const buffer = await Offline(() => {
822
790
  const env = new Envelope({
823
791
  attack: 0.3,
824
792
  attackCurve: "cosine",
@@ -828,19 +796,18 @@ describe("Envelope", () => {
828
796
  sustain: 1,
829
797
  }).toDestination();
830
798
  env.triggerAttackRelease(0.3, 0.1);
831
- }, 0.8).then((buffer) => {
832
- buffer.forEachBetween(
833
- (sample) => {
834
- expect(sample).to.be.above(0);
835
- },
836
- 0.101,
837
- 0.7
838
- );
839
- });
840
- });
841
-
842
- it("outputs a signal when the attack/release curves are set to 'step'", () => {
843
- return Offline(() => {
799
+ }, 0.8);
800
+ buffer.forEachBetween(
801
+ (sample) => {
802
+ expect(sample).to.be.above(0);
803
+ },
804
+ 0.101,
805
+ 0.7
806
+ );
807
+ });
808
+
809
+ it("outputs a signal when the attack/release curves are set to 'step'", async () => {
810
+ const buffer = await Offline(() => {
844
811
  const env = new Envelope({
845
812
  attack: 0.3,
846
813
  attackCurve: "step",
@@ -850,19 +817,18 @@ describe("Envelope", () => {
850
817
  sustain: 1,
851
818
  }).toDestination();
852
819
  env.triggerAttackRelease(0.3, 0.1);
853
- }, 0.8).then((buffer) => {
854
- buffer.forEach((sample, time) => {
855
- if (time > 0.3 && time < 0.5) {
856
- expect(sample).to.be.above(0);
857
- } else if (time < 0.1) {
858
- expect(sample).to.equal(0);
859
- }
860
- });
820
+ }, 0.8);
821
+ buffer.forEach((sample, time) => {
822
+ if (time > 0.3 && time < 0.5) {
823
+ expect(sample).to.be.above(0);
824
+ } else if (time < 0.1) {
825
+ expect(sample).to.equal(0);
826
+ }
861
827
  });
862
828
  });
863
829
 
864
- it("outputs a signal when the attack/release curves are set to an array", () => {
865
- return Offline(() => {
830
+ it("outputs a signal when the attack/release curves are set to an array", async () => {
831
+ const buffer = await Offline(() => {
866
832
  const env = new Envelope({
867
833
  attack: 0.3,
868
834
  attackCurve: [0, 1, 0, 1],
@@ -873,19 +839,18 @@ describe("Envelope", () => {
873
839
  }).toDestination();
874
840
  expect(env.attackCurve).to.deep.equal([0, 1, 0, 1]);
875
841
  env.triggerAttackRelease(0.3, 0.1);
876
- }, 0.8).then((buffer) => {
877
- buffer.forEach((sample, time) => {
878
- if (time > 0.4 && time < 0.5) {
879
- expect(sample).to.be.above(0);
880
- } else if (time < 0.1) {
881
- expect(sample).to.equal(0);
882
- }
883
- });
842
+ }, 0.8);
843
+ buffer.forEach((sample, time) => {
844
+ if (time > 0.4 && time < 0.5) {
845
+ expect(sample).to.be.above(0);
846
+ } else if (time < 0.1) {
847
+ expect(sample).to.equal(0);
848
+ }
884
849
  });
885
850
  });
886
851
 
887
- it("can scale a velocity with a custom curve", () => {
888
- return Offline(() => {
852
+ it("can scale a velocity with a custom curve", async () => {
853
+ const buffer = await Offline(() => {
889
854
  const env = new Envelope({
890
855
  attack: 0.3,
891
856
  attackCurve: [0, 1, 0, 1],
@@ -895,10 +860,9 @@ describe("Envelope", () => {
895
860
  sustain: 1,
896
861
  }).toDestination();
897
862
  env.triggerAttackRelease(0.4, 0.1, 0.5);
898
- }, 0.8).then((buffer) => {
899
- buffer.forEach((sample) => {
900
- expect(sample).to.be.at.most(0.51);
901
- });
863
+ }, 0.8);
864
+ buffer.forEach((sample) => {
865
+ expect(sample).to.be.at.most(0.51);
902
866
  });
903
867
  });
904
868
 
@@ -917,8 +881,8 @@ describe("Envelope", () => {
917
881
  env.dispose();
918
882
  });
919
883
 
920
- it("can retrigger partial envelope with custom type", () => {
921
- return Offline(() => {
884
+ it("can retrigger partial envelope with custom type", async () => {
885
+ const buffer = await Offline(() => {
922
886
  const env = new Envelope({
923
887
  attack: 0.5,
924
888
  attackCurve: "cosine",
@@ -930,18 +894,17 @@ describe("Envelope", () => {
930
894
  env.triggerAttack(0);
931
895
  env.triggerRelease(0.2);
932
896
  env.triggerAttack(0.5);
933
- }, 1).then((buffer) => {
934
- expect(buffer.getValueAtTime(0)).to.equal(0);
935
- expect(buffer.getValueAtTime(0.1)).to.be.closeTo(0.32, 0.01);
936
- expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.6, 0.01);
937
- expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.53, 0.01);
938
- expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.38, 0.01);
939
- expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.2, 0.01);
940
- expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0.52, 0.01);
941
- expect(buffer.getValueAtTime(0.7)).to.be.closeTo(0.78, 0.01);
942
- expect(buffer.getValueAtTime(0.8)).to.be.closeTo(0.95, 0.01);
943
- expect(buffer.getValueAtTime(0.9)).to.be.closeTo(1, 0.01);
944
- });
897
+ }, 1);
898
+ expect(buffer.getValueAtTime(0)).to.equal(0);
899
+ expect(buffer.getValueAtTime(0.1)).to.be.closeTo(0.32, 0.01);
900
+ expect(buffer.getValueAtTime(0.2)).to.be.closeTo(0.6, 0.01);
901
+ expect(buffer.getValueAtTime(0.3)).to.be.closeTo(0.53, 0.01);
902
+ expect(buffer.getValueAtTime(0.4)).to.be.closeTo(0.38, 0.01);
903
+ expect(buffer.getValueAtTime(0.5)).to.be.closeTo(0.2, 0.01);
904
+ expect(buffer.getValueAtTime(0.6)).to.be.closeTo(0.52, 0.01);
905
+ expect(buffer.getValueAtTime(0.7)).to.be.closeTo(0.78, 0.01);
906
+ expect(buffer.getValueAtTime(0.8)).to.be.closeTo(0.95, 0.01);
907
+ expect(buffer.getValueAtTime(0.9)).to.be.closeTo(1, 0.01);
945
908
  });
946
909
  });
947
910
  });