Tone.js/test/effect/PitchShift.js
tambien ed71d8141b amd to es6 import/export
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
2019-01-27 13:05:20 -05:00

55 lines
1.5 KiB
JavaScript

import PitchShift from "Tone/effect/PitchShift";
import Basic from "helper/Basic";
import EffectTests from "helper/EffectTests";
describe("PitchShift", function(){
Basic(PitchShift);
EffectTests(PitchShift);
context("API", function(){
it("can pass in options in the constructor", function(){
var pitchShift = new PitchShift({
"windowSize" : 0.2,
"pitch" : 2
});
expect(pitchShift.windowSize).to.be.closeTo(0.2, 0.01);
expect(pitchShift.pitch).to.be.closeTo(2, 0.01);
pitchShift.dispose();
});
it("can set positive and negative pitches", function(){
var pitchShift = new PitchShift();
pitchShift.pitch = 2;
expect(pitchShift.pitch).to.be.equal(2);
pitchShift.pitch = -2;
expect(pitchShift.pitch).to.be.equal(-2);
pitchShift.pitch = -4.5;
expect(pitchShift.pitch).to.be.equal(-4.5);
pitchShift.dispose();
});
it("can get/set the options", function(){
var pitchShift = new PitchShift();
pitchShift.set({
"windowSize" : 0.4,
});
expect(pitchShift.get().windowSize).to.be.closeTo(0.4, 0.01);
pitchShift.dispose();
});
it("can set set the feedback and delay times", function(){
var pitchShift = new PitchShift({
"delayTime" : "4n",
"feedback" : 0.3
});
expect(pitchShift.delayTime.value).to.be.closeTo(pitchShift.toSeconds("4n"), 0.01);
expect(pitchShift.feedback.value).to.be.closeTo(0.3, 0.01);
pitchShift.delayTime.value = 0.2;
expect(pitchShift.delayTime.value).to.be.closeTo(0.2, 0.01);
pitchShift.dispose();
});
});
});