Tone.js/Tone/component/channel/MultibandSplit.test.ts

67 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-06-24 18:33:54 +00:00
import { expect } from "chai";
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", () => {
BasicTests(MultibandSplit);
it("handles input and output connections", () => {
const split = new MultibandSplit();
connectFrom().connect(split);
split.low.connect(connectTo());
split.mid.connect(connectTo());
split.high.connect(connectTo());
split.dispose();
});
it("can be constructed with an object", () => {
const split = new MultibandSplit({
2019-09-16 03:32:40 +00:00
Q: 8,
2019-06-24 18:33:54 +00:00
highFrequency: 2700,
lowFrequency: 500,
});
expect(split.lowFrequency.value).to.be.closeTo(500, 0.01);
expect(split.highFrequency.value).to.be.closeTo(2700, 0.01);
expect(split.Q.value).to.be.closeTo(8, 0.01);
split.dispose();
});
it("can be get and set through object", () => {
const split = new MultibandSplit();
split.set({
Q: 4,
lowFrequency: 250,
});
expect(split.get().Q).to.be.closeTo(4, 0.1);
expect(split.get().lowFrequency).to.be.closeTo(250, 0.01);
split.dispose();
});
it("passes the incoming signal through low", () => {
return PassAudio(input => {
const split = new MultibandSplit().low.toDestination();
2019-06-24 18:33:54 +00:00
input.connect(split);
});
});
it("passes the incoming signal through mid", () => {
return PassAudio(input => {
const split = new MultibandSplit().mid.toDestination();
2019-06-24 18:33:54 +00:00
input.connect(split);
});
});
it("passes the incoming signal through high", () => {
return PassAudio(input => {
const split = new MultibandSplit({
highFrequency: 10,
lowFrequency: 5,
}).high.toDestination();
2019-06-24 18:33:54 +00:00
input.connect(split);
});
});
});