mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
25 lines
520 B
JavaScript
25 lines
520 B
JavaScript
|
define(["helper/Offline", "Test"], function (Offline, Test) {
|
||
|
|
||
|
var OutputAudio = function(before, after){
|
||
|
var duration = 0.5;
|
||
|
var offline = new Offline(duration, 1);
|
||
|
var passedAudio = false;
|
||
|
offline.before(function(dest){
|
||
|
before(dest);
|
||
|
});
|
||
|
offline.after(function(){
|
||
|
if (!passedAudio){
|
||
|
throw new Error("node outputs silence");
|
||
|
}
|
||
|
after();
|
||
|
});
|
||
|
offline.test(function(sample){
|
||
|
if (Math.abs(sample) > 0.01){
|
||
|
passedAudio = true;
|
||
|
}
|
||
|
});
|
||
|
offline.run();
|
||
|
};
|
||
|
|
||
|
return OutputAudio;
|
||
|
});
|