Tone.js/Tone/effect/StereoWidener.test.ts

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-11-04 02:43:53 +00:00
import { StereoWidener } from "./StereoWidener";
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";
describe("StereoWidener", () => {
BasicTests(StereoWidener);
EffectTests(StereoWidener, 0);
2019-11-04 03:19:33 +00:00
it("matches a file basic", async () => {
const buffer = await ToneAudioBuffer.fromUrl("./audio/FWDL.mp3");
return CompareToFile(() => {
const phaser = new StereoWidener(0.1).toDestination();
const player = new Player(buffer).connect(phaser).start();
2019-11-04 03:20:07 +00:00
}, "stereoWidener.wav", 0.3);
2019-11-04 03:19:33 +00:00
});
2019-11-04 02:43:53 +00:00
context("API", () => {
it("can pass in options in the constructor", () => {
const widener = new StereoWidener(0.2);
expect(widener.width.value).to.be.closeTo(0.2, 0.001);
widener.dispose();
});
it("can get/set the options", () => {
const widener = new StereoWidener();
widener.set({
width: 0.4,
});
expect(widener.width.value).to.be.closeTo(0.4, 0.001);
widener.dispose();
});
});
});