tone 14.8.49 → 14.9.1

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 (54) hide show
  1. package/README.md +2 -2
  2. package/Tone/component/analysis/Meter.ts +1 -1
  3. package/Tone/component/channel/Channel.ts +1 -1
  4. package/Tone/core/clock/TickSource.ts +2 -2
  5. package/Tone/core/clock/Ticker.ts +1 -1
  6. package/Tone/core/context/Context.ts +1 -1
  7. package/Tone/core/context/ToneAudioBuffer.ts +5 -5
  8. package/Tone/core/context/ToneAudioNode.ts +1 -1
  9. package/Tone/core/context/ToneWithContext.ts +1 -1
  10. package/Tone/core/type/Frequency.ts +2 -1
  11. package/Tone/effect/Chorus.test.ts +2 -2
  12. package/Tone/event/Loop.ts +2 -1
  13. package/Tone/fromContext.ts +1 -1
  14. package/Tone/instrument/DuoSynth.ts +1 -1
  15. package/Tone/instrument/PolySynth.ts +0 -1
  16. package/Tone/source/buffer/Player.test.ts +16 -13
  17. package/Tone/source/buffer/Players.ts +1 -1
  18. package/Tone/source/oscillator/OmniOscillator.ts +1 -1
  19. package/Tone/version.ts +1 -1
  20. package/build/Tone.js +1 -1
  21. package/build/Tone.js.map +1 -1
  22. package/build/esm/component/analysis/Meter.js.map +1 -1
  23. package/build/esm/component/channel/Channel.d.ts +1 -1
  24. package/build/esm/component/channel/Channel.js +1 -1
  25. package/build/esm/core/clock/TickSource.js +2 -2
  26. package/build/esm/core/clock/TickSource.js.map +1 -1
  27. package/build/esm/core/clock/Ticker.js.map +1 -1
  28. package/build/esm/core/context/Context.d.ts +1 -1
  29. package/build/esm/core/context/Context.js +1 -1
  30. package/build/esm/core/context/ToneAudioBuffer.js.map +1 -1
  31. package/build/esm/core/context/ToneAudioNode.d.ts +1 -1
  32. package/build/esm/core/context/ToneAudioNode.js +1 -1
  33. package/build/esm/core/context/ToneWithContext.d.ts +1 -1
  34. package/build/esm/core/context/ToneWithContext.js +1 -1
  35. package/build/esm/core/type/Frequency.js +1 -0
  36. package/build/esm/core/type/Frequency.js.map +1 -1
  37. package/build/esm/event/Loop.js +2 -1
  38. package/build/esm/event/Loop.js.map +1 -1
  39. package/build/esm/fromContext.js.map +1 -1
  40. package/build/esm/instrument/DuoSynth.d.ts +1 -1
  41. package/build/esm/instrument/DuoSynth.js +1 -1
  42. package/build/esm/instrument/PolySynth.d.ts +0 -1
  43. package/build/esm/instrument/PolySynth.js +0 -1
  44. package/build/esm/instrument/PolySynth.js.map +1 -1
  45. package/build/esm/source/UserMedia.d.ts +1 -1
  46. package/build/esm/source/buffer/Players.d.ts +1 -1
  47. package/build/esm/source/buffer/Players.js +1 -1
  48. package/build/esm/source/oscillator/OmniOscillator.d.ts +1 -1
  49. package/build/esm/source/oscillator/OmniOscillator.js +1 -1
  50. package/build/esm/version.js +1 -1
  51. package/build/esm/version.js.map +1 -1
  52. package/package.json +4 -4
  53. package/CHANGELOG.md +0 -313
  54. package/docs/tone.json +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Tone.js
2
2
  =========
3
3
 
4
- [![Build Status](https://travis-ci.com/Tonejs/Tone.js.svg?branch=dev)](https://app.travis-ci.com/github/Tonejs/Tone.js) [![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)
4
+ [![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)
5
5
 
6
6
 
7
7
  Tone.js is a Web Audio framework for creating interactive music in the browser. The architecture of Tone.js aims to be familiar to both musicians and audio programmers creating web-based audio applications. On the high-level, Tone offers common DAW (digital audio workstation) features like a global transport for synchronizing and scheduling events as well as prebuilt synths and effects. Additionally, Tone provides high-performance building blocks to create your own synthesizers, effects, and complex control signals.
@@ -12,7 +12,7 @@ Tone.js is a Web Audio framework for creating interactive music in the browser.
12
12
 
13
13
  # Installation
14
14
 
15
- There are two ways to incorporate Tone.js into a proejct. First, it can be installed locally into a project using `npm`:
15
+ There are two ways to incorporate Tone.js into a project. First, it can be installed locally into a project using `npm`:
16
16
 
17
17
  ```bash
18
18
  npm install tone // Install the latest stable version
@@ -103,7 +103,7 @@ export class Meter extends MeterBase<MeterOptions> {
103
103
  const rms = Math.sqrt(totalSquared / values.length);
104
104
  // the rms can only fall at the rate of the smoothing
105
105
  // but can jump up instantly
106
- this._rms[index] = Math.max(rms, this._rms[index] * this.smoothing);
106
+ this._rms[index] = Math.max(rms, this._rms[index] * this.smoothing);
107
107
  return this.normalRange ? this._rms[index] : gainToDb(this._rms[index]);
108
108
  });
109
109
  if (this.channels === 1) {
@@ -91,7 +91,7 @@ export class Channel extends ToneAudioNode<ChannelOptions> {
91
91
  }
92
92
 
93
93
  /**
94
- * Solo/unsolo the channel. Soloing is only relative to other [[Channels]] and [[Solo]] instances
94
+ * Solo/unsolo the channel. Soloing is only relative to other [[Channel]]s and [[Solo]] instances
95
95
  */
96
96
  get solo(): boolean {
97
97
  return this._solo.solo;
@@ -200,7 +200,7 @@ export class TickSource<TypeName extends "bpm" | "hertz"> extends ToneWithContex
200
200
  if (lastState.state === "started" && e.state !== "started") {
201
201
  elapsedTicks += this.frequency.getTicksAtTime(e.time) - this.frequency.getTicksAtTime(periodStartTime);
202
202
  // do not memoize the temporary event
203
- if (e.time != tmpEvent.time) {
203
+ if (e.time !== tmpEvent.time) {
204
204
  eventToMemoize = { state: e.state, time: e.time, ticks: elapsedTicks };
205
205
  }
206
206
  }
@@ -275,7 +275,7 @@ export class TickSource<TypeName extends "bpm" | "hertz"> extends ToneWithContex
275
275
  if (lastState.state === "started" && e.state !== "started") {
276
276
  elapsedSeconds += e.time - periodStartTime;
277
277
  // do not memoize the temporary event
278
- if (e.time != tmpEvent.time) {
278
+ if (e.time !== tmpEvent.time) {
279
279
  eventToMemoize = { state: e.state, time: e.time, seconds: elapsedSeconds };
280
280
  }
281
281
  }
@@ -42,7 +42,7 @@ export class Ticker {
42
42
 
43
43
  this._callback = callback;
44
44
  this._type = type;
45
- this._minimumUpdateInterval = Math.max( 128/(contextSampleRate || 44100), .001 );
45
+ this._minimumUpdateInterval = Math.max(128/(contextSampleRate || 44100), .001);
46
46
  this.updateInterval = updateInterval;
47
47
 
48
48
  // create the clock source for the first time
@@ -475,7 +475,7 @@ export class Context extends BaseContext {
475
475
 
476
476
  /**
477
477
  * Starts the audio context from a suspended state. This is required
478
- * to initially start the AudioContext. See [[Tone.start]]
478
+ * to initially start the AudioContext. See [[start]]
479
479
  */
480
480
  resume(): Promise<void> {
481
481
  if (isAudioContext(this._context)) {
@@ -397,9 +397,9 @@ export class ToneAudioBuffer extends Tone {
397
397
  const location = document.createElement("a");
398
398
  location.href = baseUrl + url;
399
399
  location.pathname = (location.pathname + location.hash)
400
- .split("/")
401
- .map(encodeURIComponent)
402
- .join("/");
400
+ .split("/")
401
+ .map(encodeURIComponent)
402
+ .join("/");
403
403
 
404
404
  const response = await fetch(location.href);
405
405
  if (!response.ok) {
@@ -425,8 +425,8 @@ export class ToneAudioBuffer extends Tone {
425
425
  const extensions = url.split(".");
426
426
  const extension = extensions[extensions.length - 1];
427
427
  const response = document
428
- .createElement("audio")
429
- .canPlayType("audio/" + extension);
428
+ .createElement("audio")
429
+ .canPlayType("audio/" + extension);
430
430
  return response !== "";
431
431
  }
432
432
 
@@ -385,7 +385,7 @@ export function disconnect(
385
385
  * const player1 = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
386
386
  * const filter = new Tone.Filter("G5").toDestination();
387
387
  * // connect nodes to a common destination
388
- * fanIn(player, player1, filter);
388
+ * Tone.fanIn(player, player1, filter);
389
389
  */
390
390
  export function fanIn(...nodes: OutputNode[]): void {
391
391
  const dstNode = nodes.pop();
@@ -97,7 +97,7 @@ export abstract class ToneWithContext<Options extends ToneWithContextOptions> ex
97
97
 
98
98
  /**
99
99
  * Convert the incoming time to seconds.
100
- * This is calculated against the current [[Tone.Transport]] bpm
100
+ * This is calculated against the current [[Transport]] bpm
101
101
  * @example
102
102
  * const gain = new Tone.Gain();
103
103
  * setInterval(() => console.log(gain.toSeconds("4n")), 100);
@@ -1,3 +1,4 @@
1
+ /* eslint-disable key-spacing */
1
2
  import { getContext } from "../Global";
2
3
  import { intervalToFrequencyRatio, mtof } from "./Conversions";
3
4
  import { ftom, getA4, setA4 } from "./Conversions";
@@ -215,7 +216,7 @@ export class FrequencyClass<Type extends number = Hertz> extends TimeClass<Type,
215
216
  //-------------------------------------
216
217
 
217
218
  /**
218
- * Note to scale index.
219
+ * Note to scale index.
219
220
  * @hidden
220
221
  */
221
222
  const noteToScaleIndex = {
@@ -15,8 +15,8 @@ describe("Chorus", () => {
15
15
  () => {
16
16
  const chorus = new Chorus().toDestination().start();
17
17
  const osc = new Oscillator(220, "sawtooth")
18
- .connect(chorus)
19
- .start();
18
+ .connect(chorus)
19
+ .start();
20
20
  },
21
21
  "chorus.wav",
22
22
  0.25
@@ -58,7 +58,8 @@ export class Loop<Options extends LoopOptions = LoopOptions> extends ToneWithCon
58
58
  loop: true,
59
59
  loopEnd: options.interval,
60
60
  playbackRate: options.playbackRate,
61
- probability: options.probability
61
+ probability: options.probability,
62
+ humanize: options.humanize,
62
63
  });
63
64
 
64
65
  this.callback = options.callback;
@@ -32,7 +32,7 @@ type ToneObject = {
32
32
  * Bind the TimeBaseClass to the context
33
33
  */
34
34
  function bindTypeClass(context: Context, type) {
35
- return (...args: any[]) => new type(context, ...args);
35
+ return (...args: unknown[]) => new type(context, ...args);
36
36
  }
37
37
 
38
38
  /**
@@ -18,7 +18,7 @@ export interface DuoSynthOptions extends MonophonicOptions {
18
18
  }
19
19
 
20
20
  /**
21
- * DuoSynth is a monophonic synth composed of two [[MonoSynths]] run in parallel with control over the
21
+ * DuoSynth is a monophonic synth composed of two [[MonoSynth]]s run in parallel with control over the
22
22
  * frequency ratio between the two voices and vibrato effect.
23
23
  * @example
24
24
  * const duoSynth = new Tone.DuoSynth().toDestination();
@@ -285,7 +285,6 @@ export class PolySynth<Voice extends Monophonic<any> = Synth> extends Instrument
285
285
  * @param notes The notes to play. Accepts a single Frequency or an array of frequencies.
286
286
  * @param time When the release will be triggered.
287
287
  * @example
288
- * @example
289
288
  * const poly = new Tone.PolySynth(Tone.AMSynth).toDestination();
290
289
  * poly.triggerAttack(["Ab3", "C4", "F5"]);
291
290
  * // trigger the release of the given notes.
@@ -502,9 +502,9 @@ describe("Player", () => {
502
502
  const player = new Player(buffer);
503
503
  player.toDestination();
504
504
  player
505
- .start(0, 0, 0.05)
506
- .start(0.1, 0, 0.05)
507
- .start(0.2, 0, 0.05);
505
+ .start(0, 0, 0.05)
506
+ .start(0.1, 0, 0.05)
507
+ .start(0.2, 0, 0.05);
508
508
  player.stop(0.1);
509
509
  }, 0.3).then((buff) => {
510
510
  expect(buff.getTimeOfLastSound()).to.be.closeTo(0.1, 0.02);
@@ -559,9 +559,9 @@ describe("Player", () => {
559
559
  it("plays synced to the Transport", () => {
560
560
  return Offline(({ transport }) => {
561
561
  const player = new Player(buffer)
562
- .sync()
563
- .start(0)
564
- .toDestination();
562
+ .sync()
563
+ .start(0)
564
+ .toDestination();
565
565
  transport.start(0);
566
566
  }, 0.05).then((buff) => {
567
567
  expect(buff.isSilent()).to.be.false;
@@ -587,13 +587,13 @@ describe("Player", () => {
587
587
  it("offsets correctly when started by the Transport", () => {
588
588
  const testSample =
589
589
  buffer.toArray(0)[
590
- Math.floor(0.13125 * getContext().sampleRate)
590
+ Math.floor(0.13125 * getContext().sampleRate)
591
591
  ];
592
592
  return Offline(({ transport }) => {
593
593
  const player = new Player(buffer)
594
- .sync()
595
- .start(0, 0.1)
596
- .toDestination();
594
+ .sync()
595
+ .start(0, 0.1)
596
+ .toDestination();
597
597
  transport.start(0, 0.03125);
598
598
  }, 0.05).then((buff) => {
599
599
  expect(buff.toArray()[0][0]).to.equal(testSample);
@@ -709,12 +709,15 @@ describe("Player", () => {
709
709
  setTimeout(() => {
710
710
  player.restart(undefined, undefined, 1);
711
711
  const checkStopTimes = new Set();
712
- player["_activeSources"].forEach(source => {
713
- checkStopTimes.add(source["_stopTime"]);
712
+ // @ts-ignore
713
+ player._activeSources.forEach(source => {
714
+ // @ts-ignore
715
+ checkStopTimes.add(source._stopTime);
714
716
  });
715
717
  getContext().lookAhead = originalLookAhead;
716
718
  // ensure each source has a different stopTime
717
- expect(checkStopTimes.size).to.equal(player["_activeSources"].size);
719
+ // @ts-ignore
720
+ expect(checkStopTimes.size).to.equal(player._activeSources.size);
718
721
  done();
719
722
  }, 250);
720
723
  },
@@ -206,7 +206,7 @@ export class Players extends ToneAudioNode<PlayersOptions> {
206
206
  * const players = new Tone.Players();
207
207
  * players.add("gong", "https://tonejs.github.io/audio/berklee/gong_1.mp3", () => {
208
208
  * console.log("gong loaded");
209
- * players.get("gong").start();
209
+ * players.player("gong").start();
210
210
  * });
211
211
  */
212
212
  add(name: string, url: string | ToneAudioBuffer | AudioBuffer, callback?: () => void): this {
@@ -315,7 +315,7 @@ export class OmniOscillator<OscType extends AnyOscillator>
315
315
 
316
316
  /**
317
317
  * The width of the oscillator when sourceType === "pulse".
318
- * See [[PWMOscillator.width]]
318
+ * See [[PWMOscillator]]
319
319
  */
320
320
  get width(): IsPulseOscillator<OscType, Signal<"audioRange">> {
321
321
  if (this._getOscType(this._oscillator, "pulse")) {
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "14.8.49";
1
+ export const version: string = "14.9.1";