WIP moving tests to web-test-runner

This commit is contained in:
Yotam Mann 2024-05-01 15:55:52 -04:00
parent 066e46f4c3
commit 7eec743b18
169 changed files with 11189 additions and 5951 deletions

View file

@ -1,6 +1,6 @@
module.exports = { module.exports = {
parser: "@typescript-eslint/parser", parser: "@typescript-eslint/parser",
plugins: ["jsdoc", "html"], plugins: ["jsdoc", "html", "import"],
extends: ["plugin:@typescript-eslint/recommended"], extends: ["plugin:@typescript-eslint/recommended"],
rules: { rules: {
"prefer-rest-params": "off", "prefer-rest-params": "off",
@ -86,5 +86,6 @@ module.exports = {
"error", "error",
{ functions: "always", keywords: "always", classes: "always" }, { functions: "always", keywords: "always", classes: "always" },
], ],
"import/no-absolute-path": "error",
}, },
}; };

View file

@ -30,8 +30,6 @@ jobs:
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- name: Build
run: npm run build
- name: All tests - name: All tests
run: npm run test run: npm run test
- name: Upload coverage - name: Upload coverage

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Noise } from "../../source/Noise"; import { Noise } from "../../source/Noise";
import { Analyser } from "./Analyser"; import { Analyser } from "./Analyser";

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests, warns } from "test/helper/Basic"; import { BasicTests, warns } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { DCMeter } from "./DCMeter"; import { DCMeter } from "./DCMeter";
describe("DCMeter", () => { describe("DCMeter", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { Noise } from "Tone/source/Noise"; import { Noise } from "../../source/Noise";
import { FFT } from "./FFT"; import { FFT } from "./FFT";
describe("FFT", () => { describe("FFT", () => {

View file

@ -1,8 +1,8 @@
import { Follower } from "./Follower"; import { Follower } from "./Follower";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { expect } from "chai"; import { expect } from "chai";
describe("Follower", () => { describe("Follower", () => {

View file

@ -1,12 +1,12 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests, warns } from "test/helper/Basic"; import { BasicTests, warns } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { Meter } from "./Meter"; import { Meter } from "./Meter";
import { Panner } from "Tone/component/channel/Panner"; import { Panner } from "../channel/Panner";
import { Merge } from "Tone/component/channel/Merge"; import { Merge } from "../channel/Merge";
describe("Meter", () => { describe("Meter", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { Noise } from "Tone/source/Noise"; import { Noise } from "../../source/Noise";
import { Waveform } from "./Waveform"; import { Waveform } from "./Waveform";
describe("Waveform", () => { describe("Waveform", () => {

View file

@ -1,8 +1,8 @@
import { Channel } from "./Channel"; import { Channel } from "./Channel";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { expect } from "chai"; import { expect } from "chai";
describe("Channel", () => { describe("Channel", () => {

View file

@ -1,7 +1,7 @@
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { ConstantOutput } from "test/helper/ConstantOutput"; import { ConstantOutput } from "../../../test/helper/ConstantOutput";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { CrossFade } from "./CrossFade"; import { CrossFade } from "./CrossFade";
describe("CrossFade", () => { describe("CrossFade", () => {

View file

@ -1,9 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Merge } from "./Merge"; import { Merge } from "./Merge";
describe("Merge", () => { describe("Merge", () => {

View file

@ -1,7 +1,7 @@
import { MidSideMerge } from "./MidSideMerge"; import { MidSideMerge } from "./MidSideMerge";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
describe("MidSideMerge", () => { describe("MidSideMerge", () => {

View file

@ -1,10 +1,10 @@
import { MidSideSplit } from "./MidSideSplit"; import { MidSideSplit } from "./MidSideSplit";
import { MidSideMerge } from "./MidSideMerge"; import { MidSideMerge } from "./MidSideMerge";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Merge } from "./Merge"; import { Merge } from "./Merge";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { expect } from "chai"; import { expect } from "chai";
describe("MidSideSplit", () => { describe("MidSideSplit", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { StereoSignal } from "test/helper/StereoSignal"; import { StereoSignal } from "../../../test/helper/StereoSignal";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Mono } from "./Mono"; import { Mono } from "./Mono";
describe("Mono", () => { describe("Mono", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { MultibandSplit } from "./MultibandSplit"; import { MultibandSplit } from "./MultibandSplit";
describe("MultibandSplit", () => { describe("MultibandSplit", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { PanVol } from "./PanVol"; import { PanVol } from "./PanVol";
describe("PanVol", () => { describe("PanVol", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Panner } from "./Panner"; import { Panner } from "./Panner";
describe("Panner", () => { describe("Panner", () => {

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Panner3D } from "./Panner3D"; import { Panner3D } from "./Panner3D";
describe("Panner3D", () => { describe("Panner3D", () => {

View file

@ -1,9 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import { connectFrom } from "test/helper/Connect"; import { connectFrom } from "../../../test/helper/Connect";
import { Recorder } from "./Recorder"; import { Recorder } from "./Recorder";
import { Context } from "Tone/core/context/Context"; import { Context } from "../../core/context/Context";
import { ToneWithContext } from "Tone/core/context/ToneWithContext"; import { ToneWithContext } from "../../core/context/ToneWithContext";
import { Synth } from "Tone/instrument/Synth"; import { Synth } from "../../instrument/Synth";
describe("Recorder", () => { describe("Recorder", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { ConstantOutput } from "test/helper/ConstantOutput"; import { ConstantOutput } from "../../../test/helper/ConstantOutput";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Solo } from "./Solo"; import { Solo } from "./Solo";
describe("Solo", () => { describe("Solo", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectTo } from "test/helper/Connect"; import { connectTo } from "../../../test/helper/Connect";
import { ConstantOutput } from "test/helper/ConstantOutput"; import { ConstantOutput } from "../../../test/helper/ConstantOutput";
import { StereoSignal } from "test/helper/StereoSignal"; import { StereoSignal } from "../../../test/helper/StereoSignal";
import { Split } from "./Split"; import { Split } from "./Split";
describe("Split", () => { describe("Split", () => {

View file

@ -1,9 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Volume } from "./Volume"; import { Volume } from "./Volume";
describe("Volume", () => { describe("Volume", () => {

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Compressor } from "./Compressor"; import { Compressor } from "./Compressor";
describe("Compressor", () => { describe("Compressor", () => {

View file

@ -1,16 +1,16 @@
import { Gate } from "./Gate"; import { Gate } from "./Gate";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../../test/helper/CompareToFile";
import { expect } from "chai"; import { expect } from "chai";
describe("Gate", () => { describe("Gate", () => {
BasicTests(Gate); BasicTests(Gate);
it("matches a file", () => { it.only("matches a file", () => {
return CompareToFile(() => { return CompareToFile(() => {
const gate = new Gate(-10, 0.1).toDestination(); const gate = new Gate(-10, 0.1).toDestination();
const osc = new Oscillator().connect(gate); const osc = new Oscillator().connect(gate);

View file

@ -1,6 +1,6 @@
import { Limiter } from "./Limiter"; import { Limiter } from "./Limiter";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { expect } from "chai"; import { expect } from "chai";
describe("Limiter", () => { describe("Limiter", () => {

View file

@ -32,7 +32,7 @@ export class Limiter extends ToneAudioNode<LimiterOptions> {
*/ */
private _compressor: Compressor; private _compressor: Compressor;
readonly threshold: Param<"decibels"> readonly threshold: Param<"decibels">;
/** /**
* @param threshold The threshold above which the gain reduction is applied. * @param threshold The threshold above which the gain reduction is applied.

View file

@ -1,6 +1,6 @@
import { MidSideCompressor } from "./MidSideCompressor"; import { MidSideCompressor } from "./MidSideCompressor";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { expect } from "chai"; import { expect } from "chai";
describe("MidSideCompressor", () => { describe("MidSideCompressor", () => {

View file

@ -1,6 +1,6 @@
import { MultibandCompressor } from "./MultibandCompressor"; import { MultibandCompressor } from "./MultibandCompressor";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { expect } from "chai"; import { expect } from "chai";
describe("MultibandCompressor", () => { describe("MultibandCompressor", () => {

View file

@ -1,10 +1,10 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../../test/helper/CompareToFile";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { AmplitudeEnvelope } from "./AmplitudeEnvelope"; import { AmplitudeEnvelope } from "./AmplitudeEnvelope";
import { Envelope } from "./Envelope"; import { Envelope } from "./Envelope";

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectTo } from "test/helper/Connect"; import { connectTo } from "../../../test/helper/Connect";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Envelope, EnvelopeCurve } from "./Envelope"; import { Envelope, EnvelopeCurve } from "./Envelope";
describe("Envelope", () => { describe("Envelope", () => {

View file

@ -71,7 +71,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
* @max 2 * @max 2
*/ */
@timeRange(0) @timeRange(0)
attack: Time; attack: Time;
/** /**
* After the attack portion of the envelope, the value will fall * After the attack portion of the envelope, the value will fall
@ -91,7 +91,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
* @max 2 * @max 2
*/ */
@timeRange(0) @timeRange(0)
decay: Time; decay: Time;
/** /**
* The sustain value is the value * The sustain value is the value
@ -110,7 +110,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
* ``` * ```
*/ */
@range(0, 1) @range(0, 1)
sustain: NormalRange; sustain: NormalRange;
/** /**
* After triggerRelease is called, the envelope's * After triggerRelease is called, the envelope's
@ -131,7 +131,7 @@ export class Envelope extends ToneAudioNode<EnvelopeOptions> {
* @max 5 * @max 5
*/ */
@timeRange(0) @timeRange(0)
release: Time; release: Time;
/** /**
* The automation curve type for the attack * The automation curve type for the attack

View file

@ -1,8 +1,8 @@
import { FrequencyEnvelope } from "Tone/component/envelope/FrequencyEnvelope"; import { FrequencyEnvelope } from "./FrequencyEnvelope";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { Envelope } from "Tone/component/envelope/Envelope"; import { Envelope } from "./Envelope";
import { expect } from "chai"; import { expect } from "chai";
describe("FrequencyEnvelope", () => { describe("FrequencyEnvelope", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Oscillator } from "../../source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { BiquadFilter } from "./BiquadFilter"; import { BiquadFilter } from "./BiquadFilter";

View file

@ -1,20 +1,15 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer"; import { ToneAudioBuffer } from "../../core/context/ToneAudioBuffer";
import { Convolver } from "./Convolver"; import { Convolver } from "./Convolver";
// @ts-ignore
if (window.__karma__) {
ToneAudioBuffer.baseUrl = "/base/test/";
}
describe("Convolver", () => { describe("Convolver", () => {
BasicTests(Convolver); BasicTests(Convolver);
const ir = new ToneAudioBuffer(); const ir = new ToneAudioBuffer();
const testFile = "./audio/sineStereo.wav"; const testFile = "./test/audio/sineStereo.wav";
before(() => { before(() => {
return ir.load(testFile); return ir.load(testFile);

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom } from "test/helper/Connect"; import { connectFrom } from "../../../test/helper/Connect";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { EQ3 } from "./EQ3"; import { EQ3 } from "./EQ3";
describe("EQ3", () => { describe("EQ3", () => {

View file

@ -1,10 +1,10 @@
import { expect } from "chai"; import { expect } from "chai";
import { FeedbackCombFilter } from "./FeedbackCombFilter"; import { FeedbackCombFilter } from "./FeedbackCombFilter";
import { BitCrusher } from "Tone/effect/BitCrusher"; import { BitCrusher } from "../../effect/BitCrusher";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { Signal } from "Tone/signal"; import { Signal } from "../../signal";
describe("FeedbackCombFilter", () => { describe("FeedbackCombFilter", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Oscillator } from "../../source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { Filter, FilterRollOff } from "./Filter"; import { Filter, FilterRollOff } from "./Filter";

View file

@ -1,8 +1,8 @@
import { LowpassCombFilter } from "./LowpassCombFilter"; import { LowpassCombFilter } from "./LowpassCombFilter";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { expect } from "chai"; import { expect } from "chai";
describe("LowpassCombFilter", () => { describe("LowpassCombFilter", () => {

View file

@ -1,10 +1,10 @@
import { OnePoleFilter } from "./OnePoleFilter"; import { OnePoleFilter } from "./OnePoleFilter";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../../test/helper/CompareToFile";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../../test/helper/Offline";
describe("OnePoleFilter", () => { describe("OnePoleFilter", () => {

View file

@ -1,9 +1,9 @@
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../../test/helper/CompareToFile";
import { connectTo } from "test/helper/Connect"; import { connectTo } from "../../../test/helper/Connect";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { connect } from "Tone/core/context/ToneAudioNode"; import { connect } from "../../core/context/ToneAudioNode";
import { Subtract } from "Tone/signal/Subtract"; import { Subtract } from "../../signal/Subtract";
import { PhaseShiftAllpass } from "./PhaseShiftAllpass"; import { PhaseShiftAllpass } from "./PhaseShiftAllpass";
describe("PhaseShiftAllpass", () => { describe("PhaseShiftAllpass", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { atTime, Offline, whenBetween } from "test/helper/Offline"; import { atTime, Offline, whenBetween } from "../../../test/helper/Offline";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { noOp } from "../util/Interface"; import { noOp } from "../util/Interface";
import { Clock } from "./Clock"; import { Clock } from "./Clock";

View file

@ -1,7 +1,5 @@
import { Compare, Plot } from "@tonejs/plot"; import { BasicTests, testAudioContext } from "../../../test/helper/Basic";
import { expect } from "chai"; // 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"; import { TickParam } from "./TickParam";
describe("TickParam", () => { describe("TickParam", () => {

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { TickSignal } from "./TickSignal"; import { TickSignal } from "./TickSignal";
describe("TickSignal", () => { describe("TickSignal", () => {

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { TickSource } from "./TickSource"; import { TickSource } from "./TickSource";
describe("TickSource", () => { describe("TickSource", () => {

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { Ticker } from "./Ticker"; import { Ticker } from "./Ticker";
describe("Ticker", () => { describe("Ticker", () => {

View file

@ -1,14 +1,14 @@
import { expect } from "chai"; import { expect } from "chai";
import { atTime, Offline, whenBetween } from "test/helper/Offline"; import { atTime, Offline, whenBetween } from "../../../test/helper/Offline";
import { Time } from "Tone/core/type/Time"; import { Time } from "../type/Time";
import { noOp } from "Tone/core/util/Interface"; import { noOp } from "../util/Interface";
import { Signal } from "../../signal/Signal"; import { Signal } from "../../signal/Signal";
import { TransportTime } from "../type/TransportTime"; import { TransportTime } from "../type/TransportTime";
import { TransportClass } from "./Transport"; import { TransportClass } from "./Transport";
// importing for side affects // importing for side affects
import "../context/Destination"; import "../context/Destination";
import { warns } from "test/helper/Basic"; import { warns } from "../../../test/helper/Basic";
import { Synth } from "Tone/instrument/Synth"; import { Synth } from "../../instrument/Synth";
describe("Transport", () => { describe("Transport", () => {

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { TransportClass } from "./Transport"; import { TransportClass } from "./Transport";
import { TransportEvent } from "./TransportEvent"; import { TransportEvent } from "./TransportEvent";

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { TransportClass } from "./Transport"; import { TransportClass } from "./Transport";
import { TransportRepeatEvent } from "./TransportRepeatEvent"; import { TransportRepeatEvent } from "./TransportRepeatEvent";

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { ConstantOutput } from "test/helper/ConstantOutput"; import { ConstantOutput } from "../../../test/helper/ConstantOutput";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { TransportClass } from "../clock/Transport"; import { TransportClass } from "../clock/Transport";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { createAudioContext } from "./AudioContext"; import { createAudioContext } from "./AudioContext";

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { connect } from "../context/ToneAudioNode"; import { connect } from "../context/ToneAudioNode";
import { Delay } from "./Delay"; import { Delay } from "./Delay";

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { warns } from "test/helper/Basic"; import { warns } from "../../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../../source/oscillator/Oscillator";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { DestinationClass } from "./Destination"; import { DestinationClass } from "./Destination";

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { connectFrom, connectTo } from "test/helper/Connect"; import { connectFrom, connectTo } from "../../../test/helper/Connect";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Gain } from "./Gain"; import { Gain } from "./Gain";
describe("Gain", () => { describe("Gain", () => {

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { ListenerClass } from "./Listener"; import { ListenerClass } from "./Listener";

View file

@ -33,47 +33,47 @@ export class ListenerClass extends ToneAudioNode<ListenerOptions> {
readonly positionX: Param = new Param({ readonly positionX: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.positionX, param: this.context.rawContext.listener.positionX,
}) });
readonly positionY: Param = new Param({ readonly positionY: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.positionY, param: this.context.rawContext.listener.positionY,
}) });
readonly positionZ: Param = new Param({ readonly positionZ: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.positionZ, param: this.context.rawContext.listener.positionZ,
}) });
readonly forwardX: Param = new Param({ readonly forwardX: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.forwardX, param: this.context.rawContext.listener.forwardX,
}) });
readonly forwardY: Param = new Param({ readonly forwardY: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.forwardY, param: this.context.rawContext.listener.forwardY,
}) });
readonly forwardZ: Param = new Param({ readonly forwardZ: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.forwardZ, param: this.context.rawContext.listener.forwardZ,
}) });
readonly upX: Param = new Param({ readonly upX: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.upX, param: this.context.rawContext.listener.upX,
}) });
readonly upY: Param = new Param({ readonly upY: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.upY, param: this.context.rawContext.listener.upY,
}) });
readonly upZ: Param = new Param({ readonly upZ: Param = new Param({
context: this.context, context: this.context,
param: this.context.rawContext.listener.upZ, param: this.context.rawContext.listener.upZ,
}) });
static getDefaults(): ListenerOptions { static getDefaults(): ListenerOptions {
return Object.assign(ToneAudioNode.getDefaults(), { return Object.assign(ToneAudioNode.getDefaults(), {

View file

@ -1,6 +1,6 @@
import { TestAudioBuffer } from "@tonejs/plot"; import { TestAudioBuffer } from "../../../test/helper/compare/TestAudioBuffer";
import { expect } from "chai"; import { expect } from "chai";
import { ToneOscillatorNode } from "Tone/source/oscillator/ToneOscillatorNode"; import { ToneOscillatorNode } from "../../source/oscillator/ToneOscillatorNode";
import { noOp } from "../util/Interface"; import { noOp } from "../util/Interface";
import { Offline } from "./Offline"; import { Offline } from "./Offline";
import { ToneAudioBuffer } from "./ToneAudioBuffer"; import { ToneAudioBuffer } from "./ToneAudioBuffer";

View file

@ -2,6 +2,8 @@ import { getContext, setContext } from "../Global";
import { Seconds } from "../type/Units"; import { Seconds } from "../type/Units";
import { OfflineContext } from "./OfflineContext"; import { OfflineContext } from "./OfflineContext";
import { ToneAudioBuffer } from "./ToneAudioBuffer"; 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. * Generate a buffer by rendering all of the Tone.js code within the callback using the OfflineAudioContext.

View file

@ -1,10 +1,10 @@
import { Compare, Plot } from "@tonejs/plot"; import { Compare, Plot } from "../../../test/helper/compare/index";
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests, testAudioContext } from "test/helper/Basic"; import { BasicTests, testAudioContext } from "../../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../../test/helper/Offline";
import { SCHEDULE_RAMP_AFTER_SET_TARGET } from "test/helper/Supports"; 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 { BPM, Decibels, Frequency, Positive, Seconds, Time, Unit, UnitName } from "../type/Units";
import { Signal } from "Tone/signal/Signal"; import { Signal } from "../../signal/Signal";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { Param } from "./Param"; import { Param } from "./Param";
import { connect } from "./ToneAudioNode"; 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); 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); expect(param.getValueAtTime(0.91)).to.be.closeTo(0.75, 0.01);
}, 1, 1, sampleRate); }, 1, 1, sampleRate);
document.body.appendChild(await Plot.signal(testBuffer)); // document.body.appendChild(await Plot.signal(testBuffer));
matchesOutputCurve(param, testBuffer); matchesOutputCurve(param, testBuffer);
}); });
@ -132,7 +132,7 @@ describe("Param", () => {
param.cancelScheduledValues(1.2); param.cancelScheduledValues(1.2);
param.linearRampToValueAtTime(1, 1.3); param.linearRampToValueAtTime(1, 1.3);
}, 1.5, 1, sampleRate); }, 1.5, 1, sampleRate);
document.body.appendChild(await Plot.signal(testBuffer)); // document.body.appendChild(await Plot.signal(testBuffer));
matchesOutputCurve(param, testBuffer); matchesOutputCurve(param, testBuffer);
}); });
@ -289,7 +289,7 @@ describe("Param", () => {
for (let time = 0.41; time < 2; time += 0.1) { for (let time = 0.41; time < 2; time += 0.1) {
expect(buffer.getValueAtTime(time)).to.be.closeTo(sig.getValueAtTime(time), 0.01); 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));
}); });
}); });

View file

@ -1,9 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import "test/helper/ToneAudioBuffer";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { ToneAudioBuffer } from "./ToneAudioBuffer"; import { ToneAudioBuffer } from "./ToneAudioBuffer";
const testFile = "./audio/sine.wav"; const testFile = "./test/audio/sine.wav";
describe("ToneAudioBuffer", () => { describe("ToneAudioBuffer", () => {
@ -141,12 +140,12 @@ describe("ToneAudioBuffer", () => {
}); });
it("can load a file with fallback extensions", async () => { 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; expect(buffer).to.exist;
}); });
it("takes the first supported format when multiple extensions are provided", async () => { 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; expect(buffer).to.exist;
}); });
@ -163,7 +162,7 @@ describe("ToneAudioBuffer", () => {
}); });
it("invokes the error callback if the file is corrupt", done => { 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"); throw new Error("shouldn't invoke this function");
}, e => { }, e => {
buffer.dispose(); buffer.dispose();

View file

@ -1,10 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import "test/helper/ToneAudioBuffer";
import { ToneAudioBuffer } from "./ToneAudioBuffer"; import { ToneAudioBuffer } from "./ToneAudioBuffer";
import { ToneAudioBuffers } from "./ToneAudioBuffers"; import { ToneAudioBuffers } from "./ToneAudioBuffers";
const testFile = "./audio/sine.wav"; const testFile = "./test/audio/sine.wav";
const testFile2 = "./audio/hh.wav"; const testFile2 = "./test/audio/hh.wav";
describe("ToneAudioBuffers", () => { describe("ToneAudioBuffers", () => {
it("can be created and disposed", () => { 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 => { it("can pass in buffers as object and options object in second arg", done => {
const buffer = new ToneAudioBuffers({ const buffer = new ToneAudioBuffers({
baseUrl: "./audio/", baseUrl: "./test/audio/",
onload(): void { onload(): void {
expect(buffer.has("sine")).to.be.true; expect(buffer.has("sine")).to.be.true;
buffer.dispose(); buffer.dispose();
@ -103,7 +102,7 @@ describe("ToneAudioBuffers", () => {
expect(buffer.get("hat")).to.be.instanceof(ToneAudioBuffer); expect(buffer.get("hat")).to.be.instanceof(ToneAudioBuffer);
buffer.dispose(); buffer.dispose();
done(); done();
}, "./audio/"); }, "./test/audio/");
}); });
it("can add a buffer", done => { it("can add a buffer", done => {

View file

@ -1,11 +1,11 @@
import { expect } from "chai"; import { expect } from "chai";
import { Merge } from "Tone/component"; import { Merge } from "../../component";
import { Split } from "Tone/component/channel/Split"; import { Split } from "../../component/channel/Split";
import { Oscillator } from "Tone/source"; import { Oscillator } from "../../source";
import { Gain } from "./Gain"; import { Gain } from "./Gain";
import { connect, disconnect, fanIn } from "./ToneAudioNode"; import { connect, disconnect, fanIn } from "./ToneAudioNode";
import { PassAudio } from "test/helper/PassAudio"; import { PassAudio } from "../../../test/helper/PassAudio";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../../test/helper/Offline";
describe("ToneAudioNode", () => { describe("ToneAudioNode", () => {

View file

@ -1,20 +1,18 @@
import { expect } from "chai"; import { expect } from "chai";
import teoria from "teoria"; import { BasicTests } from "../../../test/helper/Basic";
import { BasicTests } from "test/helper/Basic"; import { Offline } from "../../../test/helper/Offline";
import { Offline } from "test/helper/Offline";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { Frequency, FrequencyClass } from "./Frequency"; import { Frequency, FrequencyClass } from "./Frequency";
import { Midi } from "./Midi"; import { Midi } from "./Midi";
import { Ticks } from "./Ticks"; import { Ticks } from "./Ticks";
import { Time } from "./Time"; import { Time } from "./Time";
import { TransportTime } from "./TransportTime"; import { TransportTime } from "./TransportTime";
import { Note, Midi as TonalMidi } from "tonal";
describe("FrequencyClass", () => { describe("FrequencyClass", () => {
BasicTests(Frequency); BasicTests(Frequency);
context("Constructor", () => { context("Constructor", () => {
it("can be made with or without 'new'", () => { it("can be made with or without 'new'", () => {
const f0 = Frequency(); const f0 = Frequency();
expect(f0).to.be.instanceOf(FrequencyClass); expect(f0).to.be.instanceOf(FrequencyClass);
@ -73,9 +71,15 @@ describe("FrequencyClass", () => {
}); });
it("can convert from Midi", () => { it("can convert from Midi", () => {
expect(Frequency(Midi("C4")).valueOf()).to.equal(Frequency("C4").valueOf()); expect(Frequency(Midi("C4")).valueOf()).to.equal(
expect(Frequency(Midi(60)).valueOf()).to.equal(Frequency("C4").valueOf()); Frequency("C4").valueOf()
expect(Frequency(Midi(61)).valueOf()).to.equal(Frequency("C#4").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", () => { it("can convert from Ticks", () => {
@ -87,7 +91,6 @@ describe("FrequencyClass", () => {
}); });
context("Eval Types", () => { context("Eval Types", () => {
it("evaluates numbers as frequency", () => { it("evaluates numbers as frequency", () => {
expect(Frequency("1").valueOf()).to.equal(1); expect(Frequency("1").valueOf()).to.equal(1);
expect(Frequency("123").valueOf()).to.equal(123); expect(Frequency("123").valueOf()).to.equal(123);
@ -130,8 +133,14 @@ describe("FrequencyClass", () => {
}); });
it("evalutes midi", () => { it("evalutes midi", () => {
expect(Frequency(48, "midi").valueOf()).to.be.closeTo(teoria.Note.fromMIDI(48).fq(), 0.0001); expect(Frequency(48, "midi").valueOf()).to.be.closeTo(
expect(Frequency(69, "midi").valueOf()).to.be.closeTo(teoria.Note.fromMIDI(69).fq(), 0.0001); TonalMidi.midiToFreq(48),
0.0001
);
expect(Frequency(69, "midi").valueOf()).to.be.closeTo(
TonalMidi.midiToFreq(69),
0.0001
);
}); });
it("evalutes hz", () => { it("evalutes hz", () => {
@ -140,41 +149,105 @@ describe("FrequencyClass", () => {
}); });
it("can convert notes into frequencies", () => { it("can convert notes into frequencies", () => {
expect(Frequency("C4").valueOf()).to.be.closeTo(teoria.note("C4").fq(), 0.0001); expect(Frequency("C4").valueOf()).to.be.closeTo(
expect(Frequency("D4").valueOf()).to.be.closeTo(teoria.note("D4").fq(), 0.0001); Note.freq("C4") as number,
expect(Frequency("Db4").valueOf()).to.be.closeTo(teoria.note("Db4").fq(), 0.0001); 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("D4").valueOf()).to.be.closeTo(
expect(Frequency("Gb-1").valueOf()).to.be.closeTo(teoria.note("Gb-1").fq(), 0.0001); Note.freq("D4") as number,
expect(Frequency("A#10").valueOf()).to.be.closeTo(teoria.note("A#10").fq(), 0.0001); 0.0001
expect(Frequency("Bb2").valueOf()).to.be.closeTo(teoria.note("Bb2").fq(), 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", () => { it("handles double accidentals", () => {
expect(Frequency("Cbb4").valueOf()).to.be.closeTo(teoria.note("Cbb4").fq(), 0.0001); expect(Frequency("Cbb4").valueOf()).to.be.closeTo(
expect(Frequency("Dx4").valueOf()).to.be.closeTo(teoria.note("Dx4").fq(), 0.0001); Note.freq("Cbb4") as number,
expect(Frequency("Dbb4").valueOf()).to.be.closeTo(teoria.note("Dbb4").fq(), 0.0001); 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("Dx4").valueOf()).to.be.closeTo(
expect(Frequency("Gbb-1").valueOf()).to.be.closeTo(teoria.note("Gbb-1").fq(), 0.0001); Note.freq("Dx4") as number,
expect(Frequency("Ax10").valueOf()).to.be.closeTo(teoria.note("Ax10").fq(), 0.0001); 0.0001
expect(Frequency("Bbb2").valueOf()).to.be.closeTo(teoria.note("Bbb2").fq(), 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", () => { it("can accomidate different concert tuning", () => {
FrequencyClass.A4 = 444; FrequencyClass.A4 = 444;
expect(Frequency("C4").valueOf()).to.be.closeTo(teoria.note("C4").fq(FrequencyClass.A4), 0.0001); expect(Frequency("C4").valueOf()).to.be.closeTo(
expect(Frequency("D1").valueOf()).to.be.closeTo(teoria.note("D1").fq(FrequencyClass.A4), 0.0001); 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; 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 // return it to normal
FrequencyClass.A4 = 440; FrequencyClass.A4 = 440;
}); });
}); });
context("transpose/harmonize", () => { context("transpose/harmonize", () => {
it("can transpose a value", () => { it("can transpose a value", () => {
expect(Frequency("A4").transpose(3).toMidi()).to.equal(72); expect(Frequency("A4").transpose(3).toMidi()).to.equal(72);
expect(Frequency("A4").transpose(-3).toMidi()).to.equal(66); expect(Frequency("A4").transpose(-3).toMidi()).to.equal(66);
@ -184,31 +257,48 @@ describe("FrequencyClass", () => {
it("can harmonize a value", () => { it("can harmonize a value", () => {
expect(Frequency("A4").harmonize([0, 3])).to.be.an("array"); 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]).length).to.equal(2);
expect(Frequency("A4").harmonize([0, 3])[0].toNote()).to.equal("A4"); expect(Frequency("A4").harmonize([0, 3])[0].toNote()).to.equal(
expect(Frequency("A4").harmonize([0, 3])[1].toNote()).to.equal("C5"); "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])).to.be.an("array");
expect(Frequency("A4").harmonize([-12, 0, 12]).length).to.equal(3); expect(Frequency("A4").harmonize([-12, 0, 12]).length).to.equal(3);
expect(Frequency("A4").harmonize([-12, 0, 12])[0].toNote()).to.equal("A3"); expect(
expect(Frequency("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal("A4"); Frequency("A4").harmonize([-12, 0, 12])[0].toNote()
expect(Frequency("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal("A5"); ).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", () => { context("Conversions", () => {
it("can convert frequencies into notes", () => { it("can convert frequencies into notes", () => {
expect(Frequency(261.625).toNote()).to.equal(teoria.Note.fromFrequency(261.625).note.scientific()); expect(Frequency(261.625).toNote()).to.equal(
expect(Frequency(440).toNote()).to.equal(teoria.Note.fromFrequency(440).note.scientific()); Note.fromFreq(261.625)
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(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"); expect(Frequency(4979).toNote()).to.equal("D#8");
}); });
it("can convert note to midi values", () => { it("can convert note to midi values", () => {
expect(Frequency("C4").toMidi()).to.equal(teoria.note("C4").midi()); expect(Frequency("C4").toMidi()).to.equal(
expect(Frequency("C#0").toMidi()).to.equal(teoria.note("C#0").midi()); TonalMidi.toMidi("C4") as number
expect(Frequency("A-4").toMidi()).to.equal(teoria.note("A-4").midi()); );
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", () => { it("can convert hertz to seconds", () => {
@ -216,5 +306,4 @@ describe("FrequencyClass", () => {
expect(Frequency("2hz").toSeconds()).to.equal(0.5); expect(Frequency("2hz").toSeconds()).to.equal(0.5);
}); });
}); });
}); });

View file

@ -1,19 +1,17 @@
import { expect } from "chai"; import { expect } from "chai";
import teoria from "teoria"; import { BasicTests } from "../../../test/helper/Basic";
import { BasicTests } from "test/helper/Basic"; import { Offline } from "../../../test/helper/Offline";
import { Offline } from "test/helper/Offline";
import { Frequency } from "./Frequency"; import { Frequency } from "./Frequency";
import { Midi, MidiClass } from "./Midi"; import { Midi, MidiClass } from "./Midi";
import { Ticks } from "./Ticks"; import { Ticks } from "./Ticks";
import { Time } from "./Time"; import { Time } from "./Time";
import { TransportTime } from "./TransportTime"; import { TransportTime } from "./TransportTime";
import { Note, Midi as TonalMidi } from "tonal";
describe("MidiClass", () => { describe("MidiClass", () => {
BasicTests(MidiClass); BasicTests(MidiClass);
context("Constructor", () => { context("Constructor", () => {
it("can pass in a number in the constructor", () => { it("can pass in a number in the constructor", () => {
const midi = Midi(1); const midi = Midi(1);
expect(midi).to.be.instanceOf(MidiClass); expect(midi).to.be.instanceOf(MidiClass);
@ -93,28 +91,28 @@ describe("MidiClass", () => {
}); });
context("Conversions", () => { context("Conversions", () => {
it("can convert frequencies into notes", () => { it("can convert frequencies into notes", () => {
expect(Midi(48).toNote()).to.equal(teoria.Note.fromMIDI(48).scientific()); expect(Midi(48).toNote()).to.equal(TonalMidi.midiToNoteName(48));
expect(Midi(90).toNote()).to.equal(teoria.Note.fromMIDI(90).scientific()); expect(Midi(90).toNote()).to.equal(
TonalMidi.midiToNoteName(90, { sharps: true })
);
expect(Midi("C#4").toNote()).to.equal("C#4"); expect(Midi("C#4").toNote()).to.equal("C#4");
}); });
it("can convert note to midi values", () => { it("can convert note to midi values", () => {
expect(Midi("C4").toMidi()).to.equal(teoria.note("C4").midi()); expect(Midi("C4").toMidi()).to.equal(TonalMidi.toMidi("C4"));
expect(Midi("C#0").toMidi()).to.equal(teoria.note("C#0").midi()); expect(Midi("C#0").toMidi()).to.equal(TonalMidi.toMidi("C#0"));
expect(Midi("A-4").toMidi()).to.equal(teoria.note("A-4").midi()); expect(Midi("A-1").toMidi()).to.equal(TonalMidi.toMidi("A-1"));
}); });
it("can convert midi to frequency", () => { it("can convert midi to frequency", () => {
expect(Midi(60).toFrequency()).to.equal(teoria.Note.fromMIDI(60).fq()); expect(Midi(60).toFrequency()).to.equal(TonalMidi.midiToFreq(60));
expect(Midi(25).toFrequency()).to.equal(teoria.Note.fromMIDI(25).fq()); expect(Midi(25).toFrequency()).to.equal(TonalMidi.midiToFreq(25));
expect(Midi(108).toFrequency()).to.equal(teoria.Note.fromMIDI(108).fq()); expect(Midi(108).toFrequency()).to.equal(TonalMidi.midiToFreq(108));
}); });
}); });
context("transpose/harmonize", () => { context("transpose/harmonize", () => {
it("can transpose a value", () => { it("can transpose a value", () => {
expect(Midi("A4").transpose(3).toMidi()).to.equal(72); expect(Midi("A4").transpose(3).toMidi()).to.equal(72);
expect(Midi("A4").transpose(-3).toMidi()).to.equal(66); 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])).to.be.an("array");
expect(Midi("A4").harmonize([-12, 0, 12]).length).to.equal(3); 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])[0].toNote()).to.equal(
expect(Midi("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal("A4"); "A3"
expect(Midi("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal("A5"); );
expect(Midi("A4").harmonize([-12, 0, 12])[1].toNote()).to.equal(
"A4"
);
expect(Midi("A4").harmonize([-12, 0, 12])[2].toNote()).to.equal(
"A5"
);
}); });
}); });
}); });

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../../test/helper/Offline";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { Frequency } from "./Frequency"; import { Frequency } from "./Frequency";
import { Ticks, TicksClass } from "./Ticks"; import { Ticks, TicksClass } from "./Ticks";

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../../test/helper/Offline";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { Frequency } from "./Frequency"; import { Frequency } from "./Frequency";
import { Ticks } from "./Ticks"; import { Ticks } from "./Ticks";

View file

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../../test/helper/Offline";
import { getContext } from "../Global"; import { getContext } from "../Global";
import { Frequency } from "./Frequency"; import { Frequency } from "./Frequency";
import { Ticks } from "./Ticks"; import { Ticks } from "./Ticks";

View file

@ -2,7 +2,7 @@ import { expect } from "chai";
import { ToneOscillatorNode } from "../../source/oscillator/ToneOscillatorNode"; import { ToneOscillatorNode } from "../../source/oscillator/ToneOscillatorNode";
import { assertRange, setLogger } from "./Debug"; import { assertRange, setLogger } from "./Debug";
import { theWindow } from "../context/AudioContext"; import { theWindow } from "../context/AudioContext";
import { Oscillator } from "Tone/source"; import { Oscillator } from "../../source";
import { Context } from "../context/Context"; import { Context } from "../context/Context";
describe("Debug", () => { describe("Debug", () => {

View file

@ -10,15 +10,15 @@ function noCopy(key: string, arg: any): boolean {
return key === "value" || isAudioParam(arg) || isAudioNode(arg) || isAudioBuffer(arg); 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 * Recursively merge an object
* @param target the object to merge into * @param target the object to merge into
* @param sources the source objects to merge * @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 { export function deepMerge(target: any, ...sources: any[]): any {
if (!sources.length) { if (!sources.length) {
return target; return target;

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { ONLINE_TESTING } from "test/helper/Supports"; import { ONLINE_TESTING } from "../../../test/helper/Supports";
import { DrawClass } from "./Draw"; import { DrawClass } from "./Draw";
describe("Draw", () => { describe("Draw", () => {

View file

@ -91,7 +91,7 @@ export class Emitter<EventType extends string = string> extends Tone {
* @param event The name of the event. * @param event The name of the event.
* @param args The arguments to pass to the functions listening. * @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) {
if (this._events.hasOwnProperty(event)) { if (this._events.hasOwnProperty(event)) {
const eventList = this._events[event].slice(0); const eventList = this._events[event].slice(0);

View file

@ -1,5 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../../test/helper/Basic";
import { IntervalTimeline, IntervalTimelineEvent } from "./IntervalTimeline"; import { IntervalTimeline, IntervalTimelineEvent } from "./IntervalTimeline";
describe("IntervalTimeline", () => { describe("IntervalTimeline", () => {

View file

@ -16,7 +16,7 @@ export class TimelineValue<Type> extends Tone {
/** /**
* The timeline which stores the values * 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 * Hold the value to return if there is no scheduled values

View file

@ -1,37 +1,39 @@
import { AutoFilter } from "./AutoFilter"; import { AutoFilter } from "./AutoFilter";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import teoria from "teoria"; import { Note } from "tonal";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Noise } from "Tone/source"; import { Noise } from "../source";
describe("AutoFilter", () => { describe("AutoFilter", () => {
BasicTests(AutoFilter); BasicTests(AutoFilter);
EffectTests(AutoFilter); EffectTests(AutoFilter);
it("matches a file", () => { it("matches a file", () => {
return CompareToFile(() => { return CompareToFile(
const autoFilter = new AutoFilter({ () => {
baseFrequency: 200, const autoFilter = new AutoFilter({
octaves: 4, baseFrequency: 200,
frequency: 4, octaves: 4,
type: "sine" frequency: 4,
}).toDestination(); type: "sine",
new Noise().connect(autoFilter).start(); }).toDestination();
autoFilter.start(0.2); new Noise().connect(autoFilter).start();
}, "autoFilter.wav", 0.1); autoFilter.start(0.2);
},
"autoFilter.wav",
0.1
);
}); });
context("API", () => { context("API", () => {
it("can pass in options in the constructor", () => { it("can pass in options in the constructor", () => {
const autoFilter = new AutoFilter({ const autoFilter = new AutoFilter({
baseFrequency: 2000, baseFrequency: 2000,
octaves: 2, octaves: 2,
type: "sawtooth" type: "sawtooth",
}); });
expect(autoFilter.baseFrequency).to.be.closeTo(2000, 0.1); expect(autoFilter.baseFrequency).to.be.closeTo(2000, 0.1);
expect(autoFilter.octaves).to.equal(2); expect(autoFilter.octaves).to.equal(2);
@ -50,7 +52,7 @@ describe("AutoFilter", () => {
autoFilter.set({ autoFilter.set({
baseFrequency: 1200, baseFrequency: 1200,
frequency: 2.4, frequency: 2.4,
type: "triangle" type: "triangle",
}); });
expect(autoFilter.get().baseFrequency).to.be.closeTo(1200, 0.01); expect(autoFilter.get().baseFrequency).to.be.closeTo(1200, 0.01);
expect(autoFilter.get().frequency).to.be.closeTo(2.4, 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", () => { it("accepts baseFrequency and octaves as frequency values", () => {
const autoFilter = new AutoFilter("2n", "C2", 4); 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); expect(autoFilter.octaves).to.equal(4);
autoFilter.dispose(); autoFilter.dispose();
}); });
it("can sync the frequency to the transport", () => { it("can sync the frequency to the transport", () => {
return Offline(({ transport }) => { return Offline(({ transport }) => {
const autoFilter = new AutoFilter(2); const autoFilter = new AutoFilter(2);
autoFilter.sync(); autoFilter.sync();
@ -96,7 +100,6 @@ describe("AutoFilter", () => {
}); });
it("can unsync the frequency to the transport", () => { it("can unsync the frequency to the transport", () => {
return Offline(({ transport }) => { return Offline(({ transport }) => {
const autoFilter = new AutoFilter(2); const autoFilter = new AutoFilter(2);
autoFilter.sync(); autoFilter.sync();
@ -110,4 +113,3 @@ describe("AutoFilter", () => {
}); });
}); });
}); });

View file

@ -1,10 +1,10 @@
import { AutoPanner } from "./AutoPanner"; import { AutoPanner } from "./AutoPanner";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
describe("AutoPanner", () => { describe("AutoPanner", () => {
BasicTests(AutoPanner); BasicTests(AutoPanner);

View file

@ -1,9 +1,9 @@
import { AutoWah } from "./AutoWah"; import { AutoWah } from "./AutoWah";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Synth } from "Tone/instrument/Synth"; import { Synth } from "../instrument/Synth";
describe("AutoWah", () => { describe("AutoWah", () => {

View file

@ -1,9 +1,9 @@
import { BitCrusher } from "./BitCrusher"; import { BitCrusher } from "./BitCrusher";
import { FeedbackCombFilter } from "Tone/component/filter/FeedbackCombFilter"; import { FeedbackCombFilter } from "../component/filter/FeedbackCombFilter";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { expect } from "chai"; import { expect } from "chai";
describe("BitCrusher", () => { describe("BitCrusher", () => {

View file

@ -1,9 +1,9 @@
import { Chebyshev } from "./Chebyshev"; import { Chebyshev } from "./Chebyshev";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Synth } from "Tone/instrument"; import { Synth } from "../instrument";
describe("Chebyshev", () => { describe("Chebyshev", () => {

View file

@ -1,10 +1,10 @@
import { Chorus } from "./Chorus"; import { Chorus } from "./Chorus";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source"; import { Oscillator } from "../source";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
describe("Chorus", () => { describe("Chorus", () => {
BasicTests(Chorus); BasicTests(Chorus);

View file

@ -45,12 +45,12 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
/** /**
* the lfo which controls the delayTime * the lfo which controls the delayTime
*/ */
private _lfoL: LFO private _lfoL: LFO;
/** /**
* another LFO for the right side with a 180 degree phase diff * another LFO for the right side with a 180 degree phase diff
*/ */
private _lfoR: LFO private _lfoR: LFO;
/** /**
* delay for left * delay for left
@ -65,7 +65,7 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
/** /**
* The frequency of the LFO which modulates the delayTime. * The frequency of the LFO which modulates the delayTime.
*/ */
readonly frequency: Signal<"frequency"> readonly frequency: Signal<"frequency">;
/** /**
* @param frequency The frequency of the LFO. * @param frequency The frequency of the LFO.

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { Distortion } from "./Distortion"; import { Distortion } from "./Distortion";
describe("Distortion", () => { describe("Distortion", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { FeedbackDelay } from "./FeedbackDelay"; import { FeedbackDelay } from "./FeedbackDelay";
import { FeedbackEffect } from "./FeedbackEffect"; import { FeedbackEffect } from "./FeedbackEffect";

View file

@ -1,8 +1,8 @@
import { Freeverb } from "./Freeverb"; import { Freeverb } from "./Freeverb";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { expect } from "chai"; import { expect } from "chai";
describe("Freeverb", () => { describe("Freeverb", () => {

View file

@ -1,9 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { FrequencyShifter } from "./FrequencyShifter"; import { FrequencyShifter } from "./FrequencyShifter";
describe("FrequencyShifter", () => { describe("FrequencyShifter", () => {

View file

@ -1,9 +1,9 @@
import { JCReverb } from "./JCReverb"; import { JCReverb } from "./JCReverb";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Noise } from "Tone/source/Noise"; import { Noise } from "../source/Noise";
describe("JCReverb", () => { describe("JCReverb", () => {

View file

@ -46,7 +46,7 @@ export class JCReverb extends StereoEffect<JCReverbOptions> {
/** /**
* Room size control values. * Room size control values.
*/ */
readonly roomSize: Signal<"normalRange"> readonly roomSize: Signal<"normalRange">;
/** /**
* Scale the room size * Scale the room size

View file

@ -1,10 +1,10 @@
import { Phaser } from "./Phaser"; import { Phaser } from "./Phaser";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { ToneAudioBuffer } from "Tone/core"; import { ToneAudioBuffer } from "../core";
import { Player } from "Tone/source/buffer/Player"; import { Player } from "../source/buffer/Player";
describe("Phaser", () => { describe("Phaser", () => {
@ -12,7 +12,7 @@ describe("Phaser", () => {
EffectTests(Phaser); EffectTests(Phaser);
it("matches a file basic", async () => { 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(() => { return CompareToFile(() => {
const phaser = new Phaser(2, 6, 200).toDestination(); const phaser = new Phaser(2, 6, 200).toDestination();
const player = new Player(buffer).connect(phaser).start(); const player = new Player(buffer).connect(phaser).start();

View file

@ -1,9 +1,9 @@
import { PingPongDelay } from "./PingPongDelay"; import { PingPongDelay } from "./PingPongDelay";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
describe("PingPongDelay", () => { describe("PingPongDelay", () => {

View file

@ -1,9 +1,9 @@
import { PitchShift } from "./PitchShift"; import { PitchShift } from "./PitchShift";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
describe("PitchShift", () => { describe("PitchShift", () => {

View file

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
import { Reverb } from "./Reverb"; import { Reverb } from "./Reverb";
describe("Reverb", () => { describe("Reverb", () => {

View file

@ -1,11 +1,10 @@
import { StereoWidener } from "./StereoWidener"; import { StereoWidener } from "./StereoWidener";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { ToneAudioBuffer } from "Tone/core/context/ToneAudioBuffer"; import { ToneAudioBuffer } from "../core/context/ToneAudioBuffer";
import { Player } from "Tone/source/buffer/Player"; import { Player } from "../source/buffer/Player";
import "test/helper/ToneAudioBuffer";
describe("StereoWidener", () => { describe("StereoWidener", () => {
@ -13,7 +12,7 @@ describe("StereoWidener", () => {
EffectTests(StereoWidener, 0); EffectTests(StereoWidener, 0);
it("matches a file basic", async () => { 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(() => { return CompareToFile(() => {
const phaser = new StereoWidener(0.1).toDestination(); const phaser = new StereoWidener(0.1).toDestination();
const player = new Player(buffer).connect(phaser).start(); const player = new Player(buffer).connect(phaser).start();

View file

@ -1,10 +1,10 @@
import { Tremolo } from "./Tremolo"; import { Tremolo } from "./Tremolo";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source"; import { Oscillator } from "../source";
describe("Tremolo", () => { describe("Tremolo", () => {
BasicTests(Tremolo); BasicTests(Tremolo);

View file

@ -1,9 +1,9 @@
import { Vibrato } from "./Vibrato"; import { Vibrato } from "./Vibrato";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { EffectTests } from "test/helper/EffectTests"; import { EffectTests } from "../../test/helper/EffectTests";
import { expect } from "chai"; import { expect } from "chai";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Oscillator } from "Tone/source/oscillator/Oscillator"; import { Oscillator } from "../source/oscillator/Oscillator";
describe("Vibrato", () => { describe("Vibrato", () => {
BasicTests(Vibrato); BasicTests(Vibrato);

View file

@ -1,9 +1,9 @@
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { Loop } from "Tone/event/Loop"; import { Loop } from "./Loop";
import { Offline, whenBetween } from "test/helper/Offline"; import { Offline, whenBetween } from "../../test/helper/Offline";
import { expect } from "chai"; import { expect } from "chai";
import { noOp } from "Tone/core/util/Interface"; import { noOp } from "../core/util/Interface";
import { Time } from "Tone/core/type/Time"; import { Time } from "../core/type/Time";
describe("Loop", () => { describe("Loop", () => {

View file

@ -40,7 +40,7 @@ export class Loop<Options extends LoopOptions = LoopOptions> extends ToneWithCon
/** /**
* The callback to invoke with the next event in the pattern * 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. * @param callback The callback to invoke at the time.

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../test/helper/Offline";
import { Time } from "Tone/core/type/Time"; import { Time } from "../core/type/Time";
import { noOp } from "Tone/core/util/Interface"; import { noOp } from "../core/util/Interface";
import { Part } from "./Part"; import { Part } from "./Part";
import { Sequence } from "./Sequence"; import { Sequence } from "./Sequence";
import { ToneEvent } from "./ToneEvent"; import { ToneEvent } from "./ToneEvent";

View file

@ -1,7 +1,7 @@
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { Pattern } from "./Pattern"; import { Pattern } from "./Pattern";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
import { Time } from "Tone/core/type/Time"; import { Time } from "../core/type/Time";
import { expect } from "chai"; import { expect } from "chai";
describe("Pattern", () => { describe("Pattern", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { atTime, Offline } from "test/helper/Offline"; import { atTime, Offline } from "../../test/helper/Offline";
import { Time } from "Tone/core/type/Time"; import { Time } from "../core/type/Time";
import { noOp } from "Tone/core/util/Interface"; import { noOp } from "../core/util/Interface";
import { Sequence } from "./Sequence"; import { Sequence } from "./Sequence";
describe("Sequence", () => { describe("Sequence", () => {

View file

@ -1,8 +1,8 @@
import { expect } from "chai"; import { expect } from "chai";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { Offline, whenBetween } from "test/helper/Offline"; import { Offline, whenBetween } from "../../test/helper/Offline";
import { Time } from "Tone/core/type/Time"; import { Time } from "../core/type/Time";
import { noOp } from "Tone/core/util/Interface"; import { noOp } from "../core/util/Interface";
import { ToneEvent } from "./ToneEvent"; import { ToneEvent } from "./ToneEvent";
describe("ToneEvent", () => { describe("ToneEvent", () => {

View file

@ -1,9 +1,9 @@
import { AMSynth } from "./AMSynth"; import { AMSynth } from "./AMSynth";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { InstrumentTest } from "test/helper/InstrumentTests"; import { InstrumentTest } from "../../test/helper/InstrumentTests";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { expect } from "chai"; import { expect } from "chai";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
describe("AMSynth", () => { describe("AMSynth", () => {

View file

@ -1,9 +1,9 @@
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { InstrumentTest } from "test/helper/InstrumentTests"; import { InstrumentTest } from "../../test/helper/InstrumentTests";
import { DuoSynth } from "./DuoSynth"; import { DuoSynth } from "./DuoSynth";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { expect } from "chai"; import { expect } from "chai";
import { MonophonicTest } from "test/helper/MonophonicTests"; import { MonophonicTest } from "../../test/helper/MonophonicTests";
describe("DuoSynth", () => { describe("DuoSynth", () => {

View file

@ -1,9 +1,9 @@
import { expect } from "chai"; import { expect } from "chai";
import { FMSynth } from "./FMSynth"; import { FMSynth } from "./FMSynth";
import { BasicTests } from "test/helper/Basic"; import { BasicTests } from "../../test/helper/Basic";
import { InstrumentTest } from "test/helper/InstrumentTests"; import { InstrumentTest } from "../../test/helper/InstrumentTests";
import { CompareToFile } from "test/helper/CompareToFile"; import { CompareToFile } from "../../test/helper/CompareToFile";
import { Offline } from "test/helper/Offline"; import { Offline } from "../../test/helper/Offline";
describe("FMSynth", () => { describe("FMSynth", () => {

Some files were not shown because too many files have changed in this diff Show more