tone 15.2.2 → 15.2.4
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/Analyser.ts +11 -11
- package/Tone/component/analysis/MeterBase.ts +1 -1
- package/Tone/component/envelope/Envelope.ts +1 -1
- package/Tone/component/filter/LowpassCombFilter.ts +1 -1
- package/Tone/core/clock/Clock.test.ts +9 -9
- package/Tone/core/clock/TickParam.ts +1 -1
- package/Tone/core/clock/TickSignal.test.ts +6 -6
- package/Tone/core/clock/TickSource.test.ts +1 -1
- package/Tone/core/context/Context.ts +1 -1
- package/Tone/core/context/ToneAudioBuffer.test.ts +1 -1
- package/Tone/core/context/ToneAudioBuffers.test.ts +1 -1
- package/Tone/core/context/ToneAudioBuffers.ts +2 -2
- package/Tone/core/type/Frequency.test.ts +6 -6
- package/Tone/core/type/Ticks.test.ts +1 -1
- package/Tone/core/type/Time.test.ts +2 -2
- package/Tone/core/type/TransportTime.test.ts +1 -1
- package/Tone/core/util/IntervalTimeline.test.ts +1 -1
- package/Tone/core/util/IntervalTimeline.ts +1 -1
- package/Tone/core/util/StateTimeline.test.ts +2 -2
- package/Tone/core/util/Timeline.test.ts +1 -1
- package/Tone/core/util/Timeline.ts +1 -1
- package/Tone/effect/AutoWah.ts +1 -1
- package/Tone/effect/FrequencyShifter.ts +1 -1
- package/Tone/effect/MidSideEffect.ts +1 -1
- package/Tone/effect/StereoWidener.ts +1 -1
- package/Tone/effect/Vibrato.ts +1 -1
- package/Tone/event/Part.test.ts +6 -6
- package/Tone/event/Part.ts +5 -5
- package/Tone/event/Sequence.test.ts +3 -3
- package/Tone/event/Sequence.ts +1 -1
- package/Tone/instrument/Instrument.ts +1 -1
- package/Tone/instrument/PolySynth.ts +1 -1
- package/Tone/instrument/Synth.test.ts +1 -1
- package/Tone/signal/Multiply.test.ts +1 -1
- package/Tone/signal/Negate.test.ts +2 -2
- package/Tone/signal/Signal.ts +1 -1
- package/Tone/source/Source.test.ts +1 -1
- package/Tone/source/UserMedia.test.ts +1 -2
- package/Tone/source/buffer/Players.ts +1 -1
- package/Tone/source/oscillator/OmniOscillator.ts +0 -1
- package/Tone/version.ts +1 -1
- package/build/Tone.js +1 -1
- package/build/Tone.js.map +1 -1
- package/build/esm/component/analysis/Analyser.d.ts +1 -1
- package/build/esm/component/analysis/Analyser.js +11 -11
- package/build/esm/component/analysis/MeterBase.d.ts +1 -1
- package/build/esm/component/envelope/Envelope.d.ts +1 -1
- package/build/esm/component/filter/LowpassCombFilter.d.ts +1 -1
- package/build/esm/core/clock/TickParam.js +1 -1
- package/build/esm/core/clock/TickParam.js.map +1 -1
- package/build/esm/core/context/Context.d.ts +1 -1
- package/build/esm/core/context/Context.js +1 -1
- package/build/esm/core/context/ToneAudioBuffers.d.ts +2 -2
- package/build/esm/core/context/ToneAudioBuffers.js +2 -2
- package/build/esm/core/util/IntervalTimeline.d.ts +1 -1
- package/build/esm/core/util/IntervalTimeline.js +1 -1
- package/build/esm/core/util/Timeline.d.ts +1 -1
- package/build/esm/core/util/Timeline.js +1 -1
- package/build/esm/effect/AutoWah.d.ts +1 -1
- package/build/esm/effect/FrequencyShifter.d.ts +1 -1
- package/build/esm/effect/FrequencyShifter.js +1 -1
- package/build/esm/effect/MidSideEffect.d.ts +1 -1
- package/build/esm/effect/MidSideEffect.js +1 -1
- package/build/esm/effect/StereoWidener.d.ts +1 -1
- package/build/esm/effect/StereoWidener.js +1 -1
- package/build/esm/effect/Vibrato.js +1 -1
- package/build/esm/effect/Vibrato.js.map +1 -1
- package/build/esm/event/Part.d.ts +2 -2
- package/build/esm/event/Part.js +5 -5
- package/build/esm/event/Part.js.map +1 -1
- package/build/esm/event/Sequence.d.ts +1 -1
- package/build/esm/instrument/Instrument.d.ts +1 -1
- package/build/esm/instrument/PolySynth.d.ts +1 -1
- package/build/esm/instrument/PolySynth.js +1 -1
- package/build/esm/signal/Signal.d.ts +1 -1
- package/build/esm/signal/Signal.js +1 -1
- package/build/esm/source/buffer/Players.d.ts +1 -1
- package/build/esm/source/buffer/Players.js +1 -1
- package/build/esm/source/oscillator/OmniOscillator.js +0 -1
- package/build/esm/source/oscillator/OmniOscillator.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/package.json +3 -1
|
@@ -33,7 +33,7 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
33
33
|
/**
|
|
34
34
|
* The analyser node.
|
|
35
35
|
*/
|
|
36
|
-
private
|
|
36
|
+
private _analyzers: AnalyserNode[] = [];
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Input and output are a gain node
|
|
@@ -81,10 +81,10 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
81
81
|
|
|
82
82
|
assertRange(options.channels, 1);
|
|
83
83
|
|
|
84
|
-
// create the
|
|
84
|
+
// create the analyzers
|
|
85
85
|
for (let channel = 0; channel < options.channels; channel++) {
|
|
86
|
-
this.
|
|
87
|
-
this._split.connect(this.
|
|
86
|
+
this._analyzers[channel] = this.context.createAnalyser();
|
|
87
|
+
this._split.connect(this._analyzers[channel], channel, 0);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// set the values initially
|
|
@@ -109,7 +109,7 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
109
109
|
* represents the analysis done on a channel.
|
|
110
110
|
*/
|
|
111
111
|
getValue(): Float32Array | Float32Array[] {
|
|
112
|
-
this.
|
|
112
|
+
this._analyzers.forEach((analyser, index) => {
|
|
113
113
|
const buffer = this._buffers[index];
|
|
114
114
|
if (this._type === "fft") {
|
|
115
115
|
analyser.getFloatFrequencyData(buffer);
|
|
@@ -128,10 +128,10 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
128
128
|
* The size of analysis. This must be a power of two in the range 16 to 16384.
|
|
129
129
|
*/
|
|
130
130
|
get size(): PowerOfTwo {
|
|
131
|
-
return this.
|
|
131
|
+
return this._analyzers[0].frequencyBinCount;
|
|
132
132
|
}
|
|
133
133
|
set size(size: PowerOfTwo) {
|
|
134
|
-
this.
|
|
134
|
+
this._analyzers.forEach((analyser, index) => {
|
|
135
135
|
analyser.fftSize = size * 2;
|
|
136
136
|
this._buffers[index] = new Float32Array(size);
|
|
137
137
|
});
|
|
@@ -142,7 +142,7 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
142
142
|
* separation is done using {@link Split}
|
|
143
143
|
*/
|
|
144
144
|
get channels(): number {
|
|
145
|
-
return this.
|
|
145
|
+
return this._analyzers.length;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
@@ -163,10 +163,10 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
163
163
|
* 0 represents no time averaging with the last analysis frame.
|
|
164
164
|
*/
|
|
165
165
|
get smoothing(): NormalRange {
|
|
166
|
-
return this.
|
|
166
|
+
return this._analyzers[0].smoothingTimeConstant;
|
|
167
167
|
}
|
|
168
168
|
set smoothing(val: NormalRange) {
|
|
169
|
-
this.
|
|
169
|
+
this._analyzers.forEach((a) => (a.smoothingTimeConstant = val));
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/**
|
|
@@ -174,7 +174,7 @@ export class Analyser extends ToneAudioNode<AnalyserOptions> {
|
|
|
174
174
|
*/
|
|
175
175
|
dispose(): this {
|
|
176
176
|
super.dispose();
|
|
177
|
-
this.
|
|
177
|
+
this._analyzers.forEach((a) => a.disconnect());
|
|
178
178
|
this._split.dispose();
|
|
179
179
|
this._gain.dispose();
|
|
180
180
|
return this;
|
|
@@ -116,7 +116,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* After triggerRelease is called, the envelope's
|
|
119
|
-
* value will fall to
|
|
119
|
+
* value will fall to its minimum value over the
|
|
120
120
|
* duration of the release time.
|
|
121
121
|
* ```
|
|
122
122
|
* /\
|
|
@@ -51,7 +51,7 @@ export class LowpassCombFilter extends ToneAudioNode<LowpassCombFilterOptions> {
|
|
|
51
51
|
/**
|
|
52
52
|
* @param delayTime The delay time of the comb filter
|
|
53
53
|
* @param resonance The resonance (feedback) of the comb filter
|
|
54
|
-
* @param dampening The cutoff of the lowpass filter dampens the signal as it is
|
|
54
|
+
* @param dampening The cutoff of the lowpass filter dampens the signal as it is fed back.
|
|
55
55
|
*/
|
|
56
56
|
constructor(
|
|
57
57
|
delayTime?: Time,
|
|
@@ -163,37 +163,37 @@ describe("Clock", () => {
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it("can be scheduled to start in the future", async () => {
|
|
166
|
-
let
|
|
166
|
+
let invocations = 0;
|
|
167
167
|
await Offline(() => {
|
|
168
168
|
const clock = new Clock((time) => {
|
|
169
|
-
|
|
169
|
+
invocations++;
|
|
170
170
|
}, 2).start(0.1);
|
|
171
171
|
}, 0.4);
|
|
172
|
-
expect(
|
|
172
|
+
expect(invocations).to.equal(1);
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
it("invokes the right number of callbacks given the duration", async () => {
|
|
176
|
-
let
|
|
176
|
+
let invocations = 0;
|
|
177
177
|
await Offline(() => {
|
|
178
178
|
new Clock((time) => {
|
|
179
|
-
|
|
179
|
+
invocations++;
|
|
180
180
|
}, 10)
|
|
181
181
|
.start(0)
|
|
182
182
|
.stop(0.45);
|
|
183
183
|
}, 0.6);
|
|
184
|
-
expect(
|
|
184
|
+
expect(invocations).to.equal(5);
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
it("can schedule the frequency of the clock", async () => {
|
|
188
|
-
let
|
|
188
|
+
let invocations = 0;
|
|
189
189
|
await Offline(() => {
|
|
190
190
|
const clock = new Clock((time, ticks) => {
|
|
191
|
-
|
|
191
|
+
invocations++;
|
|
192
192
|
}, 2);
|
|
193
193
|
clock.start(0).stop(1.01);
|
|
194
194
|
clock.frequency.setValueAtTime(4, 0.5);
|
|
195
195
|
}, 2);
|
|
196
|
-
expect(
|
|
196
|
+
expect(invocations).to.equal(4);
|
|
197
197
|
});
|
|
198
198
|
});
|
|
199
199
|
|
|
@@ -128,7 +128,7 @@ export class TickParam<
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
exponentialRampToValueAtTime(value: UnitMap[TypeName], time: Time): this {
|
|
131
|
-
//
|
|
131
|
+
// approximate it with multiple linear ramps
|
|
132
132
|
time = this.toSeconds(time);
|
|
133
133
|
const computedVal = this._fromType(value);
|
|
134
134
|
|
|
@@ -152,12 +152,12 @@ describe("TickSignal", () => {
|
|
|
152
152
|
expect(tickSignal0.getTimeOfTick(3)).to.be.closeTo(3, 0.01);
|
|
153
153
|
tickSignal0.dispose();
|
|
154
154
|
|
|
155
|
-
const
|
|
156
|
-
expect(
|
|
157
|
-
expect(
|
|
158
|
-
expect(
|
|
159
|
-
expect(
|
|
160
|
-
|
|
155
|
+
const tickSignal = new TickSignal(2);
|
|
156
|
+
expect(tickSignal.getTimeOfTick(0)).to.be.closeTo(0, 0.01);
|
|
157
|
+
expect(tickSignal.getTimeOfTick(1)).to.be.closeTo(0.5, 0.01);
|
|
158
|
+
expect(tickSignal.getTimeOfTick(2)).to.be.closeTo(1, 0.01);
|
|
159
|
+
expect(tickSignal.getTimeOfTick(3)).to.be.closeTo(1.5, 0.01);
|
|
160
|
+
tickSignal.dispose();
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
it("computes the time of a given tick when setValueAtTime is scheduled", () => {
|
|
@@ -149,7 +149,7 @@ describe("TickSource", () => {
|
|
|
149
149
|
source.dispose();
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
it("can invoke stop multiple times, takes the last
|
|
152
|
+
it("can invoke stop multiple times, takes the last invocation", () => {
|
|
153
153
|
const source = new TickSource(1);
|
|
154
154
|
source.start(0).stop(3).stop(2).stop(4);
|
|
155
155
|
expect(source.getTicksAtTime(0)).to.be.closeTo(0, 0.01);
|
|
@@ -394,7 +394,7 @@ export class Context extends BaseContext {
|
|
|
394
394
|
/**
|
|
395
395
|
* How often the interval callback is invoked.
|
|
396
396
|
* This number corresponds to how responsive the scheduling
|
|
397
|
-
* can be. Setting to 0 will result in the lowest
|
|
397
|
+
* can be. Setting to 0 will result in the lowest practical interval
|
|
398
398
|
* based on context properties. context.updateInterval + context.lookAhead
|
|
399
399
|
* gives you the total latency between scheduling an event and hearing it.
|
|
400
400
|
*/
|
|
@@ -268,7 +268,7 @@ describe("ToneAudioBuffer", () => {
|
|
|
268
268
|
buffer.dispose();
|
|
269
269
|
});
|
|
270
270
|
|
|
271
|
-
it("can convert from a
|
|
271
|
+
it("can convert from a multidimensional array", () => {
|
|
272
272
|
const buffer = new ToneAudioBuffer();
|
|
273
273
|
const arr = [
|
|
274
274
|
new Float32Array(0.5 * buffer.sampleRate),
|
|
@@ -38,7 +38,7 @@ describe("ToneAudioBuffers", () => {
|
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
it("throws an error when it tries to get an object that
|
|
41
|
+
it("throws an error when it tries to get an object that doesn't exist", (done) => {
|
|
42
42
|
const buffer = new ToneAudioBuffers(
|
|
43
43
|
{
|
|
44
44
|
sine: testFile,
|
|
@@ -18,7 +18,7 @@ interface ToneAudioBuffersOptions {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* A data structure for holding multiple buffers in a Map-like
|
|
21
|
+
* A data structure for holding multiple buffers in a Map-like data structure.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* const pianoSamples = new Tone.ToneAudioBuffers({
|
|
@@ -141,7 +141,7 @@ export class ToneAudioBuffers extends Tone {
|
|
|
141
141
|
/**
|
|
142
142
|
* Add a buffer by name and url to the Buffers
|
|
143
143
|
* @param name A unique name to give the buffer
|
|
144
|
-
* @param url Either the url of the
|
|
144
|
+
* @param url Either the url of the buffer, or a buffer which will be added with the given name.
|
|
145
145
|
* @param callback The callback to invoke when the url is loaded.
|
|
146
146
|
* @param onerror Invoked if the buffer can't be loaded
|
|
147
147
|
*/
|
|
@@ -112,27 +112,27 @@ describe("FrequencyClass", () => {
|
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
it("
|
|
115
|
+
it("evaluates hertz", () => {
|
|
116
116
|
expect(Frequency("1hz").valueOf()).to.equal(1);
|
|
117
117
|
expect(Frequency("2hz").valueOf()).to.equal(2);
|
|
118
118
|
expect(Frequency(4, "hz").valueOf()).to.equal(4);
|
|
119
119
|
expect(Frequency("0.25hz").valueOf()).to.equal(0.25);
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
it("
|
|
122
|
+
it("evaluates ticks", () => {
|
|
123
123
|
return Offline(({ transport }) => {
|
|
124
124
|
expect(Frequency(transport.PPQ, "i").valueOf()).to.equal(2);
|
|
125
125
|
expect(Frequency(1, "i").valueOf()).to.equal(transport.PPQ * 2);
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
it("
|
|
129
|
+
it("evaluates transport time", () => {
|
|
130
130
|
expect(Frequency("1:0").valueOf()).to.equal(0.5);
|
|
131
131
|
expect(Frequency("1:4:0").valueOf()).to.equal(0.25);
|
|
132
132
|
// expect(Frequency("2:1:0").valueOf()).to.equal(0.25);
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
it("
|
|
135
|
+
it("evaluates midi", () => {
|
|
136
136
|
expect(Frequency(48, "midi").valueOf()).to.be.closeTo(
|
|
137
137
|
TonalMidi.midiToFreq(48),
|
|
138
138
|
0.0001
|
|
@@ -143,7 +143,7 @@ describe("FrequencyClass", () => {
|
|
|
143
143
|
);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
it("
|
|
146
|
+
it("evaluates hz", () => {
|
|
147
147
|
expect(Frequency(48, "hz").valueOf()).to.equal(48);
|
|
148
148
|
expect(Frequency(480, "hz").valueOf()).to.equal(480);
|
|
149
149
|
});
|
|
@@ -218,7 +218,7 @@ describe("FrequencyClass", () => {
|
|
|
218
218
|
);
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
-
it("can
|
|
221
|
+
it("can accommodate different concert tuning", () => {
|
|
222
222
|
FrequencyClass.A4 = 444;
|
|
223
223
|
expect(Frequency("C4").valueOf()).to.be.closeTo(
|
|
224
224
|
TonalMidi.midiToFreq(
|
|
@@ -133,7 +133,7 @@ describe("TicksClass", () => {
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
it("can get the next
|
|
136
|
+
it("can get the next subdivision when the transport is started", () => {
|
|
137
137
|
return Offline((context) => {
|
|
138
138
|
const transport = context.transport;
|
|
139
139
|
transport.start();
|
|
@@ -72,7 +72,7 @@ describe("TimeClass", () => {
|
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
it("
|
|
75
|
+
it("evaluates objects", () => {
|
|
76
76
|
return Offline(() => {
|
|
77
77
|
expect(Time({ "4n": 3 }).valueOf()).to.equal(1.5);
|
|
78
78
|
expect(Time({ "8t": 2, "1m": 3 }).valueOf()).to.be.closeTo(
|
|
@@ -98,7 +98,7 @@ describe("TimeClass", () => {
|
|
|
98
98
|
expect(Time(2).quantize(8, 0.75).valueOf()).to.equal(0.5);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
it("can get the next
|
|
101
|
+
it("can get the next subdivision when the transport is started", () => {
|
|
102
102
|
return Offline((context) => {
|
|
103
103
|
const transport = context.transport;
|
|
104
104
|
transport.start(0.1);
|
|
@@ -116,7 +116,7 @@ describe("TransportTimeClass", () => {
|
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
it("can get the next
|
|
119
|
+
it("can get the next subdivision when the transport is started", () => {
|
|
120
120
|
return Offline((context) => {
|
|
121
121
|
const transport = context.transport;
|
|
122
122
|
transport.start();
|
|
@@ -26,7 +26,7 @@ describe("IntervalTimeline", () => {
|
|
|
26
26
|
sched.dispose();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it("computes the
|
|
29
|
+
it("computes the length of the timeline correctly after adding events", () => {
|
|
30
30
|
const sched = new IntervalTimeline();
|
|
31
31
|
sched.add({
|
|
32
32
|
duration: 0.2,
|
|
@@ -51,7 +51,7 @@ describe("StateTimeline", () => {
|
|
|
51
51
|
sched.dispose();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
it("gets the last
|
|
54
|
+
it("gets the last occurrence of the state at or before the given time", () => {
|
|
55
55
|
const sched = new StateTimeline();
|
|
56
56
|
sched.setStateAtTime("started", 0);
|
|
57
57
|
sched.setStateAtTime("stopped", 1);
|
|
@@ -68,7 +68,7 @@ describe("StateTimeline", () => {
|
|
|
68
68
|
sched.dispose();
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
it("gets the next
|
|
71
|
+
it("gets the next occurrence of the state at or before the given time", () => {
|
|
72
72
|
const sched = new StateTimeline();
|
|
73
73
|
sched.setStateAtTime("started", 0);
|
|
74
74
|
sched.setStateAtTime("stopped", 1);
|
|
@@ -348,7 +348,7 @@ export class Timeline<GenericEvent extends TimelineEvent> extends Tone {
|
|
|
348
348
|
|
|
349
349
|
/**
|
|
350
350
|
* Iterate over everything in the array between the startTime and endTime.
|
|
351
|
-
* The
|
|
351
|
+
* The time range is inclusive of the startTime, but exclusive of the endTime.
|
|
352
352
|
* range = [startTime, endTime).
|
|
353
353
|
* @param startTime The time to check if items are before
|
|
354
354
|
* @param endTime The end of the test interval.
|
package/Tone/effect/AutoWah.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface FrequencyShifterOptions extends EffectOptions {
|
|
|
20
20
|
* Note: Contrary to pitch shifting, all frequencies are shifted by the same amount,
|
|
21
21
|
* destroying the harmonic relationship between them. This leads to the classic ring modulator timbre distortion.
|
|
22
22
|
* The algorithm will produces some aliasing towards the high end, especially if your source material
|
|
23
|
-
* contains a lot of high frequencies.
|
|
23
|
+
* contains a lot of high frequencies. Unfortunately the Web Audio API does not support resampling
|
|
24
24
|
* buffers in real time, so it is not possible to fix it properly. Depending on the use case it might
|
|
25
25
|
* be an option to low pass filter your input before frequency shifting it to get ride of the aliasing.
|
|
26
26
|
* You can find a very detailed description of the algorithm here: https://larzeitlin.github.io/RMFS/
|
|
@@ -10,7 +10,7 @@ export type MidSideEffectOptions = EffectOptions;
|
|
|
10
10
|
* (which comes out of both the left and the right channel)
|
|
11
11
|
* and the 'side' (which only comes out of the the side channels)
|
|
12
12
|
* and effects them separately before being recombined.
|
|
13
|
-
* Applies a Mid/Side
|
|
13
|
+
* Applies a Mid/Side separation and recombination.
|
|
14
14
|
* Algorithm found in [kvraudio forums](http://www.kvraudio.com/forum/viewtopic.php?t=212587).
|
|
15
15
|
* This is a base-class for Mid/Side Effects.
|
|
16
16
|
* @category Effect
|
|
@@ -15,7 +15,7 @@ export interface StereoWidenerOptions extends MidSideEffectOptions {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Applies a width factor to the mid/side
|
|
18
|
+
* Applies a width factor to the mid/side separation.
|
|
19
19
|
* 0 is all mid and 1 is all side.
|
|
20
20
|
* Algorithm found in [kvraudio forums](http://www.kvraudio.com/forum/viewtopic.php?t=212587).
|
|
21
21
|
* ```
|
package/Tone/effect/Vibrato.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class Vibrato extends Effect<VibratoOptions> {
|
|
|
65
65
|
min: 0,
|
|
66
66
|
max: options.maxDelay,
|
|
67
67
|
frequency: options.frequency,
|
|
68
|
-
phase: -90, //
|
|
68
|
+
phase: -90, // offset the phase so the resting position is in the center
|
|
69
69
|
})
|
|
70
70
|
.start()
|
|
71
71
|
.connect(this._delayNode.delayTime);
|
package/Tone/event/Part.test.ts
CHANGED
|
@@ -301,14 +301,14 @@ describe("Part", () => {
|
|
|
301
301
|
});
|
|
302
302
|
|
|
303
303
|
it("is invoked after it's started", async () => {
|
|
304
|
-
let
|
|
304
|
+
let invocations = 0;
|
|
305
305
|
await Offline(({ transport }) => {
|
|
306
306
|
const part = new Part(() => {
|
|
307
|
-
|
|
307
|
+
invocations++;
|
|
308
308
|
}, [0, 0.1]).start(0);
|
|
309
309
|
transport.start();
|
|
310
310
|
}, 0.2);
|
|
311
|
-
expect(
|
|
311
|
+
expect(invocations).to.equal(2);
|
|
312
312
|
});
|
|
313
313
|
|
|
314
314
|
it("passes in the scheduled time to the callback", async () => {
|
|
@@ -421,7 +421,7 @@ describe("Part", () => {
|
|
|
421
421
|
});
|
|
422
422
|
|
|
423
423
|
it("can schedule a subpart", async () => {
|
|
424
|
-
let
|
|
424
|
+
let invocations = 0;
|
|
425
425
|
await Offline(({ transport }) => {
|
|
426
426
|
const startTime = 0.1;
|
|
427
427
|
const subPart = new Part({
|
|
@@ -431,7 +431,7 @@ describe("Part", () => {
|
|
|
431
431
|
],
|
|
432
432
|
});
|
|
433
433
|
const part = new Part((time, value) => {
|
|
434
|
-
|
|
434
|
+
invocations++;
|
|
435
435
|
if (value === 0) {
|
|
436
436
|
expect(time - startTime).to.be.closeTo(0, 0.01);
|
|
437
437
|
} else if (value === 1) {
|
|
@@ -446,7 +446,7 @@ describe("Part", () => {
|
|
|
446
446
|
.start(0);
|
|
447
447
|
transport.start(startTime);
|
|
448
448
|
}, 0.7);
|
|
449
|
-
expect(
|
|
449
|
+
expect(invocations).to.equal(3);
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
it("can start with an offset", async () => {
|
package/Tone/event/Part.ts
CHANGED
|
@@ -384,10 +384,10 @@ export class Part<ValueType = any> extends ToneEvent<ValueType> {
|
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
386
|
* Determine if the event should be currently looping
|
|
387
|
-
* given the loop
|
|
387
|
+
* given the loop boundaries of this Part.
|
|
388
388
|
* @param event The event to test
|
|
389
389
|
*/
|
|
390
|
-
private
|
|
390
|
+
private _testLoopBoundaries(event: ToneEvent): void {
|
|
391
391
|
if (
|
|
392
392
|
this._loop &&
|
|
393
393
|
(event.startOffset < this._loopStart ||
|
|
@@ -439,7 +439,7 @@ export class Part<ValueType = any> extends ToneEvent<ValueType> {
|
|
|
439
439
|
event.loopStart = this.loopStart;
|
|
440
440
|
event.loopEnd = this.loopEnd;
|
|
441
441
|
event.loop = loop;
|
|
442
|
-
this.
|
|
442
|
+
this._testLoopBoundaries(event);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
|
|
@@ -455,7 +455,7 @@ export class Part<ValueType = any> extends ToneEvent<ValueType> {
|
|
|
455
455
|
if (this._loop) {
|
|
456
456
|
this._forEach((event) => {
|
|
457
457
|
event.loopEnd = loopEnd;
|
|
458
|
-
this.
|
|
458
|
+
this._testLoopBoundaries(event);
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
}
|
|
@@ -472,7 +472,7 @@ export class Part<ValueType = any> extends ToneEvent<ValueType> {
|
|
|
472
472
|
if (this._loop) {
|
|
473
473
|
this._forEach((event) => {
|
|
474
474
|
event.loopStart = this.loopStart;
|
|
475
|
-
this.
|
|
475
|
+
this._testLoopBoundaries(event);
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
}
|
|
@@ -353,7 +353,7 @@ describe("Sequence", () => {
|
|
|
353
353
|
});
|
|
354
354
|
|
|
355
355
|
it("can loop between loopStart and loopEnd", async () => {
|
|
356
|
-
let
|
|
356
|
+
let invocations = 0;
|
|
357
357
|
await Offline(({ transport }) => {
|
|
358
358
|
const seq = new Sequence({
|
|
359
359
|
events: [0, [1, 2, 3], [4, 5]],
|
|
@@ -363,12 +363,12 @@ describe("Sequence", () => {
|
|
|
363
363
|
callback(time, value): void {
|
|
364
364
|
expect(value).to.be.at.least(1);
|
|
365
365
|
expect(value).to.be.at.most(3);
|
|
366
|
-
|
|
366
|
+
invocations++;
|
|
367
367
|
},
|
|
368
368
|
}).start(0);
|
|
369
369
|
transport.start();
|
|
370
370
|
}, 0.7);
|
|
371
|
-
expect(
|
|
371
|
+
expect(invocations).to.equal(9);
|
|
372
372
|
});
|
|
373
373
|
|
|
374
374
|
it("can set the loop points after starting", async () => {
|
package/Tone/event/Sequence.ts
CHANGED
|
@@ -187,7 +187,7 @@ export class PolySynth<
|
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* Invoked when the source is done making sound, so that it can be
|
|
190
|
-
*
|
|
190
|
+
* re-added to the pool of available voices
|
|
191
191
|
*/
|
|
192
192
|
private _makeVoiceAvailable(voice: Voice): void {
|
|
193
193
|
this._availableVoices.push(voice);
|
|
@@ -79,7 +79,7 @@ describe("Synth", () => {
|
|
|
79
79
|
simple.dispose();
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
it("can get does not include
|
|
82
|
+
it("can get does not include omitted oscillator attributes", () => {
|
|
83
83
|
const simple = new Synth();
|
|
84
84
|
expect(simple.get().oscillator).to.not.have.key("frequency");
|
|
85
85
|
expect(simple.get().oscillator).to.not.have.key("detune");
|
|
@@ -20,7 +20,7 @@ describe("Multiply", () => {
|
|
|
20
20
|
mult.dispose();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it("correctly
|
|
23
|
+
it("correctly multiplies a signal and a scalar", () => {
|
|
24
24
|
return ConstantOutput(() => {
|
|
25
25
|
const signal = new Signal(2);
|
|
26
26
|
const mult = new Multiply(10);
|
|
@@ -7,7 +7,7 @@ describe("Negate", () => {
|
|
|
7
7
|
BasicTests(Negate);
|
|
8
8
|
|
|
9
9
|
context("Negating", () => {
|
|
10
|
-
it("
|
|
10
|
+
it("negates a positive value", () => {
|
|
11
11
|
return ConstantOutput(() => {
|
|
12
12
|
const signal = new Signal(1);
|
|
13
13
|
const negate = new Negate();
|
|
@@ -16,7 +16,7 @@ describe("Negate", () => {
|
|
|
16
16
|
}, -1);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it("makes a
|
|
19
|
+
it("makes a negative value positive", () => {
|
|
20
20
|
return ConstantOutput(() => {
|
|
21
21
|
const signal = new Signal(-10);
|
|
22
22
|
const negate = new Negate();
|
package/Tone/signal/Signal.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface SignalOptions<TypeName extends UnitName>
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* const osc = new Tone.Oscillator().toDestination().start();
|
|
34
|
-
* // a
|
|
34
|
+
* // a schedulable signal which can be connected to control an AudioParam or another Signal
|
|
35
35
|
* const signal = new Tone.Signal({
|
|
36
36
|
* value: "C4",
|
|
37
37
|
* units: "frequency"
|
|
@@ -99,8 +99,7 @@ describe("UserMedia", () => {
|
|
|
99
99
|
return extIn
|
|
100
100
|
.open("doesn't exist")
|
|
101
101
|
.then(() => {
|
|
102
|
-
|
|
103
|
-
throw new Error("shouldnt call 'then'");
|
|
102
|
+
throw new Error("shouldn't call 'then'");
|
|
104
103
|
})
|
|
105
104
|
.catch(() => {
|
|
106
105
|
extIn.dispose();
|