mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-14 04:43:54 +00:00
WIP moving tests to web-test-runner
This commit is contained in:
parent
066e46f4c3
commit
7eec743b18
169 changed files with 11189 additions and 5951 deletions
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["jsdoc", "html"],
|
||||
plugins: ["jsdoc", "html", "import"],
|
||||
extends: ["plugin:@typescript-eslint/recommended"],
|
||||
rules: {
|
||||
"prefer-rest-params": "off",
|
||||
|
@ -86,5 +86,6 @@ module.exports = {
|
|||
"error",
|
||||
{ functions: "always", keywords: "always", classes: "always" },
|
||||
],
|
||||
"import/no-absolute-path": "error",
|
||||
},
|
||||
};
|
||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -30,8 +30,6 @@ jobs:
|
|||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: All tests
|
||||
run: npm run test
|
||||
- name: Upload coverage
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Noise } from "../../source/Noise";
|
||||
import { Analyser } from "./Analyser";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests, warns } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests, warns } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { DCMeter } from "./DCMeter";
|
||||
|
||||
describe("DCMeter", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { Noise } from "Tone/source/Noise";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { Noise } from "../../source/Noise";
|
||||
import { FFT } from "./FFT";
|
||||
|
||||
describe("FFT", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Follower } from "./Follower";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Follower", () => {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests, warns } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests, warns } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { Meter } from "./Meter";
|
||||
import { Panner } from "Tone/component/channel/Panner";
|
||||
import { Merge } from "Tone/component/channel/Merge";
|
||||
import { Panner } from "../channel/Panner";
|
||||
import { Merge } from "../channel/Merge";
|
||||
|
||||
describe("Meter", () => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { Noise } from "Tone/source/Noise";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { Noise } from "../../source/Noise";
|
||||
import { Waveform } from "./Waveform";
|
||||
|
||||
describe("Waveform", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Channel } from "./Channel";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Channel", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { ConstantOutput } from "test/helper/ConstantOutput";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { ConstantOutput } from "../../../test/helper/ConstantOutput";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { CrossFade } from "./CrossFade";
|
||||
|
||||
describe("CrossFade", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Merge } from "./Merge";
|
||||
|
||||
describe("Merge", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { MidSideMerge } from "./MidSideMerge";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
|
||||
describe("MidSideMerge", () => {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { MidSideSplit } from "./MidSideSplit";
|
||||
import { MidSideMerge } from "./MidSideMerge";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Merge } from "./Merge";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("MidSideSplit", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { StereoSignal } from "test/helper/StereoSignal";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { StereoSignal } from "../../../test/helper/StereoSignal";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Mono } from "./Mono";
|
||||
|
||||
describe("Mono", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { MultibandSplit } from "./MultibandSplit";
|
||||
|
||||
describe("MultibandSplit", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { PanVol } from "./PanVol";
|
||||
|
||||
describe("PanVol", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Panner } from "./Panner";
|
||||
|
||||
describe("Panner", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Panner3D } from "./Panner3D";
|
||||
|
||||
describe("Panner3D", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import { connectFrom } from "test/helper/Connect";
|
||||
import { connectFrom } from "../../../test/helper/Connect";
|
||||
import { Recorder } from "./Recorder";
|
||||
import { Context } from "Tone/core/context/Context";
|
||||
import { ToneWithContext } from "Tone/core/context/ToneWithContext";
|
||||
import { Synth } from "Tone/instrument/Synth";
|
||||
import { Context } from "../../core/context/Context";
|
||||
import { ToneWithContext } from "../../core/context/ToneWithContext";
|
||||
import { Synth } from "../../instrument/Synth";
|
||||
|
||||
describe("Recorder", () => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { ConstantOutput } from "test/helper/ConstantOutput";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { ConstantOutput } from "../../../test/helper/ConstantOutput";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Solo } from "./Solo";
|
||||
|
||||
describe("Solo", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectTo } from "test/helper/Connect";
|
||||
import { ConstantOutput } from "test/helper/ConstantOutput";
|
||||
import { StereoSignal } from "test/helper/StereoSignal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectTo } from "../../../test/helper/Connect";
|
||||
import { ConstantOutput } from "../../../test/helper/ConstantOutput";
|
||||
import { StereoSignal } from "../../../test/helper/StereoSignal";
|
||||
import { Split } from "./Split";
|
||||
|
||||
describe("Split", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Volume } from "./Volume";
|
||||
|
||||
describe("Volume", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Compressor } from "./Compressor";
|
||||
|
||||
describe("Compressor", () => {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { Gate } from "./Gate";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "../../../test/helper/CompareToFile";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Gate", () => {
|
||||
|
||||
BasicTests(Gate);
|
||||
|
||||
it("matches a file", () => {
|
||||
it.only("matches a file", () => {
|
||||
return CompareToFile(() => {
|
||||
const gate = new Gate(-10, 0.1).toDestination();
|
||||
const osc = new Oscillator().connect(gate);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Limiter } from "./Limiter";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Limiter", () => {
|
||||
|
|
|
@ -32,7 +32,7 @@ export class Limiter extends ToneAudioNode<LimiterOptions> {
|
|||
*/
|
||||
private _compressor: Compressor;
|
||||
|
||||
readonly threshold: Param<"decibels">
|
||||
readonly threshold: Param<"decibels">;
|
||||
|
||||
/**
|
||||
* @param threshold The threshold above which the gain reduction is applied.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MidSideCompressor } from "./MidSideCompressor";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("MidSideCompressor", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { MultibandCompressor } from "./MultibandCompressor";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("MultibandCompressor", () => {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { CompareToFile } from "../../../test/helper/CompareToFile";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { AmplitudeEnvelope } from "./AmplitudeEnvelope";
|
||||
import { Envelope } from "./Envelope";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectTo } from "test/helper/Connect";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectTo } from "../../../test/helper/Connect";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Envelope, EnvelopeCurve } from "./Envelope";
|
||||
|
||||
describe("Envelope", () => {
|
||||
|
|
|
@ -71,7 +71,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
* @max 2
|
||||
*/
|
||||
@timeRange(0)
|
||||
attack: Time;
|
||||
attack: Time;
|
||||
|
||||
/**
|
||||
* After the attack portion of the envelope, the value will fall
|
||||
|
@ -91,7 +91,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
* @max 2
|
||||
*/
|
||||
@timeRange(0)
|
||||
decay: Time;
|
||||
decay: Time;
|
||||
|
||||
/**
|
||||
* The sustain value is the value
|
||||
|
@ -110,7 +110,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
* ```
|
||||
*/
|
||||
@range(0, 1)
|
||||
sustain: NormalRange;
|
||||
sustain: NormalRange;
|
||||
|
||||
/**
|
||||
* After triggerRelease is called, the envelope's
|
||||
|
@ -131,7 +131,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
|
|||
* @max 5
|
||||
*/
|
||||
@timeRange(0)
|
||||
release: Time;
|
||||
release: Time;
|
||||
|
||||
/**
|
||||
* The automation curve type for the attack
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { FrequencyEnvelope } from "Tone/component/envelope/FrequencyEnvelope";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { Envelope } from "Tone/component/envelope/Envelope";
|
||||
import { FrequencyEnvelope } from "./FrequencyEnvelope";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { Envelope } from "./Envelope";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("FrequencyEnvelope", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { BiquadFilter } from "./BiquadFilter";
|
||||
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { ToneAudioBuffer } from "../../core/context/ToneAudioBuffer";
|
||||
import { Convolver } from "./Convolver";
|
||||
|
||||
// @ts-ignore
|
||||
if (window.__karma__) {
|
||||
ToneAudioBuffer.baseUrl = "/base/test/";
|
||||
}
|
||||
|
||||
describe("Convolver", () => {
|
||||
|
||||
BasicTests(Convolver);
|
||||
|
||||
const ir = new ToneAudioBuffer();
|
||||
|
||||
const testFile = "./audio/sineStereo.wav";
|
||||
const testFile = "./test/audio/sineStereo.wav";
|
||||
|
||||
before(() => {
|
||||
return ir.load(testFile);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom } from "test/helper/Connect";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom } from "../../../test/helper/Connect";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { EQ3 } from "./EQ3";
|
||||
|
||||
describe("EQ3", () => {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { expect } from "chai";
|
||||
import { FeedbackCombFilter } from "./FeedbackCombFilter";
|
||||
import { BitCrusher } from "Tone/effect/BitCrusher";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Signal } from "Tone/signal";
|
||||
import { BitCrusher } from "../../effect/BitCrusher";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Signal } from "../../signal";
|
||||
|
||||
describe("FeedbackCombFilter", () => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { Filter, FilterRollOff } from "./Filter";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { LowpassCombFilter } from "./LowpassCombFilter";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("LowpassCombFilter", () => {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { OnePoleFilter } from "./OnePoleFilter";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { CompareToFile } from "../../../test/helper/CompareToFile";
|
||||
import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
|
||||
describe("OnePoleFilter", () => {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { connectTo } from "test/helper/Connect";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { connect } from "Tone/core/context/ToneAudioNode";
|
||||
import { Subtract } from "Tone/signal/Subtract";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { CompareToFile } from "../../../test/helper/CompareToFile";
|
||||
import { connectTo } from "../../../test/helper/Connect";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { connect } from "../../core/context/ToneAudioNode";
|
||||
import { Subtract } from "../../signal/Subtract";
|
||||
import { PhaseShiftAllpass } from "./PhaseShiftAllpass";
|
||||
|
||||
describe("PhaseShiftAllpass", () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline, whenBetween } from "test/helper/Offline";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { atTime, Offline, whenBetween } from "../../../test/helper/Offline";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { noOp } from "../util/Interface";
|
||||
import { Clock } from "./Clock";
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { Compare, Plot } from "@tonejs/plot";
|
||||
import { expect } from "chai";
|
||||
import { BasicTests, testAudioContext } from "test/helper/Basic";
|
||||
// import { atTime, Offline } from "test/helper/Offline";
|
||||
import { BasicTests, testAudioContext } from "../../../test/helper/Basic";
|
||||
// import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
import { TickParam } from "./TickParam";
|
||||
|
||||
describe("TickParam", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { TickSignal } from "./TickSignal";
|
||||
|
||||
describe("TickSignal", () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { TickSource } from "./TickSource";
|
||||
|
||||
describe("TickSource", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { Ticker } from "./Ticker";
|
||||
|
||||
describe("Ticker", () => {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { expect } from "chai";
|
||||
import { atTime, Offline, whenBetween } from "test/helper/Offline";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { noOp } from "Tone/core/util/Interface";
|
||||
import { atTime, Offline, whenBetween } from "../../../test/helper/Offline";
|
||||
import { Time } from "../type/Time";
|
||||
import { noOp } from "../util/Interface";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { TransportTime } from "../type/TransportTime";
|
||||
import { TransportClass } from "./Transport";
|
||||
// importing for side affects
|
||||
import "../context/Destination";
|
||||
import { warns } from "test/helper/Basic";
|
||||
import { Synth } from "Tone/instrument/Synth";
|
||||
import { warns } from "../../../test/helper/Basic";
|
||||
import { Synth } from "../../instrument/Synth";
|
||||
|
||||
describe("Transport", () => {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { TransportClass } from "./Transport";
|
||||
import { TransportEvent } from "./TransportEvent";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { TransportClass } from "./Transport";
|
||||
import { TransportRepeatEvent } from "./TransportRepeatEvent";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { ConstantOutput } from "test/helper/ConstantOutput";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { ConstantOutput } from "../../../test/helper/ConstantOutput";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { TransportClass } from "../clock/Transport";
|
||||
import { getContext } from "../Global";
|
||||
import { createAudioContext } from "./AudioContext";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { connect } from "../context/ToneAudioNode";
|
||||
import { Delay } from "./Delay";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { warns } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { warns } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Oscillator } from "../../source/oscillator/Oscillator";
|
||||
import { getContext } from "../Global";
|
||||
import { DestinationClass } from "./Destination";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "test/helper/Connect";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { connectFrom, connectTo } from "../../../test/helper/Connect";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Gain } from "./Gain";
|
||||
|
||||
describe("Gain", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { getContext } from "../Global";
|
||||
import { ListenerClass } from "./Listener";
|
||||
|
||||
|
|
|
@ -33,47 +33,47 @@ export class ListenerClass extends ToneAudioNode<ListenerOptions> {
|
|||
readonly positionX: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.positionX,
|
||||
})
|
||||
});
|
||||
|
||||
readonly positionY: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.positionY,
|
||||
})
|
||||
});
|
||||
|
||||
readonly positionZ: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.positionZ,
|
||||
})
|
||||
});
|
||||
|
||||
readonly forwardX: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.forwardX,
|
||||
})
|
||||
});
|
||||
|
||||
readonly forwardY: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.forwardY,
|
||||
})
|
||||
});
|
||||
|
||||
readonly forwardZ: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.forwardZ,
|
||||
})
|
||||
});
|
||||
|
||||
readonly upX: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.upX,
|
||||
})
|
||||
});
|
||||
|
||||
readonly upY: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.upY,
|
||||
})
|
||||
});
|
||||
|
||||
readonly upZ: Param = new Param({
|
||||
context: this.context,
|
||||
param: this.context.rawContext.listener.upZ,
|
||||
})
|
||||
});
|
||||
|
||||
static getDefaults(): ListenerOptions {
|
||||
return Object.assign(ToneAudioNode.getDefaults(), {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { TestAudioBuffer } from "@tonejs/plot";
|
||||
import { TestAudioBuffer } from "../../../test/helper/compare/TestAudioBuffer";
|
||||
import { expect } from "chai";
|
||||
import { ToneOscillatorNode } from "Tone/source/oscillator/ToneOscillatorNode";
|
||||
import { ToneOscillatorNode } from "../../source/oscillator/ToneOscillatorNode";
|
||||
import { noOp } from "../util/Interface";
|
||||
import { Offline } from "./Offline";
|
||||
import { ToneAudioBuffer } from "./ToneAudioBuffer";
|
||||
|
|
|
@ -2,6 +2,8 @@ import { getContext, setContext } from "../Global";
|
|||
import { Seconds } from "../type/Units";
|
||||
import { OfflineContext } from "./OfflineContext";
|
||||
import { ToneAudioBuffer } from "./ToneAudioBuffer";
|
||||
import "./Destination";
|
||||
import "./Listener";
|
||||
|
||||
/**
|
||||
* Generate a buffer by rendering all of the Tone.js code within the callback using the OfflineAudioContext.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Compare, Plot } from "@tonejs/plot";
|
||||
import { Compare, Plot } from "../../../test/helper/compare/index";
|
||||
import { expect } from "chai";
|
||||
import { BasicTests, testAudioContext } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { SCHEDULE_RAMP_AFTER_SET_TARGET } from "test/helper/Supports";
|
||||
import { BPM, Decibels, Frequency, Positive, Seconds, Time, Unit, UnitName } from "Tone/core/type/Units";
|
||||
import { Signal } from "Tone/signal/Signal";
|
||||
import { BasicTests, testAudioContext } from "../../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
import { SCHEDULE_RAMP_AFTER_SET_TARGET } from "../../../test/helper/Supports";
|
||||
import { BPM, Decibels, Frequency, Positive, Seconds, Time, Unit, UnitName } from "../type/Units";
|
||||
import { Signal } from "../../signal/Signal";
|
||||
import { getContext } from "../Global";
|
||||
import { Param } from "./Param";
|
||||
import { connect } from "./ToneAudioNode";
|
||||
|
@ -102,7 +102,7 @@ describe("Param", () => {
|
|||
param.setValueCurveAtTime([0, 0.5, 0, 1, 1.5], 0.1, 0.8, 0.5);
|
||||
expect(param.getValueAtTime(0.91)).to.be.closeTo(0.75, 0.01);
|
||||
}, 1, 1, sampleRate);
|
||||
document.body.appendChild(await Plot.signal(testBuffer));
|
||||
// document.body.appendChild(await Plot.signal(testBuffer));
|
||||
matchesOutputCurve(param, testBuffer);
|
||||
});
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe("Param", () => {
|
|||
param.cancelScheduledValues(1.2);
|
||||
param.linearRampToValueAtTime(1, 1.3);
|
||||
}, 1.5, 1, sampleRate);
|
||||
document.body.appendChild(await Plot.signal(testBuffer));
|
||||
// document.body.appendChild(await Plot.signal(testBuffer));
|
||||
matchesOutputCurve(param, testBuffer);
|
||||
});
|
||||
|
||||
|
@ -289,7 +289,7 @@ describe("Param", () => {
|
|||
for (let time = 0.41; time < 2; time += 0.1) {
|
||||
expect(buffer.getValueAtTime(time)).to.be.closeTo(sig.getValueAtTime(time), 0.01);
|
||||
}
|
||||
// document.body.appendChild(await Plot.signal(buffer));
|
||||
document.body.appendChild(await Plot.signal(buffer));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import "test/helper/ToneAudioBuffer";
|
||||
import { getContext } from "../Global";
|
||||
import { ToneAudioBuffer } from "./ToneAudioBuffer";
|
||||
|
||||
const testFile = "./audio/sine.wav";
|
||||
const testFile = "./test/audio/sine.wav";
|
||||
|
||||
describe("ToneAudioBuffer", () => {
|
||||
|
||||
|
@ -141,12 +140,12 @@ describe("ToneAudioBuffer", () => {
|
|||
});
|
||||
|
||||
it("can load a file with fallback extensions", async () => {
|
||||
const buffer = await ToneAudioBuffer.load("./audio/sine.[nope|nada|wav]");
|
||||
const buffer = await ToneAudioBuffer.load("./test/audio/sine.[nope|nada|wav]");
|
||||
expect(buffer).to.exist;
|
||||
});
|
||||
|
||||
it("takes the first supported format when multiple extensions are provided", async () => {
|
||||
const buffer = await ToneAudioBuffer.load("./audio/sine.[wav|nope]");
|
||||
const buffer = await ToneAudioBuffer.load("./test/audio/sine.[wav|nope]");
|
||||
expect(buffer).to.exist;
|
||||
});
|
||||
|
||||
|
@ -163,7 +162,7 @@ describe("ToneAudioBuffer", () => {
|
|||
});
|
||||
|
||||
it("invokes the error callback if the file is corrupt", done => {
|
||||
const buffer = new ToneAudioBuffer("./audio/corrupt.wav", () => {
|
||||
const buffer = new ToneAudioBuffer("./test/audio/corrupt.wav", () => {
|
||||
throw new Error("shouldn't invoke this function");
|
||||
}, e => {
|
||||
buffer.dispose();
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import "test/helper/ToneAudioBuffer";
|
||||
import { ToneAudioBuffer } from "./ToneAudioBuffer";
|
||||
import { ToneAudioBuffers } from "./ToneAudioBuffers";
|
||||
|
||||
const testFile = "./audio/sine.wav";
|
||||
const testFile2 = "./audio/hh.wav";
|
||||
const testFile = "./test/audio/sine.wav";
|
||||
const testFile2 = "./test/audio/hh.wav";
|
||||
|
||||
describe("ToneAudioBuffers", () => {
|
||||
it("can be created and disposed", () => {
|
||||
|
@ -60,7 +59,7 @@ describe("ToneAudioBuffers", () => {
|
|||
|
||||
it("can pass in buffers as object and options object in second arg", done => {
|
||||
const buffer = new ToneAudioBuffers({
|
||||
baseUrl: "./audio/",
|
||||
baseUrl: "./test/audio/",
|
||||
onload(): void {
|
||||
expect(buffer.has("sine")).to.be.true;
|
||||
buffer.dispose();
|
||||
|
@ -103,7 +102,7 @@ describe("ToneAudioBuffers", () => {
|
|||
expect(buffer.get("hat")).to.be.instanceof(ToneAudioBuffer);
|
||||
buffer.dispose();
|
||||
done();
|
||||
}, "./audio/");
|
||||
}, "./test/audio/");
|
||||
});
|
||||
|
||||
it("can add a buffer", done => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { expect } from "chai";
|
||||
import { Merge } from "Tone/component";
|
||||
import { Split } from "Tone/component/channel/Split";
|
||||
import { Oscillator } from "Tone/source";
|
||||
import { Merge } from "../../component";
|
||||
import { Split } from "../../component/channel/Split";
|
||||
import { Oscillator } from "../../source";
|
||||
import { Gain } from "./Gain";
|
||||
import { connect, disconnect, fanIn } from "./ToneAudioNode";
|
||||
import { PassAudio } from "test/helper/PassAudio";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { PassAudio } from "../../../test/helper/PassAudio";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
|
||||
describe("ToneAudioNode", () => {
|
||||
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
import { expect } from "chai";
|
||||
import teoria from "teoria";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { getContext } from "../Global";
|
||||
import { Frequency, FrequencyClass } from "./Frequency";
|
||||
import { Midi } from "./Midi";
|
||||
import { Ticks } from "./Ticks";
|
||||
import { Time } from "./Time";
|
||||
import { TransportTime } from "./TransportTime";
|
||||
import { Note, Midi as TonalMidi } from "tonal";
|
||||
|
||||
describe("FrequencyClass", () => {
|
||||
|
||||
BasicTests(Frequency);
|
||||
|
||||
context("Constructor", () => {
|
||||
|
||||
it("can be made with or without 'new'", () => {
|
||||
const f0 = Frequency();
|
||||
expect(f0).to.be.instanceOf(FrequencyClass);
|
||||
|
@ -73,9 +71,15 @@ describe("FrequencyClass", () => {
|
|||
});
|
||||
|
||||
it("can convert from Midi", () => {
|
||||
expect(Frequency(Midi("C4")).valueOf()).to.equal(Frequency("C4").valueOf());
|
||||
expect(Frequency(Midi(60)).valueOf()).to.equal(Frequency("C4").valueOf());
|
||||
expect(Frequency(Midi(61)).valueOf()).to.equal(Frequency("C#4").valueOf());
|
||||
expect(Frequency(Midi("C4")).valueOf()).to.equal(
|
||||
Frequency("C4").valueOf()
|
||||
);
|
||||
expect(Frequency(Midi(60)).valueOf()).to.equal(
|
||||
Frequency("C4").valueOf()
|
||||
);
|
||||
expect(Frequency(Midi(61)).valueOf()).to.equal(
|
||||
Frequency("C#4").valueOf()
|
||||
);
|
||||
});
|
||||
|
||||
it("can convert from Ticks", () => {
|
||||
|
@ -87,7 +91,6 @@ describe("FrequencyClass", () => {
|
|||
});
|
||||
|
||||
context("Eval Types", () => {
|
||||
|
||||
it("evaluates numbers as frequency", () => {
|
||||
expect(Frequency("1").valueOf()).to.equal(1);
|
||||
expect(Frequency("123").valueOf()).to.equal(123);
|
||||
|
@ -130,8 +133,14 @@ describe("FrequencyClass", () => {
|
|||
});
|
||||
|
||||
it("evalutes midi", () => {
|
||||
expect(Frequency(48, "midi").valueOf()).to.be.closeTo(teoria.Note.fromMIDI(48).fq(), 0.0001);
|
||||
expect(Frequency(69, "midi").valueOf()).to.be.closeTo(teoria.Note.fromMIDI(69).fq(), 0.0001);
|
||||
expect(Frequency(48, "midi").valueOf()).to.be.closeTo(
|
||||
TonalMidi.midiToFreq(48),
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency(69, "midi").valueOf()).to.be.closeTo(
|
||||
TonalMidi.midiToFreq(69),
|
||||
0.0001
|
||||
);
|
||||
});
|
||||
|
||||
it("evalutes hz", () => {
|
||||
|
@ -140,41 +149,105 @@ describe("FrequencyClass", () => {
|
|||
});
|
||||
|
||||
it("can convert notes into frequencies", () => {
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(teoria.note("C4").fq(), 0.0001);
|
||||
expect(Frequency("D4").valueOf()).to.be.closeTo(teoria.note("D4").fq(), 0.0001);
|
||||
expect(Frequency("Db4").valueOf()).to.be.closeTo(teoria.note("Db4").fq(), 0.0001);
|
||||
expect(Frequency("E4").valueOf()).to.be.closeTo(teoria.note("E4").fq(), 0.0001);
|
||||
expect(Frequency("F2").valueOf()).to.be.closeTo(teoria.note("F2").fq(), 0.0001);
|
||||
expect(Frequency("Gb-1").valueOf()).to.be.closeTo(teoria.note("Gb-1").fq(), 0.0001);
|
||||
expect(Frequency("A#10").valueOf()).to.be.closeTo(teoria.note("A#10").fq(), 0.0001);
|
||||
expect(Frequency("Bb2").valueOf()).to.be.closeTo(teoria.note("Bb2").fq(), 0.0001);
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(
|
||||
Note.freq("C4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("D4").valueOf()).to.be.closeTo(
|
||||
Note.freq("D4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Db4").valueOf()).to.be.closeTo(
|
||||
Note.freq("Db4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("E4").valueOf()).to.be.closeTo(
|
||||
Note.freq("E4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("F2").valueOf()).to.be.closeTo(
|
||||
Note.freq("F2") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Gb-1").valueOf()).to.be.closeTo(
|
||||
Note.freq("Gb-1") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("A#10").valueOf()).to.be.closeTo(
|
||||
Note.freq("A#10") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Bb2").valueOf()).to.be.closeTo(
|
||||
Note.freq("Bb2") as number,
|
||||
0.0001
|
||||
);
|
||||
});
|
||||
|
||||
it("handles double accidentals", () => {
|
||||
expect(Frequency("Cbb4").valueOf()).to.be.closeTo(teoria.note("Cbb4").fq(), 0.0001);
|
||||
expect(Frequency("Dx4").valueOf()).to.be.closeTo(teoria.note("Dx4").fq(), 0.0001);
|
||||
expect(Frequency("Dbb4").valueOf()).to.be.closeTo(teoria.note("Dbb4").fq(), 0.0001);
|
||||
expect(Frequency("Ex4").valueOf()).to.be.closeTo(teoria.note("Ex4").fq(), 0.0001);
|
||||
expect(Frequency("Fx2").valueOf()).to.be.closeTo(teoria.note("Fx2").fq(), 0.0001);
|
||||
expect(Frequency("Gbb-1").valueOf()).to.be.closeTo(teoria.note("Gbb-1").fq(), 0.0001);
|
||||
expect(Frequency("Ax10").valueOf()).to.be.closeTo(teoria.note("Ax10").fq(), 0.0001);
|
||||
expect(Frequency("Bbb2").valueOf()).to.be.closeTo(teoria.note("Bbb2").fq(), 0.0001);
|
||||
expect(Frequency("Cbb4").valueOf()).to.be.closeTo(
|
||||
Note.freq("Cbb4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Dx4").valueOf()).to.be.closeTo(
|
||||
Note.freq("Dx4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Dbb4").valueOf()).to.be.closeTo(
|
||||
Note.freq("Dbb4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Ex4").valueOf()).to.be.closeTo(
|
||||
Note.freq("Ex4") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Fx2").valueOf()).to.be.closeTo(
|
||||
Note.freq("Fx2") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Gbb-1").valueOf()).to.be.closeTo(
|
||||
Note.freq("Gbb-1") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Ax10").valueOf()).to.be.closeTo(
|
||||
Note.freq("Ax10") as number,
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("Bbb2").valueOf()).to.be.closeTo(
|
||||
Note.freq("Bbb2") as number,
|
||||
0.0001
|
||||
);
|
||||
});
|
||||
|
||||
it("can accomidate different concert tuning", () => {
|
||||
FrequencyClass.A4 = 444;
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(teoria.note("C4").fq(FrequencyClass.A4), 0.0001);
|
||||
expect(Frequency("D1").valueOf()).to.be.closeTo(teoria.note("D1").fq(FrequencyClass.A4), 0.0001);
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(
|
||||
TonalMidi.midiToFreq(
|
||||
TonalMidi.toMidi("C4") as number,
|
||||
FrequencyClass.A4
|
||||
),
|
||||
0.0001
|
||||
);
|
||||
expect(Frequency("D1").valueOf()).to.be.closeTo(
|
||||
TonalMidi.midiToFreq(
|
||||
TonalMidi.toMidi("D1") as number,
|
||||
FrequencyClass.A4
|
||||
),
|
||||
0.0001
|
||||
);
|
||||
FrequencyClass.A4 = 100;
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(teoria.note("C4").fq(FrequencyClass.A4), 0.0001);
|
||||
expect(Frequency("C4").valueOf()).to.be.closeTo(
|
||||
TonalMidi.midiToFreq(
|
||||
TonalMidi.toMidi("C4") as number,
|
||||
FrequencyClass.A4
|
||||
),
|
||||
0.0001
|
||||
);
|
||||
// return it to normal
|
||||
FrequencyClass.A4 = 440;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
context("transpose/harmonize", () => {
|
||||
|
||||
it("can transpose a value", () => {
|
||||
expect(Frequency("A4").transpose(3).toMidi()).to.equal(72);
|
||||
expect(Frequency("A4").transpose(-3).toMidi()).to.equal(66);
|
||||
|
@ -184,31 +257,48 @@ describe("FrequencyClass", () => {
|
|||
it("can harmonize a value", () => {
|
||||
expect(Frequency("A4").harmonize([0, 3])).to.be.an("array");
|
||||
expect(Frequency("A4").harmonize([0, 3]).length).to.equal(2);
|
||||
expect(Frequency("A4").harmonize([0, 3])[0].toNote()).to.equal("A4");
|
||||
expect(Frequency("A4").harmonize([0, 3])[1].toNote()).to.equal("C5");
|
||||
expect(Frequency("A4").harmonize([0, 3])[0].toNote()).to.equal(
|
||||
"A4"
|
||||
);
|
||||
expect(Frequency("A4").harmonize([0, 3])[1].toNote()).to.equal(
|
||||
"C5"
|
||||
);
|
||||
|
||||
expect(Frequency("A4").harmonize([-12, 0, 12])).to.be.an("array");
|
||||
expect(Frequency("A4").harmonize([-12, 0, 12]).length).to.equal(3);
|
||||
expect(Frequency("A4").harmonize([-12, 0, 12])[0].toNote()).to.equal("A3");
|
||||
expect(Frequency("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal("A4");
|
||||
expect(Frequency("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal("A5");
|
||||
expect(
|
||||
Frequency("A4").harmonize([-12, 0, 12])[0].toNote()
|
||||
).to.equal("A3");
|
||||
expect(
|
||||
Frequency("A4").harmonize([-12, 0, 12])[1].toNote()
|
||||
).to.equal("A4");
|
||||
expect(
|
||||
Frequency("A4").harmonize([-12, 0, 12])[2].toNote()
|
||||
).to.equal("A5");
|
||||
});
|
||||
});
|
||||
|
||||
context("Conversions", () => {
|
||||
|
||||
it("can convert frequencies into notes", () => {
|
||||
expect(Frequency(261.625).toNote()).to.equal(teoria.Note.fromFrequency(261.625).note.scientific());
|
||||
expect(Frequency(440).toNote()).to.equal(teoria.Note.fromFrequency(440).note.scientific());
|
||||
expect(Frequency(220).toNote()).to.equal(teoria.Note.fromFrequency(220).note.scientific());
|
||||
expect(Frequency(13.75).toNote()).to.equal(teoria.Note.fromFrequency(13.75).note.scientific());
|
||||
expect(Frequency(261.625).toNote()).to.equal(
|
||||
Note.fromFreq(261.625)
|
||||
);
|
||||
expect(Frequency(440).toNote()).to.equal(Note.fromFreq(440));
|
||||
expect(Frequency(220).toNote()).to.equal(Note.fromFreq(220));
|
||||
expect(Frequency(13.75).toNote()).to.equal(Note.fromFreq(13.75));
|
||||
expect(Frequency(4979).toNote()).to.equal("D#8");
|
||||
});
|
||||
|
||||
it("can convert note to midi values", () => {
|
||||
expect(Frequency("C4").toMidi()).to.equal(teoria.note("C4").midi());
|
||||
expect(Frequency("C#0").toMidi()).to.equal(teoria.note("C#0").midi());
|
||||
expect(Frequency("A-4").toMidi()).to.equal(teoria.note("A-4").midi());
|
||||
expect(Frequency("C4").toMidi()).to.equal(
|
||||
TonalMidi.toMidi("C4") as number
|
||||
);
|
||||
expect(Frequency("C#0").toMidi()).to.equal(
|
||||
TonalMidi.toMidi("C#0") as number
|
||||
);
|
||||
expect(Frequency("A-1").toMidi()).to.equal(
|
||||
TonalMidi.toMidi("A-1") as number
|
||||
);
|
||||
});
|
||||
|
||||
it("can convert hertz to seconds", () => {
|
||||
|
@ -216,5 +306,4 @@ describe("FrequencyClass", () => {
|
|||
expect(Frequency("2hz").toSeconds()).to.equal(0.5);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
import { expect } from "chai";
|
||||
import teoria from "teoria";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { Offline } from "../../../test/helper/Offline";
|
||||
import { Frequency } from "./Frequency";
|
||||
import { Midi, MidiClass } from "./Midi";
|
||||
import { Ticks } from "./Ticks";
|
||||
import { Time } from "./Time";
|
||||
import { TransportTime } from "./TransportTime";
|
||||
import { Note, Midi as TonalMidi } from "tonal";
|
||||
|
||||
describe("MidiClass", () => {
|
||||
|
||||
BasicTests(MidiClass);
|
||||
|
||||
context("Constructor", () => {
|
||||
|
||||
it("can pass in a number in the constructor", () => {
|
||||
const midi = Midi(1);
|
||||
expect(midi).to.be.instanceOf(MidiClass);
|
||||
|
@ -93,28 +91,28 @@ describe("MidiClass", () => {
|
|||
});
|
||||
|
||||
context("Conversions", () => {
|
||||
|
||||
it("can convert frequencies into notes", () => {
|
||||
expect(Midi(48).toNote()).to.equal(teoria.Note.fromMIDI(48).scientific());
|
||||
expect(Midi(90).toNote()).to.equal(teoria.Note.fromMIDI(90).scientific());
|
||||
expect(Midi(48).toNote()).to.equal(TonalMidi.midiToNoteName(48));
|
||||
expect(Midi(90).toNote()).to.equal(
|
||||
TonalMidi.midiToNoteName(90, { sharps: true })
|
||||
);
|
||||
expect(Midi("C#4").toNote()).to.equal("C#4");
|
||||
});
|
||||
|
||||
it("can convert note to midi values", () => {
|
||||
expect(Midi("C4").toMidi()).to.equal(teoria.note("C4").midi());
|
||||
expect(Midi("C#0").toMidi()).to.equal(teoria.note("C#0").midi());
|
||||
expect(Midi("A-4").toMidi()).to.equal(teoria.note("A-4").midi());
|
||||
expect(Midi("C4").toMidi()).to.equal(TonalMidi.toMidi("C4"));
|
||||
expect(Midi("C#0").toMidi()).to.equal(TonalMidi.toMidi("C#0"));
|
||||
expect(Midi("A-1").toMidi()).to.equal(TonalMidi.toMidi("A-1"));
|
||||
});
|
||||
|
||||
it("can convert midi to frequency", () => {
|
||||
expect(Midi(60).toFrequency()).to.equal(teoria.Note.fromMIDI(60).fq());
|
||||
expect(Midi(25).toFrequency()).to.equal(teoria.Note.fromMIDI(25).fq());
|
||||
expect(Midi(108).toFrequency()).to.equal(teoria.Note.fromMIDI(108).fq());
|
||||
expect(Midi(60).toFrequency()).to.equal(TonalMidi.midiToFreq(60));
|
||||
expect(Midi(25).toFrequency()).to.equal(TonalMidi.midiToFreq(25));
|
||||
expect(Midi(108).toFrequency()).to.equal(TonalMidi.midiToFreq(108));
|
||||
});
|
||||
});
|
||||
|
||||
context("transpose/harmonize", () => {
|
||||
|
||||
it("can transpose a value", () => {
|
||||
expect(Midi("A4").transpose(3).toMidi()).to.equal(72);
|
||||
expect(Midi("A4").transpose(-3).toMidi()).to.equal(66);
|
||||
|
@ -129,9 +127,15 @@ describe("MidiClass", () => {
|
|||
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])).to.be.an("array");
|
||||
expect(Midi("A4").harmonize([-12, 0, 12]).length).to.equal(3);
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[0].toNote()).to.equal("A3");
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal("A4");
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal("A5");
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[0].toNote()).to.equal(
|
||||
"A3"
|
||||
);
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal(
|
||||
"A4"
|
||||
);
|
||||
expect(Midi("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal(
|
||||
"A5"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
import { getContext } from "../Global";
|
||||
import { Frequency } from "./Frequency";
|
||||
import { Ticks, TicksClass } from "./Ticks";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
import { getContext } from "../Global";
|
||||
import { Frequency } from "./Frequency";
|
||||
import { Ticks } from "./Ticks";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../../test/helper/Offline";
|
||||
import { getContext } from "../Global";
|
||||
import { Frequency } from "./Frequency";
|
||||
import { Ticks } from "./Ticks";
|
||||
|
|
|
@ -2,7 +2,7 @@ import { expect } from "chai";
|
|||
import { ToneOscillatorNode } from "../../source/oscillator/ToneOscillatorNode";
|
||||
import { assertRange, setLogger } from "./Debug";
|
||||
import { theWindow } from "../context/AudioContext";
|
||||
import { Oscillator } from "Tone/source";
|
||||
import { Oscillator } from "../../source";
|
||||
import { Context } from "../context/Context";
|
||||
|
||||
describe("Debug", () => {
|
||||
|
|
|
@ -10,15 +10,15 @@ function noCopy(key: string, arg: any): boolean {
|
|||
return key === "value" || isAudioParam(arg) || isAudioNode(arg) || isAudioBuffer(arg);
|
||||
}
|
||||
|
||||
export function deepMerge<T>(target: T): T;
|
||||
export function deepMerge<T, U>(target: T, source1: U): T & U;
|
||||
export function deepMerge<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
export function deepMerge<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
/**
|
||||
* Recursively merge an object
|
||||
* @param target the object to merge into
|
||||
* @param sources the source objects to merge
|
||||
*/
|
||||
export function deepMerge<T>(target: T): T;
|
||||
export function deepMerge<T, U>(target: T, source1: U): T & U;
|
||||
export function deepMerge<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
export function deepMerge<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
export function deepMerge(target: any, ...sources: any[]): any {
|
||||
if (!sources.length) {
|
||||
return target;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { ONLINE_TESTING } from "test/helper/Supports";
|
||||
import { ONLINE_TESTING } from "../../../test/helper/Supports";
|
||||
import { DrawClass } from "./Draw";
|
||||
|
||||
describe("Draw", () => {
|
||||
|
|
|
@ -91,7 +91,7 @@ export class Emitter<EventType extends string = string> extends Tone {
|
|||
* @param event The name of the event.
|
||||
* @param args The arguments to pass to the functions listening.
|
||||
*/
|
||||
emit(event, ...args: any[]): this {
|
||||
emit(event: EventType, ...args: any[]): this {
|
||||
if (this._events) {
|
||||
if (this._events.hasOwnProperty(event)) {
|
||||
const eventList = this._events[event].slice(0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { BasicTests } from "../../../test/helper/Basic";
|
||||
import { IntervalTimeline, IntervalTimelineEvent } from "./IntervalTimeline";
|
||||
|
||||
describe("IntervalTimeline", () => {
|
||||
|
|
|
@ -16,7 +16,7 @@ export class TimelineValue<Type> extends Tone {
|
|||
/**
|
||||
* The timeline which stores the values
|
||||
*/
|
||||
private _timeline: Timeline<TimelineValueEvent<Type>> = new Timeline({ memory: 10 })
|
||||
private _timeline: Timeline<TimelineValueEvent<Type>> = new Timeline({ memory: 10 });
|
||||
|
||||
/**
|
||||
* Hold the value to return if there is no scheduled values
|
||||
|
|
|
@ -1,37 +1,39 @@
|
|||
import { AutoFilter } from "./AutoFilter";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import teoria from "teoria";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Note } from "tonal";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Noise } from "Tone/source";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Noise } from "../source";
|
||||
|
||||
describe("AutoFilter", () => {
|
||||
|
||||
BasicTests(AutoFilter);
|
||||
EffectTests(AutoFilter);
|
||||
|
||||
it("matches a file", () => {
|
||||
return CompareToFile(() => {
|
||||
const autoFilter = new AutoFilter({
|
||||
baseFrequency: 200,
|
||||
octaves: 4,
|
||||
frequency: 4,
|
||||
type: "sine"
|
||||
}).toDestination();
|
||||
new Noise().connect(autoFilter).start();
|
||||
autoFilter.start(0.2);
|
||||
}, "autoFilter.wav", 0.1);
|
||||
return CompareToFile(
|
||||
() => {
|
||||
const autoFilter = new AutoFilter({
|
||||
baseFrequency: 200,
|
||||
octaves: 4,
|
||||
frequency: 4,
|
||||
type: "sine",
|
||||
}).toDestination();
|
||||
new Noise().connect(autoFilter).start();
|
||||
autoFilter.start(0.2);
|
||||
},
|
||||
"autoFilter.wav",
|
||||
0.1
|
||||
);
|
||||
});
|
||||
|
||||
context("API", () => {
|
||||
|
||||
it("can pass in options in the constructor", () => {
|
||||
const autoFilter = new AutoFilter({
|
||||
baseFrequency: 2000,
|
||||
octaves: 2,
|
||||
type: "sawtooth"
|
||||
type: "sawtooth",
|
||||
});
|
||||
expect(autoFilter.baseFrequency).to.be.closeTo(2000, 0.1);
|
||||
expect(autoFilter.octaves).to.equal(2);
|
||||
|
@ -50,7 +52,7 @@ describe("AutoFilter", () => {
|
|||
autoFilter.set({
|
||||
baseFrequency: 1200,
|
||||
frequency: 2.4,
|
||||
type: "triangle"
|
||||
type: "triangle",
|
||||
});
|
||||
expect(autoFilter.get().baseFrequency).to.be.closeTo(1200, 0.01);
|
||||
expect(autoFilter.get().frequency).to.be.closeTo(2.4, 0.01);
|
||||
|
@ -76,13 +78,15 @@ describe("AutoFilter", () => {
|
|||
|
||||
it("accepts baseFrequency and octaves as frequency values", () => {
|
||||
const autoFilter = new AutoFilter("2n", "C2", 4);
|
||||
expect(autoFilter.baseFrequency).to.be.closeTo(teoria.note("C2").fq(), 0.01);
|
||||
expect(autoFilter.baseFrequency).to.be.closeTo(
|
||||
Note.freq("C2") as number,
|
||||
0.01
|
||||
);
|
||||
expect(autoFilter.octaves).to.equal(4);
|
||||
autoFilter.dispose();
|
||||
});
|
||||
|
||||
it("can sync the frequency to the transport", () => {
|
||||
|
||||
return Offline(({ transport }) => {
|
||||
const autoFilter = new AutoFilter(2);
|
||||
autoFilter.sync();
|
||||
|
@ -96,7 +100,6 @@ describe("AutoFilter", () => {
|
|||
});
|
||||
|
||||
it("can unsync the frequency to the transport", () => {
|
||||
|
||||
return Offline(({ transport }) => {
|
||||
const autoFilter = new AutoFilter(2);
|
||||
autoFilter.sync();
|
||||
|
@ -110,4 +113,3 @@ describe("AutoFilter", () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { AutoPanner } from "./AutoPanner";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
|
||||
describe("AutoPanner", () => {
|
||||
BasicTests(AutoPanner);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { AutoWah } from "./AutoWah";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Synth } from "Tone/instrument/Synth";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Synth } from "../instrument/Synth";
|
||||
|
||||
describe("AutoWah", () => {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BitCrusher } from "./BitCrusher";
|
||||
import { FeedbackCombFilter } from "Tone/component/filter/FeedbackCombFilter";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { FeedbackCombFilter } from "../component/filter/FeedbackCombFilter";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("BitCrusher", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Chebyshev } from "./Chebyshev";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Synth } from "Tone/instrument";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Synth } from "../instrument";
|
||||
|
||||
describe("Chebyshev", () => {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Chorus } from "./Chorus";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
|
||||
describe("Chorus", () => {
|
||||
BasicTests(Chorus);
|
||||
|
|
|
@ -45,12 +45,12 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
|
|||
/**
|
||||
* the lfo which controls the delayTime
|
||||
*/
|
||||
private _lfoL: LFO
|
||||
private _lfoL: LFO;
|
||||
|
||||
/**
|
||||
* another LFO for the right side with a 180 degree phase diff
|
||||
*/
|
||||
private _lfoR: LFO
|
||||
private _lfoR: LFO;
|
||||
|
||||
/**
|
||||
* delay for left
|
||||
|
@ -65,7 +65,7 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
|
|||
/**
|
||||
* The frequency of the LFO which modulates the delayTime.
|
||||
*/
|
||||
readonly frequency: Signal<"frequency">
|
||||
readonly frequency: Signal<"frequency">;
|
||||
|
||||
/**
|
||||
* @param frequency The frequency of the LFO.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { Distortion } from "./Distortion";
|
||||
|
||||
describe("Distortion", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { FeedbackDelay } from "./FeedbackDelay";
|
||||
import { FeedbackEffect } from "./FeedbackEffect";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Freeverb } from "./Freeverb";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Freeverb", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { FrequencyShifter } from "./FrequencyShifter";
|
||||
|
||||
describe("FrequencyShifter", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { JCReverb } from "./JCReverb";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Noise } from "Tone/source/Noise";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Noise } from "../source/Noise";
|
||||
|
||||
describe("JCReverb", () => {
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export class JCReverb extends StereoEffect<JCReverbOptions> {
|
|||
/**
|
||||
* Room size control values.
|
||||
*/
|
||||
readonly roomSize: Signal<"normalRange">
|
||||
readonly roomSize: Signal<"normalRange">;
|
||||
|
||||
/**
|
||||
* Scale the room size
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Phaser } from "./Phaser";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { ToneAudioBuffer } from "Tone/core";
|
||||
import { Player } from "Tone/source/buffer/Player";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { ToneAudioBuffer } from "../core";
|
||||
import { Player } from "../source/buffer/Player";
|
||||
|
||||
describe("Phaser", () => {
|
||||
|
||||
|
@ -12,7 +12,7 @@ describe("Phaser", () => {
|
|||
EffectTests(Phaser);
|
||||
|
||||
it("matches a file basic", async () => {
|
||||
const buffer = await ToneAudioBuffer.fromUrl("./audio/FWDL.wav");
|
||||
const buffer = await ToneAudioBuffer.fromUrl("./test/audio/FWDL.wav");
|
||||
return CompareToFile(() => {
|
||||
const phaser = new Phaser(2, 6, 200).toDestination();
|
||||
const player = new Player(buffer).connect(phaser).start();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PingPongDelay } from "./PingPongDelay";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
|
||||
describe("PingPongDelay", () => {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PitchShift } from "./PitchShift";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
|
||||
describe("PitchShift", () => {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
import { Reverb } from "./Reverb";
|
||||
|
||||
describe("Reverb", () => {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { StereoWidener } from "./StereoWidener";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer";
|
||||
import { Player } from "Tone/source/buffer/Player";
|
||||
import "test/helper/ToneAudioBuffer";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { ToneAudioBuffer } from "../core/context/ToneAudioBuffer";
|
||||
import { Player } from "../source/buffer/Player";
|
||||
|
||||
describe("StereoWidener", () => {
|
||||
|
||||
|
@ -13,7 +12,7 @@ describe("StereoWidener", () => {
|
|||
EffectTests(StereoWidener, 0);
|
||||
|
||||
it("matches a file basic", async () => {
|
||||
const buffer = await ToneAudioBuffer.fromUrl("./audio/FWDL.wav");
|
||||
const buffer = await ToneAudioBuffer.fromUrl("./test/audio/FWDL.wav");
|
||||
return CompareToFile(() => {
|
||||
const phaser = new StereoWidener(0.1).toDestination();
|
||||
const player = new Player(buffer).connect(phaser).start();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Tremolo } from "./Tremolo";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source";
|
||||
|
||||
describe("Tremolo", () => {
|
||||
BasicTests(Tremolo);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Vibrato } from "./Vibrato";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { EffectTests } from "test/helper/EffectTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { EffectTests } from "../../test/helper/EffectTests";
|
||||
import { expect } from "chai";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Oscillator } from "Tone/source/oscillator/Oscillator";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Oscillator } from "../source/oscillator/Oscillator";
|
||||
|
||||
describe("Vibrato", () => {
|
||||
BasicTests(Vibrato);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Loop } from "Tone/event/Loop";
|
||||
import { Offline, whenBetween } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { Loop } from "./Loop";
|
||||
import { Offline, whenBetween } from "../../test/helper/Offline";
|
||||
import { expect } from "chai";
|
||||
import { noOp } from "Tone/core/util/Interface";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { noOp } from "../core/util/Interface";
|
||||
import { Time } from "../core/type/Time";
|
||||
|
||||
describe("Loop", () => {
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export class Loop<Options extends LoopOptions = LoopOptions> extends ToneWithCon
|
|||
/**
|
||||
* The callback to invoke with the next event in the pattern
|
||||
*/
|
||||
callback: (time: Seconds) => void
|
||||
callback: (time: Seconds) => void;
|
||||
|
||||
/**
|
||||
* @param callback The callback to invoke at the time.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { noOp } from "Tone/core/util/Interface";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../test/helper/Offline";
|
||||
import { Time } from "../core/type/Time";
|
||||
import { noOp } from "../core/util/Interface";
|
||||
import { Part } from "./Part";
|
||||
import { Sequence } from "./Sequence";
|
||||
import { ToneEvent } from "./ToneEvent";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BasicTests } from "test/helper/Basic";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { Pattern } from "./Pattern";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
import { Time } from "../core/type/Time";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Pattern", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { atTime, Offline } from "test/helper/Offline";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { noOp } from "Tone/core/util/Interface";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { atTime, Offline } from "../../test/helper/Offline";
|
||||
import { Time } from "../core/type/Time";
|
||||
import { noOp } from "../core/util/Interface";
|
||||
import { Sequence } from "./Sequence";
|
||||
|
||||
describe("Sequence", () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { Offline, whenBetween } from "test/helper/Offline";
|
||||
import { Time } from "Tone/core/type/Time";
|
||||
import { noOp } from "Tone/core/util/Interface";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { Offline, whenBetween } from "../../test/helper/Offline";
|
||||
import { Time } from "../core/type/Time";
|
||||
import { noOp } from "../core/util/Interface";
|
||||
import { ToneEvent } from "./ToneEvent";
|
||||
|
||||
describe("ToneEvent", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { AMSynth } from "./AMSynth";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { InstrumentTest } from "test/helper/InstrumentTests";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { InstrumentTest } from "../../test/helper/InstrumentTests";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { expect } from "chai";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
|
||||
describe("AMSynth", () => {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasicTests } from "test/helper/Basic";
|
||||
import { InstrumentTest } from "test/helper/InstrumentTests";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { InstrumentTest } from "../../test/helper/InstrumentTests";
|
||||
import { DuoSynth } from "./DuoSynth";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { expect } from "chai";
|
||||
import { MonophonicTest } from "test/helper/MonophonicTests";
|
||||
import { MonophonicTest } from "../../test/helper/MonophonicTests";
|
||||
|
||||
describe("DuoSynth", () => {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { expect } from "chai";
|
||||
import { FMSynth } from "./FMSynth";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { InstrumentTest } from "test/helper/InstrumentTests";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
import { Offline } from "test/helper/Offline";
|
||||
import { BasicTests } from "../../test/helper/Basic";
|
||||
import { InstrumentTest } from "../../test/helper/InstrumentTests";
|
||||
import { CompareToFile } from "../../test/helper/CompareToFile";
|
||||
import { Offline } from "../../test/helper/Offline";
|
||||
|
||||
describe("FMSynth", () => {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue