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
@@ -65,62 +65,57 @@ describe("LFO", () => {
65
65
  });
66
66
  });
67
67
 
68
- it("can be creates an oscillation in a specific range", () => {
69
- return Offline(() => {
68
+ it("can be creates an oscillation in a specific range", async () => {
69
+ const buffer = await Offline(() => {
70
70
  const lfo = new LFO(100, 10, 20).toDestination();
71
71
  lfo.start();
72
- }).then((buffer) => {
73
- expect(buffer.min()).to.be.gte(10);
74
- expect(buffer.max()).to.be.lte(20);
75
72
  });
73
+ expect(buffer.min()).to.be.gte(10);
74
+ expect(buffer.max()).to.be.lte(20);
76
75
  });
77
76
 
78
- it("can change the oscillation range", () => {
79
- return Offline(() => {
77
+ it("can change the oscillation range", async () => {
78
+ const buffer = await Offline(() => {
80
79
  const lfo = new LFO(100, 10, 20).toDestination();
81
80
  lfo.start();
82
81
  lfo.min = 15;
83
82
  lfo.max = 18;
84
- }).then((buffer) => {
85
- expect(buffer.min()).to.be.gte(15);
86
- expect(buffer.max()).to.be.lte(18);
87
83
  });
84
+ expect(buffer.min()).to.be.gte(15);
85
+ expect(buffer.max()).to.be.lte(18);
88
86
  });
89
87
 
90
- it("initially outputs a signal at the center of it's phase", () => {
91
- return Offline(() => {
88
+ it("initially outputs a signal at the center of it's phase", async () => {
89
+ const buffer = await Offline(() => {
92
90
  new LFO(100, 10, 20).toDestination();
93
- }).then((buffer) => {
94
- expect(buffer.value()).to.be.closeTo(15, 0.1);
95
91
  });
92
+ expect(buffer.value()).to.be.closeTo(15, 0.1);
96
93
  });
97
94
 
98
- it("outputs a signal at the correct phase angle", () => {
99
- return Offline(() => {
95
+ it("outputs a signal at the correct phase angle", async () => {
96
+ const buffer = await Offline(() => {
100
97
  new LFO({
101
98
  min: 0,
102
99
  phase: 90,
103
100
  }).toDestination();
104
- }).then((buffer) => {
105
- expect(buffer.value()).to.be.closeTo(0, 0.1);
106
101
  });
102
+ expect(buffer.value()).to.be.closeTo(0, 0.1);
107
103
  });
108
104
 
109
- it("outputs the right phase when setting a new phase", () => {
110
- return Offline(() => {
105
+ it("outputs the right phase when setting a new phase", async () => {
106
+ const buffer = await Offline(() => {
111
107
  const lfo = new LFO({
112
108
  max: 1,
113
109
  min: -1,
114
110
  phase: 0,
115
111
  }).toDestination();
116
112
  lfo.phase = 270;
117
- }).then((buffer) => {
118
- expect(buffer.value()).to.be.closeTo(1, 0.1);
119
113
  });
114
+ expect(buffer.value()).to.be.closeTo(1, 0.1);
120
115
  });
121
116
 
122
- it("can convert to other units", () => {
123
- return Offline(() => {
117
+ it("can convert to other units", async () => {
118
+ const buffer = await Offline(() => {
124
119
  const lfo = new LFO({
125
120
  frequency: 20,
126
121
  max: 5,
@@ -128,14 +123,13 @@ describe("LFO", () => {
128
123
  units: "decibels",
129
124
  }).toDestination();
130
125
  lfo.start();
131
- }).then((buffer) => {
132
- expect(buffer.min()).to.be.closeTo(0.099, 0.01);
133
- expect(buffer.max()).to.be.closeTo(1.78, 0.01);
134
126
  });
127
+ expect(buffer.min()).to.be.closeTo(0.099, 0.01);
128
+ expect(buffer.max()).to.be.closeTo(1.78, 0.01);
135
129
  });
136
130
 
137
- it("can converts to the units of the connecting node", () => {
138
- return Offline(() => {
131
+ it("can converts to the units of the connecting node", async () => {
132
+ const buffer = await Offline(() => {
139
133
  const lfo = new LFO(20, -35, -10);
140
134
  const signal = new Signal(0, "decibels");
141
135
  expect(lfo.units).to.equal("number");
@@ -143,14 +137,13 @@ describe("LFO", () => {
143
137
  lfo.connect(signal);
144
138
  expect(lfo.units).to.equal("decibels");
145
139
  lfo.start();
146
- }).then((buffer) => {
147
- expect(buffer.min()).to.be.closeTo(0.017, 0.01);
148
- expect(buffer.max()).to.be.closeTo(0.31, 0.01);
149
140
  });
141
+ expect(buffer.min()).to.be.closeTo(0.017, 0.01);
142
+ expect(buffer.max()).to.be.closeTo(0.31, 0.01);
150
143
  });
151
144
 
152
- it("does not convert to the connected value if that is not set to convert", () => {
153
- return Offline(() => {
145
+ it("does not convert to the connected value if that is not set to convert", async () => {
146
+ const buffer = await Offline(() => {
154
147
  const lfo = new LFO(20, -35, -10);
155
148
  const signal = new Signal({
156
149
  convert: false,
@@ -162,61 +155,56 @@ describe("LFO", () => {
162
155
  lfo.connect(signal);
163
156
  expect(lfo.units).to.equal("decibels");
164
157
  lfo.start();
165
- }).then((buffer) => {
166
- expect(buffer.min()).to.be.closeTo(-35, 0.01);
167
- expect(buffer.max()).to.be.closeTo(-10, 0.01);
168
158
  });
159
+ expect(buffer.min()).to.be.closeTo(-35, 0.01);
160
+ expect(buffer.max()).to.be.closeTo(-10, 0.01);
169
161
  });
170
162
 
171
- it("can sync the frequency to the Transport", () => {
172
- return Offline(({ transport }) => {
163
+ it("can sync the frequency to the Transport", async () => {
164
+ const buffer = await Offline(({ transport }) => {
173
165
  const lfo = new LFO(2);
174
166
  lfo.sync();
175
167
  lfo.frequency.toDestination();
176
168
  transport.bpm.setValueAtTime(transport.bpm.value * 2, 0.05);
177
169
  // transport.start(0)
178
- }, 0.1).then((buffer) => {
179
- expect(buffer.getValueAtTime(0)).to.be.closeTo(2, 0.1);
180
- expect(buffer.getValueAtTime(0.05)).to.be.closeTo(4, 0.1);
181
- });
170
+ }, 0.1);
171
+ expect(buffer.getValueAtTime(0)).to.be.closeTo(2, 0.1);
172
+ expect(buffer.getValueAtTime(0.05)).to.be.closeTo(4, 0.1);
182
173
  });
183
174
 
184
- it("can unsync the frequency to the transport", () => {
185
- return Offline(({ transport }) => {
175
+ it("can unsync the frequency to the transport", async () => {
176
+ const buffer = await Offline(({ transport }) => {
186
177
  const lfo = new LFO(2);
187
178
  lfo.sync();
188
179
  lfo.frequency.toDestination();
189
180
  transport.bpm.setValueAtTime(transport.bpm.value * 2, 0.05);
190
181
  lfo.unsync();
191
182
  transport.start(0);
192
- }, 0.1).then((buffer) => {
193
- expect(buffer.getValueAtTime(0)).to.be.closeTo(2, 0.1);
194
- expect(buffer.getValueAtTime(0.05)).to.be.closeTo(2, 0.1);
195
- });
183
+ }, 0.1);
184
+ expect(buffer.getValueAtTime(0)).to.be.closeTo(2, 0.1);
185
+ expect(buffer.getValueAtTime(0.05)).to.be.closeTo(2, 0.1);
196
186
  });
197
187
 
198
- it("can adjust the amplitude", () => {
199
- return Offline(() => {
188
+ it("can adjust the amplitude", async () => {
189
+ const buffer = await Offline(() => {
200
190
  const lfo = new LFO(10, -10, 10);
201
191
  lfo.amplitude.value = 0.5;
202
192
  lfo.toDestination();
203
193
  lfo.start();
204
- }, 0.1).then((buffer) => {
205
- expect(buffer.min()).to.be.closeTo(-5, 0.1);
206
- expect(buffer.max()).to.be.closeTo(5, 0.1);
207
- });
194
+ }, 0.1);
195
+ expect(buffer.min()).to.be.closeTo(-5, 0.1);
196
+ expect(buffer.max()).to.be.closeTo(5, 0.1);
208
197
  });
209
198
 
210
- it("can adjust the amplitude not centered at 0", () => {
211
- return Offline(() => {
199
+ it("can adjust the amplitude not centered at 0", async () => {
200
+ const buffer = await Offline(() => {
212
201
  const lfo = new LFO(10, 400, 4000);
213
202
  lfo.amplitude.value = 0.5;
214
203
  lfo.toDestination();
215
204
  lfo.start();
216
- }, 0.1).then((buffer) => {
217
- expect(buffer.min()).to.be.closeTo(1300, 1);
218
- expect(buffer.max()).to.be.closeTo(3100, 1);
219
- });
205
+ }, 0.1);
206
+ expect(buffer.min()).to.be.closeTo(1300, 1);
207
+ expect(buffer.max()).to.be.closeTo(3100, 1);
220
208
  });
221
209
 
222
210
  it("can pass in partials to the constructor", () => {
@@ -49,41 +49,39 @@ describe("Oscillator", () => {
49
49
  });
50
50
 
51
51
  context("Phase Rotation", () => {
52
- it("can change the phase to 90", () => {
53
- return Offline(() => {
52
+ it("can change the phase to 90", async () => {
53
+ const buffer = await Offline(() => {
54
54
  const instance = new Oscillator({
55
55
  frequency: 1,
56
56
  phase: 90,
57
57
  });
58
58
  instance.toDestination();
59
59
  instance.start(0);
60
- }, 1).then((buffer) => {
61
- buffer.forEach((sample, time) => {
62
- if (time < 0.25) {
63
- expect(sample).to.be.within(-1, 0);
64
- } else if (time > 0.25 && time < 0.5) {
65
- expect(sample).to.be.within(0, 1);
66
- }
67
- });
60
+ }, 1);
61
+ buffer.forEach((sample, time) => {
62
+ if (time < 0.25) {
63
+ expect(sample).to.be.within(-1, 0);
64
+ } else if (time > 0.25 && time < 0.5) {
65
+ expect(sample).to.be.within(0, 1);
66
+ }
68
67
  });
69
68
  });
70
69
 
71
- it("can change the phase to -90", () => {
72
- return Offline(() => {
70
+ it("can change the phase to -90", async () => {
71
+ const buffer = await Offline(() => {
73
72
  const instance = new Oscillator({
74
73
  frequency: 1,
75
74
  phase: 270,
76
75
  });
77
76
  instance.toDestination();
78
77
  instance.start(0);
79
- }, 1).then((buffer) => {
80
- buffer.forEach((sample, time) => {
81
- if (time < 0.25) {
82
- expect(sample).to.be.within(0, 1);
83
- } else if (time > 0.25 && time < 0.5) {
84
- expect(sample).to.be.within(-1, 0);
85
- }
86
- });
78
+ }, 1);
79
+ buffer.forEach((sample, time) => {
80
+ if (time < 0.25) {
81
+ expect(sample).to.be.within(0, 1);
82
+ } else if (time > 0.25 && time < 0.5) {
83
+ expect(sample).to.be.within(-1, 0);
84
+ }
87
85
  });
88
86
  });
89
87
 
@@ -225,29 +223,27 @@ describe("Oscillator", () => {
225
223
  });
226
224
 
227
225
  context("Synchronization", () => {
228
- it("can sync the frequency to the Transport", () => {
229
- return Offline(({ transport }) => {
226
+ it("can unsync the frequency from the Transport", async () => {
227
+ const buffer = await Offline(({ transport }) => {
230
228
  transport.bpm.value = 120;
231
229
  const osc = new Oscillator(2);
232
230
  osc.frequency.toDestination();
233
231
  osc.syncFrequency();
234
232
  transport.bpm.value = 240;
235
- }).then((buffer) => {
236
- expect(buffer.value()).to.be.closeTo(4, 0.001);
237
233
  });
234
+ expect(buffer.value()).to.be.closeTo(4, 0.001);
238
235
  });
239
236
 
240
- it("can unsync the frequency from the Transport", () => {
241
- return Offline(({ transport }) => {
237
+ it("can sync the frequency to the Transport", async () => {
238
+ const buffer = await Offline(({ transport }) => {
242
239
  transport.bpm.value = 120;
243
240
  const osc = new Oscillator(2);
244
241
  osc.frequency.toDestination();
245
242
  osc.syncFrequency();
246
243
  transport.bpm.value = 240;
247
244
  osc.unsyncFrequency();
248
- }).then((buffer) => {
249
- expect(buffer.value()).to.be.closeTo(2, 0.001);
250
245
  });
246
+ expect(buffer.value()).to.be.closeTo(2, 0.001);
251
247
  });
252
248
  });
253
249
 
@@ -26,8 +26,8 @@ describe("PulseOscillator", () => {
26
26
  });
27
27
 
28
28
  context("Phase Rotation", () => {
29
- it("can change the phase to 90", () => {
30
- return Offline(() => {
29
+ it("can change the phase to 90", async () => {
30
+ const buffer = await Offline(() => {
31
31
  const osc = new PulseOscillator({
32
32
  frequency: 1,
33
33
  phase: 90,
@@ -35,19 +35,18 @@ describe("PulseOscillator", () => {
35
35
  });
36
36
  osc.toDestination();
37
37
  osc.start(0);
38
- }, 1).then(async (buffer) => {
39
- buffer.forEach((sample, time) => {
40
- if (time < 0.25) {
41
- expect(sample).to.be.within(-1, 0);
42
- } else if (time > 0.25 && time < 0.5) {
43
- expect(sample).to.be.within(0, 1);
44
- }
45
- });
38
+ }, 1);
39
+ buffer.forEach((sample, time) => {
40
+ if (time < 0.25) {
41
+ expect(sample).to.be.within(-1, 0);
42
+ } else if (time > 0.25 && time < 0.5) {
43
+ expect(sample).to.be.within(0, 1);
44
+ }
46
45
  });
47
46
  });
48
47
 
49
- it("can change the phase to -90", () => {
50
- return Offline(() => {
48
+ it("can change the phase to -90", async () => {
49
+ const buffer = await Offline(() => {
51
50
  const osc = new PulseOscillator({
52
51
  frequency: 1,
53
52
  phase: 270,
@@ -55,14 +54,13 @@ describe("PulseOscillator", () => {
55
54
  });
56
55
  osc.toDestination();
57
56
  osc.start(0);
58
- }, 1).then((buffer) => {
59
- buffer.forEach((sample, time) => {
60
- if (time < 0.25) {
61
- expect(sample).to.be.within(0, 1);
62
- } else if (time > 0.25 && time < 0.5) {
63
- expect(sample).to.be.within(-1, 0);
64
- }
65
- });
57
+ }, 1);
58
+ buffer.forEach((sample, time) => {
59
+ if (time < 0.25) {
60
+ expect(sample).to.be.within(0, 1);
61
+ } else if (time > 0.25 && time < 0.5) {
62
+ expect(sample).to.be.within(-1, 0);
63
+ }
66
64
  });
67
65
  });
68
66
  });
@@ -76,41 +74,39 @@ describe("PulseOscillator", () => {
76
74
  osc.dispose();
77
75
  });
78
76
 
79
- it("outputs correctly with a width of 0", () => {
80
- return Offline(() => {
77
+ it("outputs correctly with a width of 0", async () => {
78
+ const buffer = await Offline(() => {
81
79
  const osc = new PulseOscillator({
82
80
  frequency: 1,
83
81
  width: 0,
84
82
  });
85
83
  osc.toDestination();
86
84
  osc.start(0);
87
- }, 0.9).then((buffer) => {
88
- buffer.forEach((sample, time) => {
89
- if (time > 0.51) {
90
- expect(sample).to.be.within(-1, 0);
91
- }
92
- });
85
+ }, 0.9);
86
+ buffer.forEach((sample, time) => {
87
+ if (time > 0.51) {
88
+ expect(sample).to.be.within(-1, 0);
89
+ }
93
90
  });
94
91
  });
95
92
 
96
- it("outputs correctly with a width of 0.5", () => {
97
- return Offline(() => {
93
+ it("outputs correctly with a width of 0.5", async () => {
94
+ const buffer = await Offline(() => {
98
95
  const osc = new PulseOscillator({
99
96
  frequency: 1,
100
97
  width: 0.5,
101
98
  });
102
99
  osc.toDestination();
103
100
  osc.start(0);
104
- }, 1).then((buffer) => {
105
- buffer.forEach((sample, time) => {
106
- if (time <= 0.6) {
107
- expect(sample).to.be.within(0, 1);
108
- } else if (time >= 0.63 && time <= 0.87) {
109
- expect(sample).to.be.within(-1, 0);
110
- } else if (time > 0.9) {
111
- expect(sample).to.be.within(0, 1);
112
- }
113
- });
101
+ }, 1);
102
+ buffer.forEach((sample, time) => {
103
+ if (time <= 0.6) {
104
+ expect(sample).to.be.within(0, 1);
105
+ } else if (time >= 0.63 && time <= 0.87) {
106
+ expect(sample).to.be.within(-1, 0);
107
+ } else if (time > 0.9) {
108
+ expect(sample).to.be.within(0, 1);
109
+ }
114
110
  });
115
111
  });
116
112
  });
@@ -99,9 +99,9 @@ describe("ToneOscillatorNode", () => {
99
99
  };
100
100
  });
101
101
 
102
- it("invokes the onended callback in the offline context", () => {
102
+ it("invokes the onended callback in the offline context", async () => {
103
103
  let wasInvoked = false;
104
- return Offline(() => {
104
+ await Offline(() => {
105
105
  const osc = new ToneOscillatorNode();
106
106
  osc.start(0);
107
107
  osc.stop(0.2);
@@ -110,14 +110,13 @@ describe("ToneOscillatorNode", () => {
110
110
  osc.dispose();
111
111
  wasInvoked = true;
112
112
  };
113
- }, 0.3).then(() => {
114
- expect(wasInvoked).to.equal(true);
115
- });
113
+ }, 0.3);
114
+ expect(wasInvoked).to.equal(true);
116
115
  });
117
116
 
118
- it("invokes the onended callback only once in offline context", () => {
117
+ it("invokes the onended callback only once in offline context", async () => {
119
118
  let wasInvoked = false;
120
- return Offline(() => {
119
+ await Offline(() => {
121
120
  const osc = new ToneOscillatorNode();
122
121
  osc.start(0);
123
122
  osc.stop(0.1);
@@ -129,9 +128,8 @@ describe("ToneOscillatorNode", () => {
129
128
  expect(wasInvoked).to.equal(false);
130
129
  wasInvoked = true;
131
130
  };
132
- }, 0.4).then(() => {
133
- expect(wasInvoked).to.equal(true);
134
- });
131
+ }, 0.4);
132
+ expect(wasInvoked).to.equal(true);
135
133
  });
136
134
  });
137
135
 
@@ -145,27 +143,25 @@ describe("ToneOscillatorNode", () => {
145
143
  osc.dispose();
146
144
  });
147
145
 
148
- it("can play for a specific duration", () => {
149
- return Offline(() => {
146
+ it("can play for a specific duration", async () => {
147
+ const buffer = await Offline(() => {
150
148
  const osc = new ToneOscillatorNode().toDestination();
151
149
  osc.start(0).stop(0.1);
152
- }, 0.4).then((buffer) => {
153
- expect(buffer.getRmsAtTime(0)).to.be.above(0);
154
- expect(buffer.getRmsAtTime(0.09)).to.be.above(0);
155
- expect(buffer.getRmsAtTime(0.1)).to.equal(0);
156
- });
150
+ }, 0.4);
151
+ expect(buffer.getRmsAtTime(0)).to.be.above(0);
152
+ expect(buffer.getRmsAtTime(0.09)).to.be.above(0);
153
+ expect(buffer.getRmsAtTime(0.1)).to.equal(0);
157
154
  });
158
155
 
159
- it("can call stop multiple times and takes the last value", () => {
160
- return Offline(() => {
156
+ it("can call stop multiple times and takes the last value", async () => {
157
+ const buffer = await Offline(() => {
161
158
  const osc = new ToneOscillatorNode().toDestination();
162
159
  osc.start(0).stop(0.1).stop(0.2);
163
- }, 0.4).then((buffer) => {
164
- expect(buffer.getRmsAtTime(0)).to.be.above(0);
165
- expect(buffer.getRmsAtTime(0.1)).to.be.above(0);
166
- expect(buffer.getRmsAtTime(0.19)).to.be.above(0);
167
- expect(buffer.getRmsAtTime(0.2)).to.equal(0);
168
- });
160
+ }, 0.4);
161
+ expect(buffer.getRmsAtTime(0)).to.be.above(0);
162
+ expect(buffer.getRmsAtTime(0.1)).to.be.above(0);
163
+ expect(buffer.getRmsAtTime(0.19)).to.be.above(0);
164
+ expect(buffer.getRmsAtTime(0.2)).to.equal(0);
169
165
  });
170
166
 
171
167
  it("clamps start time to the currentTime", () => {
@@ -196,8 +192,8 @@ describe("ToneOscillatorNode", () => {
196
192
  });
197
193
 
198
194
  context("State", () => {
199
- it("reports the right state", () => {
200
- return Offline(() => {
195
+ it("reports the right state", async () => {
196
+ await Offline(() => {
201
197
  const osc = new ToneOscillatorNode();
202
198
  osc.start(0);
203
199
  osc.stop(0.05);
@@ -212,8 +208,8 @@ describe("ToneOscillatorNode", () => {
212
208
  }, 0.1);
213
209
  });
214
210
 
215
- it("can call stop multiple times, takes the last value", () => {
216
- return Offline(() => {
211
+ it("can call stop multiple times, takes the last value", async () => {
212
+ await Offline(() => {
217
213
  const osc = new ToneOscillatorNode();
218
214
  osc.start(0);
219
215
  osc.stop(0.05);
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "15.2.0";
1
+ export const version: string = "15.2.2";