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
|
@@ -89,16 +89,15 @@ describe("BiquadFilter", () => {
|
|
|
89
89
|
filter.dispose();
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
it("attenuates the incoming signal", () => {
|
|
93
|
-
|
|
92
|
+
it("attenuates the incoming signal", async () => {
|
|
93
|
+
const buffer = await Offline(() => {
|
|
94
94
|
const filter = new BiquadFilter(700, "lowpass").toDestination();
|
|
95
95
|
filter.Q.value = 0;
|
|
96
96
|
const osc = new Oscillator(880).connect(filter);
|
|
97
97
|
osc.start(0);
|
|
98
|
-
}, 0.2)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
98
|
+
}, 0.2);
|
|
99
|
+
expect(buffer.getRmsAtTime(0.05)).to.be.within(0.37, 0.53);
|
|
100
|
+
expect(buffer.getRmsAtTime(0.1)).to.be.within(0.37, 0.53);
|
|
102
101
|
});
|
|
103
102
|
});
|
|
104
103
|
});
|
|
@@ -41,19 +41,16 @@ describe("Convolver", () => {
|
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
it("load returns a Promise", (
|
|
44
|
+
it("load returns a Promise", async () => {
|
|
45
45
|
const convolver = new Convolver();
|
|
46
|
-
convolver.load(testFile)
|
|
47
|
-
|
|
48
|
-
done();
|
|
49
|
-
});
|
|
46
|
+
await convolver.load(testFile);
|
|
47
|
+
convolver.dispose();
|
|
50
48
|
});
|
|
51
49
|
|
|
52
|
-
it("load invokes the second callback", () => {
|
|
50
|
+
it("load invokes the second callback", async () => {
|
|
53
51
|
const convolver = new Convolver();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
52
|
+
await convolver.load(testFile);
|
|
53
|
+
convolver.dispose();
|
|
57
54
|
});
|
|
58
55
|
|
|
59
56
|
it("can assign the buffer twice", () => {
|
|
@@ -42,24 +42,23 @@ describe("FeedbackCombFilter", () => {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it("can delay by the delayTime", () => {
|
|
46
|
-
|
|
45
|
+
it("can delay by the delayTime", async () => {
|
|
46
|
+
const buffer = await Offline(() => {
|
|
47
47
|
const fbcf = new FeedbackCombFilter({
|
|
48
48
|
delayTime: 0.1,
|
|
49
49
|
resonance: 0,
|
|
50
50
|
}).toDestination();
|
|
51
51
|
const sig = new Signal(0).connect(fbcf);
|
|
52
52
|
sig.setValueAtTime(1, 0);
|
|
53
|
-
}, 0.2)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
53
|
+
}, 0.2);
|
|
54
|
+
expect(buffer.getValueAtTime(0)).to.equal(0);
|
|
55
|
+
expect(buffer.getValueAtTime(0.999)).to.equal(0);
|
|
56
|
+
expect(buffer.getValueAtTime(0.101)).to.equal(1);
|
|
57
|
+
expect(buffer.getValueAtTime(0.15)).to.equal(1);
|
|
59
58
|
});
|
|
60
59
|
|
|
61
|
-
it("can delay with feedback", () => {
|
|
62
|
-
|
|
60
|
+
it("can delay with feedback", async () => {
|
|
61
|
+
const buffer = await Offline(() => {
|
|
63
62
|
const fbcf = new FeedbackCombFilter({
|
|
64
63
|
delayTime: 0.1,
|
|
65
64
|
resonance: 0.5,
|
|
@@ -67,12 +66,11 @@ describe("FeedbackCombFilter", () => {
|
|
|
67
66
|
const sig = new Signal(0).connect(fbcf);
|
|
68
67
|
sig.setValueAtTime(1, 0);
|
|
69
68
|
sig.setValueAtTime(0, 0.1);
|
|
70
|
-
}, 0.4)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
69
|
+
}, 0.4);
|
|
70
|
+
expect(buffer.getValueAtTime(0)).to.equal(0);
|
|
71
|
+
expect(buffer.getValueAtTime(0.101)).to.equal(1);
|
|
72
|
+
expect(buffer.getValueAtTime(0.201)).to.equal(0.5);
|
|
73
|
+
expect(buffer.getValueAtTime(0.301)).to.equal(0.25);
|
|
76
74
|
});
|
|
77
75
|
});
|
|
78
76
|
|
|
@@ -110,16 +110,15 @@ describe("Filter", () => {
|
|
|
110
110
|
filter.dispose();
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
it("attenuates the incoming signal", () => {
|
|
114
|
-
|
|
113
|
+
it("attenuates the incoming signal", async () => {
|
|
114
|
+
const buffer = await Offline(() => {
|
|
115
115
|
const filter = new Filter(700, "lowpass").toDestination();
|
|
116
116
|
filter.Q.value = 0;
|
|
117
117
|
const osc = new Oscillator(880).connect(filter);
|
|
118
118
|
osc.start(0);
|
|
119
|
-
}, 0.2)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
119
|
+
}, 0.2);
|
|
120
|
+
expect(buffer.getRmsAtTime(0.05)).to.be.within(0.37, 0.53);
|
|
121
|
+
expect(buffer.getRmsAtTime(0.1)).to.be.within(0.37, 0.53);
|
|
123
122
|
});
|
|
124
123
|
});
|
|
125
124
|
});
|
|
@@ -41,8 +41,8 @@ describe("LowpassCombFilter", () => {
|
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
it("produces a decay signal at high resonance", () => {
|
|
45
|
-
|
|
44
|
+
it("produces a decay signal at high resonance", async () => {
|
|
45
|
+
const buffer = await Offline(() => {
|
|
46
46
|
const lpcf = new LowpassCombFilter(
|
|
47
47
|
0.01,
|
|
48
48
|
0.9,
|
|
@@ -51,27 +51,25 @@ describe("LowpassCombFilter", () => {
|
|
|
51
51
|
const burst = new Oscillator(440).connect(lpcf);
|
|
52
52
|
burst.start(0);
|
|
53
53
|
burst.stop(0.1);
|
|
54
|
-
}, 0.8)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
54
|
+
}, 0.8);
|
|
55
|
+
expect(buffer.getRmsAtTime(0.05)).to.be.within(0.2, 0.6);
|
|
56
|
+
expect(buffer.getRmsAtTime(0.1)).to.be.within(0.2, 0.6);
|
|
57
|
+
expect(buffer.getRmsAtTime(0.15)).to.be.within(0.15, 0.4);
|
|
58
|
+
expect(buffer.getRmsAtTime(0.3)).to.be.within(0.01, 0.15);
|
|
59
|
+
expect(buffer.getRmsAtTime(0.7)).to.be.below(0.01);
|
|
61
60
|
});
|
|
62
61
|
|
|
63
|
-
it("produces a decay signal at moderate resonance", () => {
|
|
64
|
-
|
|
62
|
+
it("produces a decay signal at moderate resonance", async () => {
|
|
63
|
+
const buffer = await Offline(() => {
|
|
65
64
|
const lpcf = new LowpassCombFilter(0.05, 0.5).toDestination();
|
|
66
65
|
const burst = new Oscillator(440).connect(lpcf);
|
|
67
66
|
burst.start(0);
|
|
68
67
|
burst.stop(0.1);
|
|
69
|
-
}, 0.6)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
68
|
+
}, 0.6);
|
|
69
|
+
expect(buffer.getRmsAtTime(0.05)).to.be.closeTo(0.7, 0.1);
|
|
70
|
+
expect(buffer.getRmsAtTime(0.1)).to.be.within(0.7, 1.1);
|
|
71
|
+
expect(buffer.getRmsAtTime(0.2)).to.be.closeTo(0.25, 0.1);
|
|
72
|
+
expect(buffer.getRmsAtTime(0.4)).to.be.closeTo(0.015, 0.01);
|
|
75
73
|
});
|
|
76
74
|
});
|
|
77
75
|
});
|
|
@@ -162,41 +162,38 @@ describe("Clock", () => {
|
|
|
162
162
|
clock.start(startTime);
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
it("can be scheduled to start in the future", () => {
|
|
165
|
+
it("can be scheduled to start in the future", async () => {
|
|
166
166
|
let invokations = 0;
|
|
167
|
-
|
|
167
|
+
await Offline(() => {
|
|
168
168
|
const clock = new Clock((time) => {
|
|
169
169
|
invokations++;
|
|
170
170
|
}, 2).start(0.1);
|
|
171
|
-
}, 0.4)
|
|
172
|
-
|
|
173
|
-
});
|
|
171
|
+
}, 0.4);
|
|
172
|
+
expect(invokations).to.equal(1);
|
|
174
173
|
});
|
|
175
174
|
|
|
176
|
-
it("invokes the right number of callbacks given the duration", () => {
|
|
175
|
+
it("invokes the right number of callbacks given the duration", async () => {
|
|
177
176
|
let invokations = 0;
|
|
178
|
-
|
|
177
|
+
await Offline(() => {
|
|
179
178
|
new Clock((time) => {
|
|
180
179
|
invokations++;
|
|
181
180
|
}, 10)
|
|
182
181
|
.start(0)
|
|
183
182
|
.stop(0.45);
|
|
184
|
-
}, 0.6)
|
|
185
|
-
|
|
186
|
-
});
|
|
183
|
+
}, 0.6);
|
|
184
|
+
expect(invokations).to.equal(5);
|
|
187
185
|
});
|
|
188
186
|
|
|
189
|
-
it("can schedule the frequency of the clock", () => {
|
|
187
|
+
it("can schedule the frequency of the clock", async () => {
|
|
190
188
|
let invokations = 0;
|
|
191
|
-
|
|
189
|
+
await Offline(() => {
|
|
192
190
|
const clock = new Clock((time, ticks) => {
|
|
193
191
|
invokations++;
|
|
194
192
|
}, 2);
|
|
195
193
|
clock.start(0).stop(1.01);
|
|
196
194
|
clock.frequency.setValueAtTime(4, 0.5);
|
|
197
|
-
}, 2)
|
|
198
|
-
|
|
199
|
-
});
|
|
195
|
+
}, 2);
|
|
196
|
+
expect(invokations).to.equal(4);
|
|
200
197
|
});
|
|
201
198
|
});
|
|
202
199
|
|
|
@@ -292,44 +292,41 @@ describe("TickSignal", () => {
|
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
-
it("outputs a signal", () => {
|
|
296
|
-
|
|
295
|
+
it("outputs a signal", async () => {
|
|
296
|
+
const buffer = await Offline((context) => {
|
|
297
297
|
const sched = new TickSignal(1).connect(context.destination);
|
|
298
298
|
sched.linearRampTo(3, 1, 0);
|
|
299
|
-
}, 1.01)
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
299
|
+
}, 1.01);
|
|
300
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(1, 0.01);
|
|
301
|
+
expect(buffer.getValueAtTime(0.5)).to.be.closeTo(2, 0.01);
|
|
302
|
+
expect(buffer.getValueAtTime(1)).to.be.closeTo(3, 0.01);
|
|
304
303
|
});
|
|
305
304
|
|
|
306
|
-
it("outputs a signal with bpm units", () => {
|
|
307
|
-
|
|
305
|
+
it("outputs a signal with bpm units", async () => {
|
|
306
|
+
const buffer = await Offline((context) => {
|
|
308
307
|
const sched = new TickSignal({
|
|
309
308
|
units: "bpm",
|
|
310
309
|
value: 120,
|
|
311
310
|
}).connect(context.destination);
|
|
312
311
|
sched.linearRampTo(60, 1, 0);
|
|
313
|
-
}, 1.01)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
});
|
|
312
|
+
}, 1.01);
|
|
313
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(2, 0.01);
|
|
314
|
+
expect(buffer.getValueAtTime(0.5)).to.be.closeTo(1.5, 0.01);
|
|
315
|
+
expect(buffer.getValueAtTime(1)).to.be.closeTo(1, 0.01);
|
|
318
316
|
});
|
|
319
317
|
|
|
320
|
-
it("outputs a signal with bpm units and a multiplier", () => {
|
|
321
|
-
|
|
318
|
+
it("outputs a signal with bpm units and a multiplier", async () => {
|
|
319
|
+
const buffer = await Offline((context) => {
|
|
322
320
|
const sched = new TickSignal({
|
|
323
321
|
multiplier: 10,
|
|
324
322
|
units: "bpm",
|
|
325
323
|
value: 60,
|
|
326
324
|
}).connect(context.destination);
|
|
327
325
|
sched.linearRampTo(120, 1, 0);
|
|
328
|
-
}, 1.01)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
});
|
|
326
|
+
}, 1.01);
|
|
327
|
+
expect(buffer.getValueAtTime(0)).to.be.closeTo(10, 0.01);
|
|
328
|
+
expect(buffer.getValueAtTime(0.5)).to.be.closeTo(15, 0.01);
|
|
329
|
+
expect(buffer.getValueAtTime(1)).to.be.closeTo(20, 0.01);
|
|
333
330
|
});
|
|
334
331
|
|
|
335
332
|
context("Ticks <-> Time", () => {
|