├── .gitignore ├── LICENSE ├── README.md ├── camtest.html ├── images ├── 20140902livebeats.png ├── Thumbs.db ├── block.png └── g200kg160x80.png ├── index.html ├── livebeats-demo.html ├── livebeats.html ├── node_modules └── web-audio-engine │ ├── build │ └── web-audio-engine.js │ ├── index.js │ ├── lib │ ├── api │ │ ├── AnalyserNode.js │ │ ├── AudioBuffer.js │ │ ├── AudioBufferSourceNode.js │ │ ├── AudioContext.js │ │ ├── AudioDestinationNode.js │ │ ├── AudioListener.js │ │ ├── AudioNode.js │ │ ├── AudioParam.js │ │ ├── AudioWorkerNode.js │ │ ├── BiquadFilterNode.js │ │ ├── ChannelMergerNode.js │ │ ├── ChannelSplitterNode.js │ │ ├── ConvolverNode.js │ │ ├── DelayNode.js │ │ ├── DynamicsCompressorNode.js │ │ ├── EventTarget.js │ │ ├── GainNode.js │ │ ├── IIRFilterNode.js │ │ ├── OscillatorNode.js │ │ ├── PannerNode.js │ │ ├── PeriodicWave.js │ │ ├── ScriptProcessorNode.js │ │ ├── SpatialListener.js │ │ ├── SpatialPannerNode.js │ │ ├── StereoPannerNode.js │ │ ├── WaveShaperNode.js │ │ └── index.js │ ├── config.js │ ├── context │ │ ├── OfflineAudioContext.js │ │ ├── RenderingAudioContext.js │ │ ├── StreamAudioContext.js │ │ └── WebAudioContext.js │ ├── decoder.js │ ├── encoder.js │ ├── impl │ │ ├── AnalyserNode.js │ │ ├── AudioBuffer.js │ │ ├── AudioBufferSourceNode.js │ │ ├── AudioContext.js │ │ ├── AudioDestinationNode.js │ │ ├── AudioListener.js │ │ ├── AudioNode.js │ │ ├── AudioParam.js │ │ ├── AudioScheduledSourceNode.js │ │ ├── AudioSourceNode.js │ │ ├── AudioWorkerNode.js │ │ ├── BasePannerNode.js │ │ ├── BiquadFilterNode.js │ │ ├── ChannelMergerNode.js │ │ ├── ChannelSplitterNode.js │ │ ├── ConvolverNode.js │ │ ├── DelayNode.js │ │ ├── DynamicsCompressorNode.js │ │ ├── EventTarget.js │ │ ├── GainNode.js │ │ ├── IIRFilterNode.js │ │ ├── OscillatorNode.js │ │ ├── PannerNode.js │ │ ├── PeriodicWave.js │ │ ├── ScriptProcessorNode.js │ │ ├── SpatialListener.js │ │ ├── SpatialPannerNode.js │ │ ├── StereoPannerNode.js │ │ ├── WaveShaperNode.js │ │ ├── core │ │ │ ├── AudioBus.js │ │ │ ├── AudioData.js │ │ │ ├── AudioNodeInput.js │ │ │ └── AudioNodeOutput.js │ │ ├── dsp │ │ │ ├── AnalyserNode.js │ │ │ ├── AudioBufferSourceNode.js │ │ │ ├── AudioDestinationNode.js │ │ │ ├── AudioParam.js │ │ │ ├── BiquadFilterNode.js │ │ │ ├── ChannelMergerNode.js │ │ │ ├── ChannelSplitterNode.js │ │ │ ├── ConvolverNode.js │ │ │ ├── DelayNode.js │ │ │ ├── DynamicsCompressorNode.js │ │ │ ├── GainNode.js │ │ │ ├── IIRFilterNode.js │ │ │ ├── OscillatorNode.js │ │ │ ├── PannerNode.js │ │ │ ├── PeriodicWave.js │ │ │ ├── ScriptProcessorNode.js │ │ │ ├── SpatialPannerNode.js │ │ │ ├── StereoPannerNode.js │ │ │ └── WaveShaperNode.js │ │ └── index.js │ ├── index.js │ └── util │ │ ├── PCMArrayBufferWriter.js │ │ ├── PCMBufferWriter.js │ │ ├── PCMEncoder.js │ │ ├── audioDataUtil.js │ │ ├── audioParamUtil.js │ │ ├── clip.js │ │ ├── decoderUtil.js │ │ ├── defaults.js │ │ ├── defineProp.js │ │ ├── encoderUtil.js │ │ ├── fill.js │ │ ├── fillRange.js │ │ ├── index.js │ │ ├── resampler.js │ │ ├── setImmediate.js │ │ ├── toArrayIfNeeded.js │ │ ├── toAudioTime.js │ │ ├── toImpl.js │ │ ├── toNumber.js │ │ ├── toPowerOfTwo.js │ │ ├── toValidBitDepth.js │ │ ├── toValidBlockSize.js │ │ ├── toValidNumberOfChannels.js │ │ └── toValidSampleRate.js │ ├── node_modules │ ├── wav-decoder │ │ ├── README.md │ │ ├── index.js │ │ └── package.json │ └── wav-encoder │ │ ├── README.md │ │ ├── index.js │ │ └── package.json │ └── package.json ├── peer.min.js ├── samples ├── IMreverbs1.rar ├── IMreverbs1 │ ├── Five Columns Long.wav │ ├── Five Columns.wav │ ├── French 18th Century Salon.wav │ ├── Going Home.wav │ ├── In The Silo Revised.wav │ ├── Narrow Bumpy Space.wav │ ├── Nice Drum Room.wav │ ├── Parking Garage.wav │ ├── Rays.wav │ ├── Trig Room.wav │ └── license.txt ├── chh.wav ├── kick.wav ├── kick2.wav └── snare.wav ├── vj_beatstep.js ├── vj_cam.js ├── vj_camformantgl.js ├── vj_camgl.js ├── vj_dropgl.js ├── vj_dropgl2.js ├── vj_graph.js ├── vj_matrix.js ├── vj_simplewave.js ├── vj_txt.js ├── vj_wave.js ├── vj_wavegl.js └── vjpluginspec.html /.gitignore: -------------------------------------------------------------------------------- 1 | # bower 2 | bower_components/ 3 | 4 | # Windows image file caches 5 | Thumbs.db 6 | ehthumbs.db 7 | 8 | # Folder config file 9 | Desktop.ini 10 | 11 | # Download Test file 12 | test/ 13 | 14 | # Recycle Bin used on file shares 15 | $RECYCLE.BIN/ 16 | 17 | # Windows Installer files 18 | *.cab 19 | *.msi 20 | *.msm 21 | *.msp 22 | 23 | # ========================= 24 | # Operating System Files 25 | # ========================= 26 | 27 | # OSX 28 | # ========================= 29 | 30 | .DS_Store 31 | .AppleDouble 32 | .LSOverride 33 | 34 | # Icon must end with two \r 35 | Icon 36 | 37 | 38 | # Thumbnails 39 | ._* 40 | 41 | # Files that might appear on external disk 42 | .Spotlight-V100 43 | .Trashes 44 | 45 | # Directories potentially created on remote AFP share 46 | .AppleDB 47 | .AppleDesktop 48 | Network Trash Folder 49 | Temporary Items 50 | .apdisk 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LiveBeats 2 | ========= 3 | 4 | Audio / Visual Live-Performance tool on Browser 5 | 6 | LiveBeats is a command-line based audio/visual live performance tool for browser. 7 | LiveBeats can generate various sounds and visual effects by commmands from keyboard. 8 | Chrome or Firefox, and WebCam is required. (In my test, Windows+Firefox may cause some trouble with WebCam Image, please try with Chrome when you have trouble. 9 | 10 | ## Block Diagram 11 | ![Block Diagram](http://g200kg.github.com/LiveBeats/images/block.png) 12 | 13 | ## DEMO and Instructions 14 | #### [LiveBeats Demo Page](http://g200kg.github.com/LiveBeats/) 15 | 16 | ## License 17 | IR files(IMreverbs1) : http://g200kg.github.io/LiveBeats/samples/IMreverbs1/license.txt 18 | Others : [MIT License](http://g200kg.github.io/LiveBeats/LICENSE) 19 | -------------------------------------------------------------------------------- /images/20140902livebeats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/images/20140902livebeats.png -------------------------------------------------------------------------------- /images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/images/Thumbs.db -------------------------------------------------------------------------------- /images/block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/images/block.png -------------------------------------------------------------------------------- /images/g200kg160x80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/images/g200kg160x80.png -------------------------------------------------------------------------------- /node_modules/web-audio-engine/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./lib"); 2 | -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AnalyserNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var AnalyserNode = function (_AudioNode) { 15 | _inherits(AnalyserNode, _AudioNode); 16 | 17 | function AnalyserNode(context, opts) { 18 | _classCallCheck(this, AnalyserNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AnalyserNode).call(this, context)); 21 | 22 | _this._impl = new impl.AnalyserNode(context._impl, opts); 23 | return _this; 24 | } 25 | 26 | _createClass(AnalyserNode, [{ 27 | key: "getFloatFrequencyData", 28 | value: function getFloatFrequencyData(array) { 29 | this._impl.getFloatFrequencyData(array); 30 | } 31 | }, { 32 | key: "getByteFrequencyData", 33 | value: function getByteFrequencyData(array) { 34 | this._impl.getByteFrequencyData(array); 35 | } 36 | }, { 37 | key: "getFloatTimeDomainData", 38 | value: function getFloatTimeDomainData(array) { 39 | this._impl.getFloatTimeDomainData(array); 40 | } 41 | }, { 42 | key: "getByteTimeDomainData", 43 | value: function getByteTimeDomainData(array) { 44 | this._impl.getByteTimeDomainData(array); 45 | } 46 | }, { 47 | key: "fftSize", 48 | get: function get() { 49 | return this._impl.getFftSize(); 50 | }, 51 | set: function set(value) { 52 | this._impl.setFftSize(value); 53 | } 54 | }, { 55 | key: "frequencyBinCount", 56 | get: function get() { 57 | return this._impl.getFrequencyBinCount(); 58 | } 59 | }, { 60 | key: "minDecibels", 61 | get: function get() { 62 | return this._impl.getMinDecibels(); 63 | }, 64 | set: function set(value) { 65 | this._impl.setMinDecibels(value); 66 | } 67 | }, { 68 | key: "maxDecibels", 69 | get: function get() { 70 | return this._impl.getMaxDecibels(); 71 | }, 72 | set: function set(value) { 73 | this._impl.setMaxDecibels(value); 74 | } 75 | }, { 76 | key: "smoothingTimeConstant", 77 | get: function get() { 78 | return this._impl.getSmoothingTimeConstant(); 79 | }, 80 | set: function set(value) { 81 | this._impl.setSmoothingTimeConstant(value); 82 | } 83 | }]); 84 | 85 | return AnalyserNode; 86 | }(AudioNode); 87 | 88 | module.exports = AnalyserNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioBuffer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var util = require("../util"); 8 | var impl = require("../impl"); 9 | 10 | var AudioBuffer = function () { 11 | function AudioBuffer(context, opts) { 12 | _classCallCheck(this, AudioBuffer); 13 | 14 | util.defineProp(this, "_impl", new impl.AudioBuffer(context._impl, opts)); 15 | } 16 | 17 | _createClass(AudioBuffer, [{ 18 | key: "getChannelData", 19 | value: function getChannelData(channel) { 20 | return this._impl.getChannelData(channel); 21 | } 22 | }, { 23 | key: "copyFromChannel", 24 | value: function copyFromChannel(destination, channelNumber, startInChannel) { 25 | this._impl.copyFromChannel(destination, channelNumber, startInChannel); 26 | } 27 | }, { 28 | key: "copyToChannel", 29 | value: function copyToChannel(source, channelNumber, startInChannel) { 30 | this._impl.copyToChannel(source, channelNumber, startInChannel); 31 | } 32 | }, { 33 | key: "sampleRate", 34 | get: function get() { 35 | return this._impl.getSampleRate(); 36 | } 37 | }, { 38 | key: "length", 39 | get: function get() { 40 | return this._impl.getLength(); 41 | } 42 | }, { 43 | key: "duration", 44 | get: function get() { 45 | return this._impl.getDuration(); 46 | } 47 | }, { 48 | key: "numberOfChannels", 49 | get: function get() { 50 | return this._impl.getNumberOfChannels(); 51 | } 52 | }]); 53 | 54 | return AudioBuffer; 55 | }(); 56 | 57 | module.exports = AudioBuffer; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioBufferSourceNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var AudioBufferSourceNode = function (_AudioNode) { 16 | _inherits(AudioBufferSourceNode, _AudioNode); 17 | 18 | function AudioBufferSourceNode(context, opts) { 19 | _classCallCheck(this, AudioBufferSourceNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioBufferSourceNode).call(this, context)); 22 | 23 | _this._impl = new impl.AudioBufferSourceNode(context._impl, opts); 24 | _this._impl.$playbackRate = new AudioParam(context, _this._impl.getPlaybackRate()); 25 | _this._impl.$detune = new AudioParam(context, _this._impl.getDetune()); 26 | _this._impl.$buffer = null; 27 | _this._impl.$onended = null; 28 | return _this; 29 | } 30 | 31 | _createClass(AudioBufferSourceNode, [{ 32 | key: "start", 33 | value: function start(when, offset, duration) { 34 | this._impl.start(when, offset, duration); 35 | } 36 | }, { 37 | key: "stop", 38 | value: function stop(when) { 39 | this._impl.stop(when); 40 | } 41 | }, { 42 | key: "buffer", 43 | get: function get() { 44 | return this._impl.$buffer; 45 | }, 46 | set: function set(value) { 47 | this._impl.$buffer = value; 48 | this._impl.setBuffer(value); 49 | } 50 | }, { 51 | key: "playbackRate", 52 | get: function get() { 53 | return this._impl.$playbackRate; 54 | } 55 | }, { 56 | key: "detune", 57 | get: function get() { 58 | return this._impl.$detune; 59 | } 60 | }, { 61 | key: "loop", 62 | get: function get() { 63 | return this._impl.getLoop(); 64 | }, 65 | set: function set(value) { 66 | this._impl.setLoop(value); 67 | } 68 | }, { 69 | key: "loopStart", 70 | get: function get() { 71 | return this._impl.getLoopStart(); 72 | }, 73 | set: function set(value) { 74 | this._impl.setLoopStart(value); 75 | } 76 | }, { 77 | key: "loopEnd", 78 | get: function get() { 79 | return this._impl.getLoopEnd(); 80 | }, 81 | set: function set(value) { 82 | this._impl.setLoopEnd(value); 83 | } 84 | }, { 85 | key: "onended", 86 | get: function get() { 87 | return this._impl.$onended; 88 | }, 89 | set: function set(callback) { 90 | this._impl.replaceEventListener("ended", this._impl.$onended, callback); 91 | this._impl.$onended = callback; 92 | } 93 | }]); 94 | 95 | return AudioBufferSourceNode; 96 | }(AudioNode); 97 | 98 | module.exports = AudioBufferSourceNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioDestinationNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var AudioNode = require("./AudioNode"); 12 | 13 | var AudioDestinationNode = function (_AudioNode) { 14 | _inherits(AudioDestinationNode, _AudioNode); 15 | 16 | function AudioDestinationNode(context, impl) { 17 | _classCallCheck(this, AudioDestinationNode); 18 | 19 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioDestinationNode).call(this, context)); 20 | 21 | _this._impl = impl; 22 | return _this; 23 | } 24 | 25 | _createClass(AudioDestinationNode, [{ 26 | key: "maxChannelCount", 27 | get: function get() { 28 | return this._impl.getMaxChannelCount(); 29 | } 30 | }]); 31 | 32 | return AudioDestinationNode; 33 | }(AudioNode); 34 | 35 | module.exports = AudioDestinationNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var util = require("../util"); 8 | 9 | var AudioListener = function () { 10 | function AudioListener(context, impl) { 11 | _classCallCheck(this, AudioListener); 12 | 13 | util.defineProp(this, "_impl", impl); 14 | } 15 | 16 | _createClass(AudioListener, [{ 17 | key: "setPosition", 18 | value: function setPosition(x, y, z) { 19 | this._impl.setPosition(x, y, z); 20 | } 21 | }, { 22 | key: "setOrientation", 23 | value: function setOrientation(x, y, z, xUp, yUp, zUp) { 24 | this._impl.setOrientation(x, y, z, xUp, yUp, zUp); 25 | } 26 | }]); 27 | 28 | return AudioListener; 29 | }(); 30 | 31 | module.exports = AudioListener; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var util = require("../util"); 12 | var EventTarget = require("./EventTarget"); 13 | 14 | var AudioNode = function (_EventTarget) { 15 | _inherits(AudioNode, _EventTarget); 16 | 17 | function AudioNode(context) { 18 | _classCallCheck(this, AudioNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioNode).call(this)); 21 | 22 | util.defineProp(_this, "_context", context); 23 | util.defineProp(_this, "_impl", null); 24 | return _this; 25 | } 26 | 27 | _createClass(AudioNode, [{ 28 | key: "connect", 29 | value: function connect(destination, input, output) { 30 | this._impl.connect(destination._impl, input, output); 31 | 32 | /* istanbul ignore else */ 33 | if (destination instanceof AudioNode) { 34 | return destination; 35 | } 36 | } 37 | }, { 38 | key: "disconnect", 39 | value: function disconnect() { 40 | this._impl.disconnect.apply(this._impl, arguments); 41 | } 42 | }, { 43 | key: "context", 44 | get: function get() { 45 | return this._context; 46 | } 47 | }, { 48 | key: "numberOfInputs", 49 | get: function get() { 50 | return this._impl.getNumberOfInputs(); 51 | } 52 | }, { 53 | key: "numberOfOutputs", 54 | get: function get() { 55 | return this._impl.getNumberOfOutputs(); 56 | } 57 | }, { 58 | key: "channelCount", 59 | get: function get() { 60 | return this._impl.getChannelCount(); 61 | }, 62 | set: function set(value) { 63 | this._impl.setChannelCount(value); 64 | } 65 | }, { 66 | key: "channelCountMode", 67 | get: function get() { 68 | return this._impl.getChannelCountMode(); 69 | }, 70 | set: function set(value) { 71 | this._impl.setChannelCountMode(value); 72 | } 73 | }, { 74 | key: "channelInterpretation", 75 | get: function get() { 76 | return this._impl.getChannelInterpretation(); 77 | }, 78 | set: function set(value) { 79 | return this._impl.setChannelInterpretation(value); 80 | } 81 | }]); 82 | 83 | return AudioNode; 84 | }(EventTarget); 85 | 86 | module.exports = AudioNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioParam.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var util = require("../util"); 8 | 9 | var AudioParam = function () { 10 | function AudioParam(context, impl) { 11 | _classCallCheck(this, AudioParam); 12 | 13 | util.defineProp(this, "_context", context); 14 | util.defineProp(this, "_impl", impl); 15 | } 16 | 17 | _createClass(AudioParam, [{ 18 | key: "setValueAtTime", 19 | value: function setValueAtTime(value, startTime) { 20 | this._impl.setValueAtTime(value, startTime); 21 | return this; 22 | } 23 | }, { 24 | key: "linearRampToValueAtTime", 25 | value: function linearRampToValueAtTime(value, endTime) { 26 | this._impl.linearRampToValueAtTime(value, endTime); 27 | return this; 28 | } 29 | }, { 30 | key: "exponentialRampToValueAtTime", 31 | value: function exponentialRampToValueAtTime(value, endTime) { 32 | this._impl.exponentialRampToValueAtTime(value, endTime); 33 | return this; 34 | } 35 | }, { 36 | key: "setTargetAtTime", 37 | value: function setTargetAtTime(target, startTime, timeConstant) { 38 | this._impl.setTargetAtTime(target, startTime, timeConstant); 39 | return this; 40 | } 41 | }, { 42 | key: "setValueCurveAtTime", 43 | value: function setValueCurveAtTime(values, startTime, duration) { 44 | this._impl.setValueCurveAtTime(values, startTime, duration); 45 | return this; 46 | } 47 | }, { 48 | key: "cancelScheduledValues", 49 | value: function cancelScheduledValues(startTime) { 50 | this._impl.cancelScheduledValues(startTime); 51 | return this; 52 | } 53 | }, { 54 | key: "value", 55 | get: function get() { 56 | return this._impl.getValue(); 57 | }, 58 | set: function set(value) { 59 | this._impl.setValue(value); 60 | } 61 | }, { 62 | key: "defaultValue", 63 | get: function get() { 64 | return this._impl.getDefaultValue(); 65 | } 66 | }]); 67 | 68 | return AudioParam; 69 | }(); 70 | 71 | module.exports = AudioParam; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/AudioWorkerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var AudioWorkerNode = function (_AudioNode) { 15 | _inherits(AudioWorkerNode, _AudioNode); 16 | 17 | function AudioWorkerNode(context, opts) { 18 | _classCallCheck(this, AudioWorkerNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioWorkerNode).call(this, context)); 21 | 22 | _this._impl = new impl.AudioWorkerNode(context._impl, opts); 23 | _this._impl.$onmessage = null; 24 | return _this; 25 | } 26 | 27 | _createClass(AudioWorkerNode, [{ 28 | key: "postMessage", 29 | value: function postMessage(message) { 30 | this._impl.postMessage(message); 31 | } 32 | }, { 33 | key: "onmessage", 34 | get: function get() { 35 | return this._impl.$onmessage; 36 | }, 37 | set: function set(callback) { 38 | this._impl.replaceEventListener("message", this._impl.$onmessage, callback); 39 | this._impl.$onmessage = callback; 40 | } 41 | }]); 42 | 43 | return AudioWorkerNode; 44 | }(AudioNode); 45 | 46 | module.exports = AudioWorkerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/BiquadFilterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var BiquadFilterNode = function (_AudioNode) { 16 | _inherits(BiquadFilterNode, _AudioNode); 17 | 18 | function BiquadFilterNode(context, opts) { 19 | _classCallCheck(this, BiquadFilterNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(BiquadFilterNode).call(this, context)); 22 | 23 | _this._impl = new impl.BiquadFilterNode(context._impl, opts); 24 | _this._impl.$frequency = new AudioParam(context, _this._impl.getFrequency()); 25 | _this._impl.$detune = new AudioParam(context, _this._impl.getDetune()); 26 | _this._impl.$Q = new AudioParam(context, _this._impl.getQ()); 27 | _this._impl.$gain = new AudioParam(context, _this._impl.getGain()); 28 | return _this; 29 | } 30 | 31 | _createClass(BiquadFilterNode, [{ 32 | key: "getFrequencyResponse", 33 | value: function getFrequencyResponse(frequencyHz, magResponse, phaseResponse) { 34 | this._impl.getFrequencyResponse(frequencyHz, magResponse, phaseResponse); 35 | } 36 | }, { 37 | key: "type", 38 | get: function get() { 39 | return this._impl.getType(); 40 | }, 41 | set: function set(value) { 42 | this._impl.setType(value); 43 | } 44 | }, { 45 | key: "frequency", 46 | get: function get() { 47 | return this._impl.$frequency; 48 | } 49 | }, { 50 | key: "detune", 51 | get: function get() { 52 | return this._impl.$detune; 53 | } 54 | }, { 55 | key: "Q", 56 | get: function get() { 57 | return this._impl.$Q; 58 | } 59 | }, { 60 | key: "gain", 61 | get: function get() { 62 | return this._impl.$gain; 63 | } 64 | }]); 65 | 66 | return BiquadFilterNode; 67 | }(AudioNode); 68 | 69 | module.exports = BiquadFilterNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/ChannelMergerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var impl = require("../impl"); 10 | var AudioNode = require("./AudioNode"); 11 | 12 | var ChannelMergerNode = function (_AudioNode) { 13 | _inherits(ChannelMergerNode, _AudioNode); 14 | 15 | function ChannelMergerNode(context, opts) { 16 | _classCallCheck(this, ChannelMergerNode); 17 | 18 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ChannelMergerNode).call(this, context)); 19 | 20 | _this._impl = new impl.ChannelMergerNode(context._impl, opts); 21 | return _this; 22 | } 23 | 24 | return ChannelMergerNode; 25 | }(AudioNode); 26 | 27 | module.exports = ChannelMergerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/ChannelSplitterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var impl = require("../impl"); 10 | var AudioNode = require("./AudioNode"); 11 | 12 | var ChannelSplitterNode = function (_AudioNode) { 13 | _inherits(ChannelSplitterNode, _AudioNode); 14 | 15 | function ChannelSplitterNode(context, opts) { 16 | _classCallCheck(this, ChannelSplitterNode); 17 | 18 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ChannelSplitterNode).call(this, context)); 19 | 20 | _this._impl = new impl.ChannelSplitterNode(context._impl, opts); 21 | return _this; 22 | } 23 | 24 | return ChannelSplitterNode; 25 | }(AudioNode); 26 | 27 | module.exports = ChannelSplitterNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/ConvolverNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var ConvolverNode = function (_AudioNode) { 15 | _inherits(ConvolverNode, _AudioNode); 16 | 17 | function ConvolverNode(context, opts) { 18 | _classCallCheck(this, ConvolverNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ConvolverNode).call(this, context)); 21 | 22 | _this._impl = new impl.ConvolverNode(context._impl, opts); 23 | _this._impl.$buffer = null; 24 | return _this; 25 | } 26 | 27 | _createClass(ConvolverNode, [{ 28 | key: "buffer", 29 | get: function get() { 30 | return this._impl.$buffer; 31 | }, 32 | set: function set(value) { 33 | this._impl.$buffer = value; 34 | this._impl.setBuffer(value); 35 | } 36 | }, { 37 | key: "normalize", 38 | get: function get() { 39 | return this._impl.getNormalize(); 40 | }, 41 | set: function set(value) { 42 | this._impl.setNormalize(value); 43 | } 44 | }]); 45 | 46 | return ConvolverNode; 47 | }(AudioNode); 48 | 49 | module.exports = ConvolverNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/DelayNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var DelayNode = function (_AudioNode) { 16 | _inherits(DelayNode, _AudioNode); 17 | 18 | function DelayNode(context, opts) { 19 | _classCallCheck(this, DelayNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DelayNode).call(this, context)); 22 | 23 | _this._impl = new impl.DelayNode(context._impl, opts); 24 | _this._impl.$delayTime = new AudioParam(context, _this._impl.getDelayTime()); 25 | return _this; 26 | } 27 | 28 | _createClass(DelayNode, [{ 29 | key: "delayTime", 30 | get: function get() { 31 | return this._impl.$delayTime; 32 | } 33 | }]); 34 | 35 | return DelayNode; 36 | }(AudioNode); 37 | 38 | module.exports = DelayNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/DynamicsCompressorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var DynamicsCompressorNode = function (_AudioNode) { 16 | _inherits(DynamicsCompressorNode, _AudioNode); 17 | 18 | function DynamicsCompressorNode(context, opts) { 19 | _classCallCheck(this, DynamicsCompressorNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DynamicsCompressorNode).call(this, context)); 22 | 23 | _this._impl = new impl.DynamicsCompressorNode(context._impl, opts); 24 | _this._impl.$threshold = new AudioParam(context, _this._impl.getThreshold()); 25 | _this._impl.$knee = new AudioParam(context, _this._impl.getKnee()); 26 | _this._impl.$ratio = new AudioParam(context, _this._impl.getRatio()); 27 | _this._impl.$attack = new AudioParam(context, _this._impl.getAttack()); 28 | _this._impl.$release = new AudioParam(context, _this._impl.getRelease()); 29 | return _this; 30 | } 31 | 32 | _createClass(DynamicsCompressorNode, [{ 33 | key: "threshold", 34 | get: function get() { 35 | return this._impl.$threshold; 36 | } 37 | }, { 38 | key: "knee", 39 | get: function get() { 40 | return this._impl.$knee; 41 | } 42 | }, { 43 | key: "ratio", 44 | get: function get() { 45 | return this._impl.$ratio; 46 | } 47 | }, { 48 | key: "reduction", 49 | get: function get() { 50 | return this._impl.getReduction(); 51 | } 52 | }, { 53 | key: "attack", 54 | get: function get() { 55 | return this._impl.$attack; 56 | } 57 | }, { 58 | key: "release", 59 | get: function get() { 60 | return this._impl.$release; 61 | } 62 | }]); 63 | 64 | return DynamicsCompressorNode; 65 | }(AudioNode); 66 | 67 | module.exports = DynamicsCompressorNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/EventTarget.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var EventTarget = function () { 8 | function EventTarget() { 9 | _classCallCheck(this, EventTarget); 10 | } 11 | 12 | _createClass(EventTarget, [{ 13 | key: "addEventListener", 14 | value: function addEventListener(type, listener) { 15 | this._impl.addEventListener(type, listener); 16 | } 17 | }, { 18 | key: "removeEventListener", 19 | value: function removeEventListener(type, listener) { 20 | this._impl.removeEventListener(type, listener); 21 | } 22 | }]); 23 | 24 | return EventTarget; 25 | }(); 26 | 27 | module.exports = EventTarget; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/GainNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var GainNode = function (_AudioNode) { 16 | _inherits(GainNode, _AudioNode); 17 | 18 | function GainNode(context, opts) { 19 | _classCallCheck(this, GainNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GainNode).call(this, context)); 22 | 23 | _this._impl = new impl.GainNode(context._impl, opts); 24 | _this._impl.$gain = new AudioParam(context, _this._impl.getGain()); 25 | return _this; 26 | } 27 | 28 | _createClass(GainNode, [{ 29 | key: "gain", 30 | get: function get() { 31 | return this._impl.$gain; 32 | } 33 | }]); 34 | 35 | return GainNode; 36 | }(AudioNode); 37 | 38 | module.exports = GainNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/IIRFilterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var IIRFilterNode = function (_AudioNode) { 15 | _inherits(IIRFilterNode, _AudioNode); 16 | 17 | function IIRFilterNode(context, opts) { 18 | _classCallCheck(this, IIRFilterNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(IIRFilterNode).call(this, context)); 21 | 22 | _this._impl = new impl.IIRFilterNode(context._impl, opts); 23 | return _this; 24 | } 25 | 26 | _createClass(IIRFilterNode, [{ 27 | key: "getFrequencyResponse", 28 | value: function getFrequencyResponse(frequencyHz, magResponse, phaseResponse) { 29 | this._impl.getFrequencyResponse(frequencyHz, magResponse, phaseResponse); 30 | } 31 | }]); 32 | 33 | return IIRFilterNode; 34 | }(AudioNode); 35 | 36 | module.exports = IIRFilterNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/OscillatorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var OscillatorNode = function (_AudioNode) { 16 | _inherits(OscillatorNode, _AudioNode); 17 | 18 | function OscillatorNode(context) { 19 | _classCallCheck(this, OscillatorNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(OscillatorNode).call(this, context)); 22 | 23 | _this._impl = new impl.OscillatorNode(context._impl); 24 | _this._impl.$frequency = new AudioParam(context, _this._impl.getFrequency()); 25 | _this._impl.$detune = new AudioParam(context, _this._impl.getDetune()); 26 | _this._impl.$onended = null; 27 | return _this; 28 | } 29 | 30 | _createClass(OscillatorNode, [{ 31 | key: "start", 32 | value: function start(when) { 33 | this._impl.start(when); 34 | } 35 | }, { 36 | key: "stop", 37 | value: function stop(when) { 38 | this._impl.stop(when); 39 | } 40 | }, { 41 | key: "setPeriodicWave", 42 | value: function setPeriodicWave(periodicWave) { 43 | this._impl.setPeriodicWave(periodicWave); 44 | } 45 | }, { 46 | key: "type", 47 | get: function get() { 48 | return this._impl.getType(); 49 | }, 50 | set: function set(value) { 51 | this._impl.setType(value); 52 | } 53 | }, { 54 | key: "frequency", 55 | get: function get() { 56 | return this._impl.$frequency; 57 | } 58 | }, { 59 | key: "detune", 60 | get: function get() { 61 | return this._impl.$detune; 62 | } 63 | }, { 64 | key: "onended", 65 | get: function get() { 66 | return this._impl.$onended; 67 | }, 68 | set: function set(callback) { 69 | this._impl.replaceEventListener("ended", this._impl.$onended, callback); 70 | this._impl.$onended = callback; 71 | } 72 | }]); 73 | 74 | return OscillatorNode; 75 | }(AudioNode); 76 | 77 | module.exports = OscillatorNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/PannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var PannerNode = function (_AudioNode) { 15 | _inherits(PannerNode, _AudioNode); 16 | 17 | function PannerNode(context) { 18 | _classCallCheck(this, PannerNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PannerNode).call(this, context)); 21 | 22 | _this._impl = new impl.PannerNode(context._impl); 23 | return _this; 24 | } 25 | 26 | _createClass(PannerNode, [{ 27 | key: "setPosition", 28 | value: function setPosition(x, y, z) { 29 | this._impl.setPosition(x, y, z); 30 | } 31 | }, { 32 | key: "setOrientation", 33 | value: function setOrientation(x, y, z) { 34 | this._impl.setOrientation(x, y, z); 35 | } 36 | }, { 37 | key: "setVelocity", 38 | value: function setVelocity(x, y, z) { 39 | this._impl.setVelocity(x, y, z); 40 | } 41 | }, { 42 | key: "panningModel", 43 | get: function get() { 44 | return this._impl.getPanningModel(); 45 | }, 46 | set: function set(value) { 47 | this._impl.setPanningModel(value); 48 | } 49 | }, { 50 | key: "distanceModel", 51 | get: function get() { 52 | return this._impl.getDistanceModel(); 53 | }, 54 | set: function set(value) { 55 | this._impl.setDistanceModel(value); 56 | } 57 | }, { 58 | key: "refDistance", 59 | get: function get() { 60 | return this._impl.getRefDistance(); 61 | }, 62 | set: function set(value) { 63 | this._impl.setRefDistance(value); 64 | } 65 | }, { 66 | key: "maxDistance", 67 | get: function get() { 68 | return this._impl.getMaxDistance(); 69 | }, 70 | set: function set(value) { 71 | this._impl.setMaxDistance(value); 72 | } 73 | }, { 74 | key: "rolloffFactor", 75 | get: function get() { 76 | return this._impl.getRolloffFactor(); 77 | }, 78 | set: function set(value) { 79 | this._impl.setRolloffFactor(value); 80 | } 81 | }, { 82 | key: "coneInnerAngle", 83 | get: function get() { 84 | return this._impl.getConeInnerAngle(); 85 | }, 86 | set: function set(value) { 87 | this._impl.setConeInnerAngle(value); 88 | } 89 | }, { 90 | key: "coneOuterAngle", 91 | get: function get() { 92 | return this._impl.getConeOuterAngle(); 93 | }, 94 | set: function set(value) { 95 | this._impl.setConeOuterAngle(value); 96 | } 97 | }, { 98 | key: "coneOuterGain", 99 | get: function get() { 100 | return this._impl.getConeOuterGain(); 101 | }, 102 | set: function set(value) { 103 | this._impl.setConeOuterGain(value); 104 | } 105 | }]); 106 | 107 | return PannerNode; 108 | }(AudioNode); 109 | 110 | module.exports = PannerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/PeriodicWave.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | var util = require("../util"); 6 | var impl = require("../impl"); 7 | 8 | var PeriodicWave = function PeriodicWave(context, opts) { 9 | _classCallCheck(this, PeriodicWave); 10 | 11 | util.defineProp(this, "_impl", new impl.PeriodicWave(context._impl, opts)); 12 | }; 13 | 14 | module.exports = PeriodicWave; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/ScriptProcessorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioBuffer = require("./AudioBuffer"); 14 | 15 | var ScriptProcessorNode = function (_AudioNode) { 16 | _inherits(ScriptProcessorNode, _AudioNode); 17 | 18 | function ScriptProcessorNode(context, opts) { 19 | _classCallCheck(this, ScriptProcessorNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ScriptProcessorNode).call(this, context)); 22 | 23 | _this._impl = new impl.ScriptProcessorNode(context._impl, opts); 24 | _this._impl.$onaudioprocess = null; 25 | _this._impl.setEventItem({ 26 | type: "audioprocess", 27 | playbackTime: 0, 28 | inputBuffer: new AudioBuffer(context), 29 | outputBuffer: new AudioBuffer(context) 30 | }); 31 | return _this; 32 | } 33 | 34 | _createClass(ScriptProcessorNode, [{ 35 | key: "bufferSize", 36 | get: function get() { 37 | return this._impl.getBufferSize(); 38 | } 39 | }, { 40 | key: "onaudioprocess", 41 | get: function get() { 42 | return this._impl.$onaudioprocess; 43 | }, 44 | set: function set(callback) { 45 | this._impl.replaceEventListener("audioprocess", this._impl.$onaudioprocess, callback); 46 | this._impl.$onaudioprocess = callback; 47 | } 48 | }]); 49 | 50 | return ScriptProcessorNode; 51 | }(AudioNode); 52 | 53 | module.exports = ScriptProcessorNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/SpatialListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var util = require("../util"); 8 | var AudioParam = require("./AudioParam"); 9 | 10 | var SpatialListener = function () { 11 | function SpatialListener(context, impl) { 12 | _classCallCheck(this, SpatialListener); 13 | 14 | util.defineProp(this, "_context", context); 15 | util.defineProp(this, "_impl", impl); 16 | 17 | this._impl.$positionX = new AudioParam(context, this._impl.getPositionX()); 18 | this._impl.$positionY = new AudioParam(context, this._impl.getPositionY()); 19 | this._impl.$positionZ = new AudioParam(context, this._impl.getPositionZ()); 20 | this._impl.$forwardX = new AudioParam(context, this._impl.getForwardX()); 21 | this._impl.$forwardY = new AudioParam(context, this._impl.getForwardY()); 22 | this._impl.$forwardZ = new AudioParam(context, this._impl.getForwardZ()); 23 | this._impl.$upX = new AudioParam(context, this._impl.getUpX()); 24 | this._impl.$upY = new AudioParam(context, this._impl.getUpY()); 25 | this._impl.$upZ = new AudioParam(context, this._impl.getUpZ()); 26 | } 27 | 28 | _createClass(SpatialListener, [{ 29 | key: "positionX", 30 | get: function get() { 31 | return this._impl.$positionX; 32 | } 33 | }, { 34 | key: "positionY", 35 | get: function get() { 36 | return this._impl.$positionY; 37 | } 38 | }, { 39 | key: "positionZ", 40 | get: function get() { 41 | return this._impl.$positionZ; 42 | } 43 | }, { 44 | key: "forwardX", 45 | get: function get() { 46 | return this._impl.$forwardX; 47 | } 48 | }, { 49 | key: "forwardY", 50 | get: function get() { 51 | return this._impl.$forwardY; 52 | } 53 | }, { 54 | key: "forwardZ", 55 | get: function get() { 56 | return this._impl.$forwardZ; 57 | } 58 | }, { 59 | key: "upX", 60 | get: function get() { 61 | return this._impl.$upX; 62 | } 63 | }, { 64 | key: "upY", 65 | get: function get() { 66 | return this._impl.$upY; 67 | } 68 | }, { 69 | key: "upZ", 70 | get: function get() { 71 | return this._impl.$upZ; 72 | } 73 | }]); 74 | 75 | return SpatialListener; 76 | }(); 77 | 78 | module.exports = SpatialListener; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/StereoPannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | var AudioParam = require("./AudioParam"); 14 | 15 | var StereoPannerNode = function (_AudioNode) { 16 | _inherits(StereoPannerNode, _AudioNode); 17 | 18 | function StereoPannerNode(context) { 19 | _classCallCheck(this, StereoPannerNode); 20 | 21 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StereoPannerNode).call(this, context)); 22 | 23 | _this._impl = new impl.StereoPannerNode(context._impl); 24 | _this._impl.$pan = new AudioParam(context, _this._impl.getPan()); 25 | return _this; 26 | } 27 | 28 | _createClass(StereoPannerNode, [{ 29 | key: "pan", 30 | get: function get() { 31 | return this._impl.$pan; 32 | } 33 | }]); 34 | 35 | return StereoPannerNode; 36 | }(AudioNode); 37 | 38 | module.exports = StereoPannerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/WaveShaperNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var impl = require("../impl"); 12 | var AudioNode = require("./AudioNode"); 13 | 14 | var WaveShaperNode = function (_AudioNode) { 15 | _inherits(WaveShaperNode, _AudioNode); 16 | 17 | function WaveShaperNode(context) { 18 | _classCallCheck(this, WaveShaperNode); 19 | 20 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(WaveShaperNode).call(this, context)); 21 | 22 | _this._impl = new impl.WaveShaperNode(context._impl); 23 | return _this; 24 | } 25 | 26 | _createClass(WaveShaperNode, [{ 27 | key: "curve", 28 | get: function get() { 29 | return this._impl.getCurve(); 30 | }, 31 | set: function set(value) { 32 | this._impl.setCurve(value); 33 | } 34 | }, { 35 | key: "oversample", 36 | get: function get() { 37 | return this._impl.getOversample(); 38 | }, 39 | set: function set(value) { 40 | this._impl.setOversample(value); 41 | } 42 | }]); 43 | 44 | return WaveShaperNode; 45 | }(AudioNode); 46 | 47 | module.exports = WaveShaperNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/api/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | AnalyserNode: require("./AnalyserNode"), 5 | AudioBuffer: require("./AudioBuffer"), 6 | AudioBufferSourceNode: require("./AudioBufferSourceNode"), 7 | AudioContext: require("./AudioContext"), 8 | AudioDestinationNode: require("./AudioDestinationNode"), 9 | AudioListener: require("./AudioListener"), 10 | AudioNode: require("./AudioNode"), 11 | AudioParam: require("./AudioParam"), 12 | AudioWorkerNode: require("./AudioWorkerNode"), 13 | BiquadFilterNode: require("./BiquadFilterNode"), 14 | ChannelMergerNode: require("./ChannelMergerNode"), 15 | ChannelSplitterNode: require("./ChannelSplitterNode"), 16 | ConvolverNode: require("./ConvolverNode"), 17 | DelayNode: require("./DelayNode"), 18 | DynamicsCompressorNode: require("./DynamicsCompressorNode"), 19 | EventTarget: require("./EventTarget"), 20 | GainNode: require("./GainNode"), 21 | IIRFilterNode: require("./IIRFilterNode"), 22 | OscillatorNode: require("./OscillatorNode"), 23 | PannerNode: require("./PannerNode"), 24 | PeriodicWave: require("./PeriodicWave"), 25 | ScriptProcessorNode: require("./ScriptProcessorNode"), 26 | SpatialListener: require("./SpatialListener"), 27 | SpatialPannerNode: require("./SpatialPannerNode"), 28 | StereoPannerNode: require("./StereoPannerNode"), 29 | WaveShaperNode: require("./WaveShaperNode") 30 | }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | sampleRate: 44100, 5 | numberOfChannels: 2, 6 | blockSize: 128, 7 | bitDepth: 16 8 | }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/decoder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var WavDecoder = require("wav-decoder"); 4 | var decoderUtil = require("./util/decoderUtil"); 5 | var audioDataUtil = require("./util/audioDataUtil"); 6 | var AudioBuffer = require("./api/AudioBuffer"); 7 | 8 | var decodeFn = WavDecoder.decode; 9 | 10 | /** 11 | * @return {function} 12 | */ 13 | function get() { 14 | return decodeFn; 15 | } 16 | 17 | /** 18 | * @param {function} fn 19 | */ 20 | function set(fn) { 21 | /* istanbul ignore else */ 22 | if (typeof fn === "function") { 23 | decodeFn = fn; 24 | } 25 | } 26 | 27 | /** 28 | * @param {ArrayBuffer} AudioBuffer 29 | * @param {object} opts 30 | * @return {Promise} 31 | */ 32 | function decode(audioData, opts) { 33 | return decoderUtil.decode(decodeFn, audioData, opts).then(function (audioData) { 34 | return audioDataUtil.toAudioBuffer(audioData, AudioBuffer); 35 | }); 36 | } 37 | 38 | module.exports = { get: get, set: set, decode: decode }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/encoder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var WavEncoder = require("wav-encoder"); 4 | var encoderUtil = require("./util/encoderUtil"); 5 | 6 | var encodeFn = WavEncoder.encode; 7 | 8 | /** 9 | * @return {function} 10 | */ 11 | function get() { 12 | return encodeFn; 13 | } 14 | 15 | /** 16 | * @param {function} fn 17 | */ 18 | function set(fn) { 19 | /* istanbul ignore else */ 20 | if (typeof fn === "function") { 21 | encodeFn = fn; 22 | } 23 | } 24 | 25 | /** 26 | * @param {AudioData} audioData 27 | * @param {object} opts 28 | * @return {Promise} 29 | */ 30 | function encode(audioData, opts) { 31 | return encoderUtil.encode(encodeFn, audioData, opts); 32 | } 33 | 34 | module.exports = { get: get, set: set, encode: encode }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/AudioBuffer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var util = require("../util"); 8 | var AudioData = require("./core/AudioData"); 9 | 10 | /** 11 | * @prop {AudioData} audioData 12 | */ 13 | 14 | var AudioBuffer = function () { 15 | /** 16 | * @param {AudioContext} context 17 | * @param {object} opts 18 | * @param {number} opts.numberOfChannels 19 | * @param {number} opts.length 20 | * @param {number} opts.sampleRate 21 | */ 22 | 23 | function AudioBuffer(context, opts) { 24 | _classCallCheck(this, AudioBuffer); 25 | 26 | opts = opts || /* istanbul ignore next */{}; 27 | 28 | var numberOfChannels = opts.numberOfChannels; 29 | var length = opts.length; 30 | var sampleRate = opts.sampleRate; 31 | 32 | numberOfChannels = util.toValidNumberOfChannels(numberOfChannels); 33 | length = Math.max(0, util.toNumber(length)); 34 | sampleRate = util.toValidSampleRate(sampleRate); 35 | 36 | this.audioData = new AudioData(numberOfChannels, length, sampleRate); 37 | } 38 | 39 | /** 40 | * @return {number} 41 | */ 42 | 43 | 44 | _createClass(AudioBuffer, [{ 45 | key: "getSampleRate", 46 | value: function getSampleRate() { 47 | return this.audioData.sampleRate; 48 | } 49 | 50 | /** 51 | * @return {number} 52 | */ 53 | 54 | }, { 55 | key: "getLength", 56 | value: function getLength() { 57 | return this.audioData.length; 58 | } 59 | 60 | /** 61 | * @return {number} 62 | */ 63 | 64 | }, { 65 | key: "getDuration", 66 | value: function getDuration() { 67 | return this.audioData.length / this.audioData.sampleRate; 68 | } 69 | 70 | /** 71 | * @return {number} 72 | */ 73 | 74 | }, { 75 | key: "getNumberOfChannels", 76 | value: function getNumberOfChannels() { 77 | return this.audioData.numberOfChannels; 78 | } 79 | 80 | /** 81 | * @return {Float32Array} 82 | */ 83 | 84 | }, { 85 | key: "getChannelData", 86 | value: function getChannelData(channel) { 87 | return this.audioData.channelData[channel | 0]; 88 | } 89 | 90 | /** 91 | * @param {Float32Array} destination 92 | * @param {number} channelNumber 93 | * @param {number} startInChannel 94 | */ 95 | 96 | }, { 97 | key: "copyFromChannel", 98 | value: function copyFromChannel(destination, channelNumber, startInChannel) { 99 | var source = this.audioData.channelData[channelNumber | 0]; 100 | 101 | startInChannel = startInChannel | 0; 102 | 103 | destination.set(source.subarray(startInChannel, startInChannel + destination.length)); 104 | } 105 | 106 | /** 107 | * @param {Float32Array} source 108 | * @param {number} channelNumber 109 | * @param {number} startInChannel 110 | */ 111 | 112 | }, { 113 | key: "copyToChannel", 114 | value: function copyToChannel(source, channelNumber, startInChannel) { 115 | var destination = this.audioData.channelData[channelNumber | 0]; 116 | 117 | startInChannel = startInChannel | 0; 118 | 119 | destination.set(source, startInChannel); 120 | } 121 | }]); 122 | 123 | return AudioBuffer; 124 | }(); 125 | 126 | module.exports = AudioBuffer; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/AudioDestinationNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 10 | 11 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 12 | 13 | var util = require("../util"); 14 | var AudioNode = require("./AudioNode"); 15 | 16 | /** 17 | * @prop {AudioNodeOutput} output 18 | * @prop {AudioBus} outputBus 19 | */ 20 | 21 | var AudioDestinationNode = function (_AudioNode) { 22 | _inherits(AudioDestinationNode, _AudioNode); 23 | 24 | /** 25 | * @param {AudioContext} context 26 | * @param {object} opts 27 | * @param {number} opts.numberOfChannels 28 | */ 29 | 30 | function AudioDestinationNode(context, opts) { 31 | _classCallCheck(this, AudioDestinationNode); 32 | 33 | opts = opts || /* istanbul ignore next */{}; 34 | 35 | var numberOfChannels = opts.numberOfChannels; 36 | 37 | numberOfChannels = util.toValidNumberOfChannels(numberOfChannels); 38 | 39 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioDestinationNode).call(this, context, { 40 | inputs: [numberOfChannels], 41 | outputs: [], 42 | channelCount: numberOfChannels, 43 | channelCountMode: "explicit" 44 | })); 45 | 46 | _this._numberOfChannels = numberOfChannels | 0; 47 | _this._destinationChannelData = _this.inputs[0].bus.getChannelData(); 48 | return _this; 49 | } 50 | 51 | /** 52 | * @return {number} 53 | */ 54 | 55 | 56 | _createClass(AudioDestinationNode, [{ 57 | key: "getMaxChannelCount", 58 | value: function getMaxChannelCount() { 59 | return this._numberOfChannels; 60 | } 61 | 62 | /** 63 | * @param {number} value 64 | */ 65 | 66 | }, { 67 | key: "setChannelCount", 68 | value: function setChannelCount(value) { 69 | value = util.clip(value | 0, 1, this.getMaxChannelCount()); 70 | _get(Object.getPrototypeOf(AudioDestinationNode.prototype), "setChannelCount", this).call(this, value); 71 | } 72 | 73 | /** 74 | * @param {Float32Array[]} channelData 75 | * @param {number} offset 76 | */ 77 | 78 | }, { 79 | key: "process", 80 | value: function process(channelData, offset) { 81 | var inputs = this.inputs; 82 | var destinationChannelData = this._destinationChannelData; 83 | var numberOfChannels = channelData.length; 84 | 85 | for (var i = 0, imax = inputs.length; i < imax; i++) { 86 | inputs[i].pull(); 87 | } 88 | 89 | for (var ch = 0; ch < numberOfChannels; ch++) { 90 | channelData[ch].set(destinationChannelData[ch], offset); 91 | } 92 | } 93 | }]); 94 | 95 | return AudioDestinationNode; 96 | }(AudioNode); 97 | 98 | module.exports = AudioDestinationNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/AudioListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var AudioListener = function () { 8 | /** 9 | * @param {AudioContext} context 10 | */ 11 | 12 | function AudioListener(context) { 13 | _classCallCheck(this, AudioListener); 14 | 15 | this.context = context; 16 | } 17 | 18 | /** 19 | * @param {number} x 20 | * @param {number} y 21 | * @param {number} z 22 | */ 23 | /* istanbul ignore next */ 24 | 25 | 26 | _createClass(AudioListener, [{ 27 | key: "setPosition", 28 | value: function setPosition() { 29 | throw new TypeError("NOT YET IMPLEMENTED"); 30 | } 31 | 32 | /** 33 | * @param {number} x 34 | * @param {number} y 35 | * @param {number} z 36 | * @param {number} xUp 37 | * @param {number} yUp 38 | * @param {number} zUp 39 | */ 40 | /* istanbul ignore next */ 41 | 42 | }, { 43 | key: "setOrientation", 44 | value: function setOrientation() { 45 | throw new TypeError("NOT YET IMPLEMENTED"); 46 | } 47 | }]); 48 | 49 | return AudioListener; 50 | }(); 51 | 52 | module.exports = AudioListener; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/AudioScheduledSourceNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var util = require("../util"); 12 | var AudioSourceNode = require("./AudioSourceNode"); 13 | 14 | var AudioScheduledSourceNode = function (_AudioSourceNode) { 15 | _inherits(AudioScheduledSourceNode, _AudioSourceNode); 16 | 17 | /** 18 | * @param {AudioContext} context 19 | */ 20 | 21 | function AudioScheduledSourceNode(context) { 22 | _classCallCheck(this, AudioScheduledSourceNode); 23 | 24 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AudioScheduledSourceNode).call(this, context)); 25 | 26 | _this._startTime = Infinity; 27 | _this._stopTime = Infinity; 28 | _this._startFrame = Infinity; 29 | _this._stopFrame = Infinity; 30 | return _this; 31 | } 32 | 33 | /** 34 | * @param {number} when 35 | */ 36 | 37 | 38 | _createClass(AudioScheduledSourceNode, [{ 39 | key: "start", 40 | value: function start(when) { 41 | var _this2 = this; 42 | 43 | /* istanbul ignore next */ 44 | if (this._startTime !== Infinity) { 45 | return; 46 | } 47 | 48 | when = Math.max(this.context.currentTime, util.toNumber(when)); 49 | 50 | this._startTime = when; 51 | this._startFrame = Math.round(when * this.sampleRate); 52 | 53 | this.context.sched(when, function () { 54 | _this2.outputs[0].enable(); 55 | }); 56 | } 57 | 58 | /** 59 | * @param {number} when 60 | */ 61 | 62 | }, { 63 | key: "stop", 64 | value: function stop(when) { 65 | /* istanbul ignore next */ 66 | if (this._startTime === Infinity && this._stopTime !== Infinity) { 67 | return; 68 | } 69 | 70 | when = Math.max(this.context.currentTime, this._startTime, util.toNumber(when)); 71 | 72 | this._stopTime = when; 73 | this._stopFrame = Math.round(when * this.sampleRate); 74 | } 75 | }]); 76 | 77 | return AudioScheduledSourceNode; 78 | }(AudioSourceNode); 79 | 80 | module.exports = AudioScheduledSourceNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/AudioSourceNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var AudioNode = require("./AudioNode"); 12 | 13 | /* istanbul ignore next */ 14 | 15 | var AudioSourceNode = function (_AudioNode) { 16 | _inherits(AudioSourceNode, _AudioNode); 17 | 18 | /** 19 | * @param {AudioContext} context 20 | */ 21 | 22 | function AudioSourceNode(context) { 23 | _classCallCheck(this, AudioSourceNode); 24 | 25 | return _possibleConstructorReturn(this, Object.getPrototypeOf(AudioSourceNode).call(this, context, { 26 | inputs: [], 27 | outputs: [1] 28 | })); 29 | } 30 | 31 | _createClass(AudioSourceNode, [{ 32 | key: "getChannelCount", 33 | value: function getChannelCount() { 34 | return 0; 35 | } 36 | }, { 37 | key: "setChannelCount", 38 | value: function setChannelCount() {} 39 | }, { 40 | key: "getChannelCountMode", 41 | value: function getChannelCountMode() { 42 | return "explicit"; 43 | } 44 | }, { 45 | key: "setChannelCountMode", 46 | value: function setChannelCountMode() {} 47 | }, { 48 | key: "getChannelInterpretation", 49 | value: function getChannelInterpretation() { 50 | return "discrete"; 51 | } 52 | }, { 53 | key: "setChannelInterpretation", 54 | value: function setChannelInterpretation() {} 55 | }, { 56 | key: "enableOutputsIfNecessary", 57 | value: function enableOutputsIfNecessary() {} 58 | }, { 59 | key: "disableOutputsIfNecessary", 60 | value: function disableOutputsIfNecessary() {} 61 | }]); 62 | 63 | return AudioSourceNode; 64 | }(AudioNode); 65 | 66 | module.exports = AudioSourceNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/ChannelMergerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 10 | 11 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 12 | 13 | var util = require("../util"); 14 | var AudioNode = require("./AudioNode"); 15 | var ChannelMergerNodeDSP = require("./dsp/ChannelMergerNode"); 16 | 17 | var ChannelMergerNode = function (_AudioNode) { 18 | _inherits(ChannelMergerNode, _AudioNode); 19 | 20 | /** 21 | * @param {AudioContext} context 22 | * @param {object} opts 23 | * @param {number} opts.numberOfInputs 24 | */ 25 | 26 | function ChannelMergerNode(context, opts) { 27 | _classCallCheck(this, ChannelMergerNode); 28 | 29 | opts = opts || /* istanbul ignore next */{}; 30 | 31 | var numberOfInputs = util.defaults(opts.numberOfInputs, 6); 32 | 33 | numberOfInputs = util.toValidNumberOfChannels(numberOfInputs); 34 | 35 | return _possibleConstructorReturn(this, Object.getPrototypeOf(ChannelMergerNode).call(this, context, { 36 | inputs: new Array(numberOfInputs).fill(1), 37 | outputs: [numberOfInputs], 38 | channelCount: 1, 39 | channelCountMode: "explicit" 40 | })); 41 | } 42 | 43 | _createClass(ChannelMergerNode, [{ 44 | key: "getChannelCount", 45 | value: function getChannelCount() { 46 | return 1; 47 | } 48 | }, { 49 | key: "setChannelCount", 50 | value: function setChannelCount() { 51 | // This node's channelCount cannot be changed. 52 | } 53 | }, { 54 | key: "getChannelCountMode", 55 | value: function getChannelCountMode() { 56 | return "explicit"; 57 | } 58 | }, { 59 | key: "setChannelCountMode", 60 | value: function setChannelCountMode() { 61 | // This node's channelCountMode cannot be changed. 62 | } 63 | }, { 64 | key: "getChannelInterpretation", 65 | value: function getChannelInterpretation() { 66 | return this.inputs[0].getChannelInterpretation(); 67 | } 68 | 69 | /** 70 | * @param {string} value 71 | */ 72 | 73 | }, { 74 | key: "setChannelInterpretation", 75 | value: function setChannelInterpretation(value) { 76 | this.inputs.forEach(function (input) { 77 | input.setChannelInterpretation(value); 78 | }); 79 | } 80 | }, { 81 | key: "disableOutputsIfNecessary", 82 | value: function disableOutputsIfNecessary() { 83 | // disable if all inputs are disabled 84 | 85 | /* istanbul ignore else */ 86 | if (this.isEnabled()) { 87 | var inputs = this.inputs; 88 | 89 | for (var i = 0, imax = inputs.length; i < imax; i++) { 90 | if (inputs[i].isEnabled()) { 91 | return; 92 | } 93 | } 94 | 95 | _get(Object.getPrototypeOf(ChannelMergerNode.prototype), "disableOutputsIfNecessary", this).call(this); 96 | } 97 | } 98 | }]); 99 | 100 | return ChannelMergerNode; 101 | }(AudioNode); 102 | 103 | Object.assign(ChannelMergerNode.prototype, ChannelMergerNodeDSP); 104 | 105 | module.exports = ChannelMergerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/ChannelSplitterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6 | 7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 8 | 9 | var util = require("../util"); 10 | var AudioNode = require("./AudioNode"); 11 | var ChannelSplitterNodeDSP = require("./dsp/ChannelSplitterNode"); 12 | 13 | var ChannelSplitterNode = function (_AudioNode) { 14 | _inherits(ChannelSplitterNode, _AudioNode); 15 | 16 | /** 17 | * @param {AudioContext} context 18 | * @param {object} opts 19 | * @param {number} opts.numberOfOutputs 20 | */ 21 | 22 | function ChannelSplitterNode(context, opts) { 23 | _classCallCheck(this, ChannelSplitterNode); 24 | 25 | opts = opts || /* istanbul ignore next */{}; 26 | 27 | var numberOfOutputs = util.defaults(opts.numberOfOutputs, 6); 28 | 29 | numberOfOutputs = util.toValidNumberOfChannels(numberOfOutputs); 30 | 31 | return _possibleConstructorReturn(this, Object.getPrototypeOf(ChannelSplitterNode).call(this, context, { 32 | inputs: [1], 33 | outputs: new Array(numberOfOutputs).fill(1), 34 | channelCount: 2, 35 | channelCountMode: "max" 36 | })); 37 | } 38 | 39 | return ChannelSplitterNode; 40 | }(AudioNode); 41 | 42 | Object.assign(ChannelSplitterNode.prototype, ChannelSplitterNodeDSP); 43 | 44 | module.exports = ChannelSplitterNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/DelayNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var util = require("../util"); 12 | var AudioNode = require("./AudioNode"); 13 | var DelayNodeDSP = require("./dsp/DelayNode"); 14 | 15 | var DelayNode = function (_AudioNode) { 16 | _inherits(DelayNode, _AudioNode); 17 | 18 | /** 19 | * @param {AudioContext} context 20 | * @param {object} opts 21 | * @param {number} opts.maxDelayTime 22 | */ 23 | 24 | function DelayNode(context, opts) { 25 | _classCallCheck(this, DelayNode); 26 | 27 | opts = opts || /* istanbul ignore next */{}; 28 | 29 | var maxDelayTime = util.defaults(opts.maxDelayTime, 1); 30 | 31 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DelayNode).call(this, context, { 32 | inputs: [1], 33 | outputs: [1], 34 | channelCount: 2, 35 | channelCountMode: "max" 36 | })); 37 | 38 | _this._maxDelayTime = Math.max(0, util.toNumber(maxDelayTime)); 39 | _this._delayTime = _this.addParam("audio", 0); 40 | 41 | _this.dspInit(_this._maxDelayTime); 42 | _this.dspUpdateKernel(1); 43 | return _this; 44 | } 45 | 46 | /** 47 | * @return {number} 48 | */ 49 | 50 | 51 | _createClass(DelayNode, [{ 52 | key: "getDelayTime", 53 | value: function getDelayTime() { 54 | return this._delayTime; 55 | } 56 | 57 | /** 58 | * @return {number} 59 | */ 60 | 61 | }, { 62 | key: "getMaxDelayTime", 63 | value: function getMaxDelayTime() { 64 | return this._maxDelayTime; 65 | } 66 | 67 | /** 68 | * @param {number} numberOfChannels 69 | */ 70 | 71 | }, { 72 | key: "channelDidUpdate", 73 | value: function channelDidUpdate(numberOfChannels) { 74 | this.dspUpdateKernel(numberOfChannels); 75 | this.outputs[0].setNumberOfChannels(numberOfChannels); 76 | } 77 | 78 | /** 79 | * @return {number} 80 | */ 81 | 82 | }, { 83 | key: "getTailTime", 84 | value: function getTailTime() { 85 | return this._maxDelayTime; 86 | } 87 | }]); 88 | 89 | return DelayNode; 90 | }(AudioNode); 91 | 92 | Object.assign(DelayNode.prototype, DelayNodeDSP); 93 | 94 | module.exports = DelayNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/DynamicsCompressorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var AudioNode = require("./AudioNode"); 12 | var DynamicsCompressorNodeDSP = require("./dsp/DynamicsCompressorNode"); 13 | 14 | var DynamicsCompressorNode = function (_AudioNode) { 15 | _inherits(DynamicsCompressorNode, _AudioNode); 16 | 17 | /** 18 | * @param {AudioContext} context 19 | */ 20 | 21 | function DynamicsCompressorNode(context) { 22 | _classCallCheck(this, DynamicsCompressorNode); 23 | 24 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DynamicsCompressorNode).call(this, context, { 25 | inputs: [1], 26 | outputs: [2], 27 | channelCount: 2, 28 | channelCountMode: "explicit" 29 | })); 30 | 31 | _this._threshold = _this.addParam("control", -24); 32 | _this._knee = _this.addParam("control", 30); 33 | _this._ratio = _this.addParam("control", 12); 34 | _this._attack = _this.addParam("control", 0.003); 35 | _this._release = _this.addParam("control", 0.250); 36 | return _this; 37 | } 38 | 39 | /** 40 | * @param {AudioParam} 41 | */ 42 | 43 | 44 | _createClass(DynamicsCompressorNode, [{ 45 | key: "getThreshold", 46 | value: function getThreshold() { 47 | return this._threshold; 48 | } 49 | 50 | /** 51 | * @param {AudioParam} 52 | */ 53 | 54 | }, { 55 | key: "getKnee", 56 | value: function getKnee() { 57 | return this._knee; 58 | } 59 | 60 | /** 61 | * @param {AudioParam} 62 | */ 63 | 64 | }, { 65 | key: "getRatio", 66 | value: function getRatio() { 67 | return this._ratio; 68 | } 69 | 70 | /** 71 | * @return {number} 72 | */ 73 | /* istanbul ignore next */ 74 | 75 | }, { 76 | key: "getReduction", 77 | value: function getReduction() { 78 | throw new TypeError("NOT YET IMPLEMENTED"); 79 | } 80 | 81 | /** 82 | * @param {AudioParam} 83 | */ 84 | 85 | }, { 86 | key: "getAttack", 87 | value: function getAttack() { 88 | return this._attack; 89 | } 90 | 91 | /** 92 | * @param {AudioParam} 93 | */ 94 | 95 | }, { 96 | key: "getRelease", 97 | value: function getRelease() { 98 | return this._release; 99 | } 100 | }]); 101 | 102 | return DynamicsCompressorNode; 103 | }(AudioNode); 104 | 105 | Object.assign(DynamicsCompressorNode.prototype, DynamicsCompressorNodeDSP); 106 | 107 | module.exports = DynamicsCompressorNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/EventTarget.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var events = require("events"); 8 | 9 | var EventTarget = function () { 10 | function EventTarget() { 11 | _classCallCheck(this, EventTarget); 12 | 13 | this._emitter = new events.EventEmitter(); 14 | } 15 | 16 | /** 17 | * @param {string} type 18 | * @param {function} listener 19 | */ 20 | 21 | 22 | _createClass(EventTarget, [{ 23 | key: "addEventListener", 24 | value: function addEventListener(type, listener) { 25 | /* istanbul ignore else */ 26 | if (typeof listener === "function") { 27 | this._emitter.addListener(type, listener); 28 | } 29 | } 30 | 31 | /** 32 | * @param {string} type 33 | * @param {function} listener 34 | */ 35 | 36 | }, { 37 | key: "removeEventListener", 38 | value: function removeEventListener(type, listener) { 39 | /* istanbul ignore else */ 40 | if (typeof listener === "function") { 41 | this._emitter.removeListener(type, listener); 42 | } 43 | } 44 | 45 | /** 46 | * @param {string} type 47 | * @param {function} oldListener 48 | * @param {function} newListener 49 | */ 50 | 51 | }, { 52 | key: "replaceEventListener", 53 | value: function replaceEventListener(type, oldListener, newListener) { 54 | this.removeEventListener(type, oldListener); 55 | this.addEventListener(type, newListener); 56 | } 57 | 58 | /** 59 | * @param {object} event 60 | * @param {string} event.type 61 | */ 62 | 63 | }, { 64 | key: "dispatchEvent", 65 | value: function dispatchEvent(event) { 66 | this._emitter.emit(event.type, event); 67 | } 68 | }]); 69 | 70 | return EventTarget; 71 | }(); 72 | 73 | module.exports = EventTarget; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/GainNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var AudioNode = require("./AudioNode"); 12 | var GainNodeDSP = require("./dsp/GainNode"); 13 | 14 | var GainNode = function (_AudioNode) { 15 | _inherits(GainNode, _AudioNode); 16 | 17 | /** 18 | * @param {AudioContext} context 19 | */ 20 | 21 | function GainNode(context) { 22 | _classCallCheck(this, GainNode); 23 | 24 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(GainNode).call(this, context, { 25 | inputs: [1], 26 | outputs: [1], 27 | channelCount: 2, 28 | channelCountMode: "max" 29 | })); 30 | 31 | _this._gain = _this.addParam("audio", 1); 32 | return _this; 33 | } 34 | 35 | /** 36 | * @return {AudioParam} 37 | */ 38 | 39 | 40 | _createClass(GainNode, [{ 41 | key: "getGain", 42 | value: function getGain() { 43 | return this._gain; 44 | } 45 | 46 | /** 47 | * @param {number} numberOfChannels 48 | */ 49 | 50 | }, { 51 | key: "channelDidUpdate", 52 | value: function channelDidUpdate(numberOfChannels) { 53 | this.outputs[0].setNumberOfChannels(numberOfChannels); 54 | } 55 | }]); 56 | 57 | return GainNode; 58 | }(AudioNode); 59 | 60 | Object.assign(GainNode.prototype, GainNodeDSP); 61 | 62 | module.exports = GainNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/IIRFilterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var util = require("../util"); 12 | var AudioNode = require("./AudioNode"); 13 | var IIRFilterNodeDSP = require("./dsp/IIRFilterNode"); 14 | 15 | var IIRFilterNode = function (_AudioNode) { 16 | _inherits(IIRFilterNode, _AudioNode); 17 | 18 | /** 19 | * @param {AudioContext} context 20 | * @param {object} opts 21 | * @param {Float32Array} opts.feedforward 22 | * @param {Float32Array} opts.feedback 23 | */ 24 | 25 | function IIRFilterNode(context, opts) { 26 | _classCallCheck(this, IIRFilterNode); 27 | 28 | opts = opts || /* istanbul ignore next */{}; 29 | 30 | var feedforward = util.defaults(opts.feedforward, [0]); 31 | var feedback = util.defaults(opts.feedback, [1]); 32 | 33 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(IIRFilterNode).call(this, context, { 34 | inputs: [1], 35 | outputs: [1], 36 | channelCount: 2, 37 | channelCountMode: "max" 38 | })); 39 | 40 | _this._feedforward = feedforward; 41 | _this._feedback = feedback; 42 | 43 | _this.dspInit(); 44 | _this.dspUpdateKernel(1); 45 | return _this; 46 | } 47 | 48 | /** 49 | * @param {Float32Array} frequencyHz 50 | * @param {Float32Array} magResponse 51 | * @param {Float32Array} phaseResponse 52 | */ 53 | /* istanbul ignore next */ 54 | 55 | 56 | _createClass(IIRFilterNode, [{ 57 | key: "getFrequencyResponse", 58 | value: function getFrequencyResponse() { 59 | throw new TypeError("NOT YET IMPLEMENTED"); 60 | } 61 | 62 | /** 63 | * @return {Float32Array} 64 | */ 65 | 66 | }, { 67 | key: "getFeedforward", 68 | value: function getFeedforward() { 69 | return this._feedforward; 70 | } 71 | 72 | /** 73 | * @return {Float32Array} 74 | */ 75 | 76 | }, { 77 | key: "getFeedback", 78 | value: function getFeedback() { 79 | return this._feedback; 80 | } 81 | 82 | /** 83 | * @param {number} numberOfChannels 84 | */ 85 | 86 | }, { 87 | key: "channelDidUpdate", 88 | value: function channelDidUpdate(numberOfChannels) { 89 | this.dspUpdateKernel(numberOfChannels); 90 | this.outputs[0].setNumberOfChannels(numberOfChannels); 91 | } 92 | }]); 93 | 94 | return IIRFilterNode; 95 | }(AudioNode); 96 | 97 | Object.assign(IIRFilterNode.prototype, IIRFilterNodeDSP); 98 | 99 | module.exports = IIRFilterNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/PannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var BasePannerNode = require("./BasePannerNode"); 12 | var PannerNodeDSP = require("./dsp/PannerNode"); 13 | 14 | var PannerNode = function (_BasePannerNode) { 15 | _inherits(PannerNode, _BasePannerNode); 16 | 17 | /** 18 | * @param {AudioContext} context 19 | */ 20 | 21 | function PannerNode(context) { 22 | _classCallCheck(this, PannerNode); 23 | 24 | return _possibleConstructorReturn(this, Object.getPrototypeOf(PannerNode).call(this, context)); 25 | } 26 | 27 | /** 28 | * @param {number} x 29 | * @param {number} y 30 | * @param {number} z 31 | */ 32 | /* istanbul ignore next */ 33 | 34 | 35 | _createClass(PannerNode, [{ 36 | key: "setPosition", 37 | value: function setPosition() { 38 | throw new TypeError("NOT YET IMPLEMENTED"); 39 | } 40 | 41 | /** 42 | * @param {number} x 43 | * @param {number} y 44 | * @param {number} z 45 | */ 46 | /* istanbul ignore next */ 47 | 48 | }, { 49 | key: "setOrientation", 50 | value: function setOrientation() { 51 | throw new TypeError("NOT YET IMPLEMENTED"); 52 | } 53 | 54 | /** 55 | * @param {number} x 56 | * @param {number} y 57 | * @param {number} z 58 | */ 59 | /* istanbul ignore next */ 60 | 61 | }, { 62 | key: "setVelocity", 63 | value: function setVelocity() { 64 | throw new TypeError("NOT YET IMPLEMENTED"); 65 | } 66 | }]); 67 | 68 | return PannerNode; 69 | }(BasePannerNode); 70 | 71 | Object.assign(PannerNode.prototype, PannerNodeDSP); 72 | 73 | module.exports = PannerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/PeriodicWave.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var PeriodicWaveDSP = require("./dsp/PeriodicWave"); 8 | 9 | var PeriodicWave = function () { 10 | /** 11 | * @param {AudioContext} context 12 | * @param {object} opts 13 | * @param {Float32Array} opts.real 14 | * @param {Float32Array} opts.imag 15 | * @param {boolean} opts.constraints 16 | */ 17 | 18 | function PeriodicWave(context, opts) { 19 | _classCallCheck(this, PeriodicWave); 20 | 21 | opts = opts || /* istanbul ignore next */{}; 22 | 23 | var real = opts.real; 24 | var imag = opts.imag; 25 | var constraints = opts.constraints; 26 | 27 | this.context = context; 28 | this._real = real; 29 | this._imag = imag; 30 | this._constants = !!constraints; 31 | this._name = "custom"; 32 | 33 | this.dspInit(); 34 | } 35 | 36 | /** 37 | * @return {Float32Array} 38 | */ 39 | 40 | 41 | _createClass(PeriodicWave, [{ 42 | key: "getReal", 43 | value: function getReal() { 44 | return this._real; 45 | } 46 | 47 | /** 48 | * @return {Float32Array} 49 | */ 50 | 51 | }, { 52 | key: "getImag", 53 | value: function getImag() { 54 | return this._imag; 55 | } 56 | 57 | /** 58 | * @return {booleam} 59 | */ 60 | 61 | }, { 62 | key: "getConstraints", 63 | value: function getConstraints() { 64 | return this._constants; 65 | } 66 | 67 | /** 68 | * @return {string} 69 | */ 70 | 71 | }, { 72 | key: "getName", 73 | value: function getName() { 74 | return this._name; 75 | } 76 | 77 | /** 78 | * @return {Float32Array} 79 | */ 80 | 81 | }, { 82 | key: "getWaveTable", 83 | value: function getWaveTable() { 84 | if (!this._waveTable) { 85 | this._waveTable = this.dspBuildWaveTable(); 86 | } 87 | return this._waveTable; 88 | } 89 | }, { 90 | key: "generateBasicWaveform", 91 | value: function generateBasicWaveform(type) { 92 | var length = 512; 93 | 94 | switch (type) { 95 | case "sine": 96 | this._real = new Float32Array([0, 0]); 97 | this._imag = new Float32Array([0, 1]); 98 | this._name = "sine"; 99 | break; 100 | case "sawtooth": 101 | this._real = new Float32Array(length); 102 | this._imag = new Float32Array(Array.from({ length: length }, function (_, n) { 103 | return n === 0 ? 0 : Math.pow(-1, n + 1) * (2 / (n * Math.PI)); 104 | })); 105 | this._name = "sawtooth"; 106 | this.dspBuildWaveTable(); 107 | break; 108 | case "triangle": 109 | this._real = new Float32Array(length); 110 | this._imag = new Float32Array(Array.from({ length: length }, function (_, n) { 111 | return n === 0 ? 0 : 8 * Math.sin(n * Math.PI / 2) / Math.pow(n * Math.PI, 2); 112 | })); 113 | this._name = "triangle"; 114 | this.dspBuildWaveTable(); 115 | break; 116 | case "square": 117 | this._real = new Float32Array(length); 118 | this._imag = new Float32Array(Array.from({ length: length }, function (_, n) { 119 | return n === 0 ? 0 : 2 / (n * Math.PI) * (1 - Math.pow(-1, n)); 120 | })); 121 | this._name = "square"; 122 | this.dspBuildWaveTable(); 123 | break; 124 | default: 125 | this._real = new Float32Array([0]); 126 | this._imag = new Float32Array([0]); 127 | this._name = "custom"; 128 | this.dspBuildWaveTable(); 129 | break; 130 | } 131 | } 132 | }]); 133 | 134 | return PeriodicWave; 135 | }(); 136 | 137 | PeriodicWave.BasicWaveForms = ["sine", "sawtooth", "triangle", "square"]; 138 | 139 | Object.assign(PeriodicWave.prototype, PeriodicWaveDSP); 140 | 141 | module.exports = PeriodicWave; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/ScriptProcessorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var util = require("../util"); 12 | var AudioNode = require("./AudioNode"); 13 | var ScriptProcessorNodeDSP = require("./dsp/ScriptProcessorNode"); 14 | 15 | var ScriptProcessorNode = function (_AudioNode) { 16 | _inherits(ScriptProcessorNode, _AudioNode); 17 | 18 | /** 19 | * @param {AudioContext} context 20 | * @param {object} opts 21 | * @param {number} opts.bufferSize 22 | * @param {number} opts.numberOfInputChannels 23 | * @param {number} opts.numberOfOutputChannels 24 | */ 25 | 26 | function ScriptProcessorNode(context, opts) { 27 | _classCallCheck(this, ScriptProcessorNode); 28 | 29 | opts = opts || /* istanbul ignore next */{}; 30 | 31 | var bufferSize = opts.bufferSize; 32 | var numberOfInputChannels = opts.numberOfInputChannels; 33 | var numberOfOutputChannels = opts.numberOfOutputChannels; 34 | 35 | bufferSize = Math.max(256, Math.min(bufferSize | 0, 16384)); 36 | bufferSize = util.toPowerOfTwo(bufferSize, Math.ceil); 37 | numberOfInputChannels = util.toValidNumberOfChannels(numberOfInputChannels); 38 | numberOfOutputChannels = util.toValidNumberOfChannels(numberOfOutputChannels); 39 | 40 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ScriptProcessorNode).call(this, context, { 41 | inputs: [numberOfInputChannels], 42 | outputs: [numberOfOutputChannels], 43 | channelCount: numberOfInputChannels, 44 | channelCountMode: "explicit" 45 | })); 46 | 47 | _this._bufferSize = bufferSize; 48 | _this.enableOutputsIfNecessary(); 49 | _this.dspInit(); 50 | return _this; 51 | } 52 | 53 | /** 54 | * @return {number} 55 | */ 56 | 57 | 58 | _createClass(ScriptProcessorNode, [{ 59 | key: "getBufferSize", 60 | value: function getBufferSize() { 61 | return this._bufferSize; 62 | } 63 | }, { 64 | key: "setChannelCount", 65 | value: function setChannelCount() { 66 | // This node's channelCount cannot be changed. 67 | } 68 | }, { 69 | key: "setChannelCountMode", 70 | value: function setChannelCountMode() {} 71 | // This node's channelCountMode cannot be changed. 72 | 73 | 74 | /** 75 | * @return {object} eventItem 76 | */ 77 | 78 | }, { 79 | key: "setEventItem", 80 | value: function setEventItem(eventItem) { 81 | this.dspSetEventItem(eventItem); 82 | } 83 | 84 | /** 85 | * @return {number} 86 | */ 87 | 88 | }, { 89 | key: "getTailTime", 90 | value: function getTailTime() { 91 | return Infinity; 92 | } 93 | }]); 94 | 95 | return ScriptProcessorNode; 96 | }(AudioNode); 97 | 98 | Object.assign(ScriptProcessorNode.prototype, ScriptProcessorNodeDSP); 99 | 100 | module.exports = ScriptProcessorNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/SpatialListener.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var AudioParam = require("./AudioParam"); 8 | 9 | var SpatialListener = function () { 10 | /** 11 | * @param {AudioContext} context 12 | */ 13 | 14 | function SpatialListener(context) { 15 | _classCallCheck(this, SpatialListener); 16 | 17 | this.context = context; 18 | this._positionX = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 19 | this._positionY = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 20 | this._positionZ = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 21 | this._forwardX = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 22 | this._forwardY = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 23 | this._forwardZ = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 24 | this._upX = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 25 | this._upY = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 26 | this._upZ = new AudioParam(context, { rate: "audio", defaultValue: 0 }); 27 | } 28 | 29 | /** 30 | * @return {AudioParam} 31 | */ 32 | 33 | 34 | _createClass(SpatialListener, [{ 35 | key: "getPositionX", 36 | value: function getPositionX() { 37 | return this._positionX; 38 | } 39 | 40 | /** 41 | * @return {AudioParam} 42 | */ 43 | 44 | }, { 45 | key: "getPositionY", 46 | value: function getPositionY() { 47 | return this._positionY; 48 | } 49 | 50 | /** 51 | * @return {AudioParam} 52 | */ 53 | 54 | }, { 55 | key: "getPositionZ", 56 | value: function getPositionZ() { 57 | return this._positionZ; 58 | } 59 | 60 | /** 61 | * @return {AudioParam} 62 | */ 63 | 64 | }, { 65 | key: "getForwardX", 66 | value: function getForwardX() { 67 | return this._forwardX; 68 | } 69 | 70 | /** 71 | * @return {AudioParam} 72 | */ 73 | 74 | }, { 75 | key: "getForwardY", 76 | value: function getForwardY() { 77 | return this._forwardY; 78 | } 79 | 80 | /** 81 | * @return {AudioParam} 82 | */ 83 | 84 | }, { 85 | key: "getForwardZ", 86 | value: function getForwardZ() { 87 | return this._forwardZ; 88 | } 89 | 90 | /** 91 | * @return {AudioParam} 92 | */ 93 | 94 | }, { 95 | key: "getUpX", 96 | value: function getUpX() { 97 | return this._upX; 98 | } 99 | 100 | /** 101 | * @return {AudioParam} 102 | */ 103 | 104 | }, { 105 | key: "getUpY", 106 | value: function getUpY() { 107 | return this._upY; 108 | } 109 | 110 | /** 111 | * @return {AudioParam} 112 | */ 113 | 114 | }, { 115 | key: "getUpZ", 116 | value: function getUpZ() { 117 | return this._upZ; 118 | } 119 | }]); 120 | 121 | return SpatialListener; 122 | }(); 123 | 124 | module.exports = SpatialListener; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/SpatialPannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var BasePannerNode = require("./BasePannerNode"); 12 | var SpatialPannerNodeDSP = require("./dsp/SpatialPannerNode"); 13 | 14 | var SpatialPannerNode = function (_BasePannerNode) { 15 | _inherits(SpatialPannerNode, _BasePannerNode); 16 | 17 | /** 18 | * @param {AudioContext} 19 | */ 20 | 21 | function SpatialPannerNode(context) { 22 | _classCallCheck(this, SpatialPannerNode); 23 | 24 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SpatialPannerNode).call(this, context)); 25 | 26 | _this._positionX = _this.addParam("audio", 0); 27 | _this._positionY = _this.addParam("audio", 0); 28 | _this._positionZ = _this.addParam("audio", 0); 29 | _this._orientationX = _this.addParam("audio", 0); 30 | _this._orientationY = _this.addParam("audio", 0); 31 | _this._orientationZ = _this.addParam("audio", 0); 32 | return _this; 33 | } 34 | 35 | /** 36 | * @param {AudioParam} 37 | */ 38 | 39 | 40 | _createClass(SpatialPannerNode, [{ 41 | key: "getPositionX", 42 | value: function getPositionX() { 43 | return this._positionX; 44 | } 45 | 46 | /** 47 | * @param {AudioParam} 48 | */ 49 | 50 | }, { 51 | key: "getPositionY", 52 | value: function getPositionY() { 53 | return this._positionY; 54 | } 55 | 56 | /** 57 | * @param {AudioParam} 58 | */ 59 | 60 | }, { 61 | key: "getPositionZ", 62 | value: function getPositionZ() { 63 | return this._positionZ; 64 | } 65 | 66 | /** 67 | * @param {AudioParam} 68 | */ 69 | 70 | }, { 71 | key: "getOrientationX", 72 | value: function getOrientationX() { 73 | return this._positionX; 74 | } 75 | 76 | /** 77 | * @param {AudioParam} 78 | */ 79 | 80 | }, { 81 | key: "getOrientationY", 82 | value: function getOrientationY() { 83 | return this._positionY; 84 | } 85 | 86 | /** 87 | * @param {AudioParam} 88 | */ 89 | 90 | }, { 91 | key: "getOrientationZ", 92 | value: function getOrientationZ() { 93 | return this._positionZ; 94 | } 95 | }]); 96 | 97 | return SpatialPannerNode; 98 | }(BasePannerNode); 99 | 100 | Object.assign(SpatialPannerNode.prototype, SpatialPannerNodeDSP); 101 | 102 | module.exports = SpatialPannerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/StereoPannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var BasePannerNode = require("./BasePannerNode"); 12 | var StereoPannerNodeDSP = require("./dsp/StereoPannerNode"); 13 | 14 | var StereoPannerNode = function (_BasePannerNode) { 15 | _inherits(StereoPannerNode, _BasePannerNode); 16 | 17 | /** 18 | * @param {AudioContext} context 19 | */ 20 | 21 | function StereoPannerNode(context) { 22 | _classCallCheck(this, StereoPannerNode); 23 | 24 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(StereoPannerNode).call(this, context)); 25 | 26 | _this._pan = _this.addParam("audio", 0); 27 | return _this; 28 | } 29 | 30 | /** 31 | * @param {AudioParam} 32 | */ 33 | 34 | 35 | _createClass(StereoPannerNode, [{ 36 | key: "getPan", 37 | value: function getPan() { 38 | return this._pan; 39 | } 40 | }]); 41 | 42 | return StereoPannerNode; 43 | }(BasePannerNode); 44 | 45 | Object.assign(StereoPannerNode.prototype, StereoPannerNodeDSP); 46 | 47 | module.exports = StereoPannerNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/WaveShaperNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 8 | 9 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 10 | 11 | var AudioNode = require("./AudioNode"); 12 | var WaveShaperNodeDSP = require("./dsp/WaveShaperNode"); 13 | 14 | var OverSampleTypes = ["none", "2x", "4x"]; 15 | 16 | var WaveShaperNode = function (_AudioNode) { 17 | _inherits(WaveShaperNode, _AudioNode); 18 | 19 | /** 20 | * @param {AudioContext} 21 | */ 22 | 23 | function WaveShaperNode(context) { 24 | _classCallCheck(this, WaveShaperNode); 25 | 26 | var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(WaveShaperNode).call(this, context, { 27 | inputs: [1], 28 | outputs: [1], 29 | channelCount: 2, 30 | channelCountMode: "max" 31 | })); 32 | 33 | _this._curve = null; 34 | _this._overSample = "none"; 35 | 36 | _this.dspInit(); 37 | _this.dspUpdateKernel(null, 1); 38 | return _this; 39 | } 40 | 41 | /** 42 | * @return {Float32Array} 43 | */ 44 | 45 | 46 | _createClass(WaveShaperNode, [{ 47 | key: "getCurve", 48 | value: function getCurve() { 49 | return this._curve; 50 | } 51 | 52 | /** 53 | * @param {Float32Array} value 54 | */ 55 | 56 | }, { 57 | key: "setCurve", 58 | value: function setCurve(value) { 59 | /* istanbul ignore else */ 60 | if (value === null || value instanceof Float32Array) { 61 | this._curve = value; 62 | this.dspUpdateKernel(this._curve, this.outputs[0].getNumberOfChannels()); 63 | } 64 | } 65 | 66 | /** 67 | * @return {boolean} 68 | */ 69 | 70 | }, { 71 | key: "getOversample", 72 | value: function getOversample() { 73 | return this._overSample; 74 | } 75 | 76 | /** 77 | * @param {boolean} value 78 | */ 79 | 80 | }, { 81 | key: "setOversample", 82 | value: function setOversample(value) { 83 | /* istanbul ignore else */ 84 | if (OverSampleTypes.indexOf(value) !== -1) { 85 | this._overSample = value; 86 | } 87 | } 88 | 89 | /** 90 | * @param {number} numberOfChannels 91 | */ 92 | 93 | }, { 94 | key: "channelDidUpdate", 95 | value: function channelDidUpdate(numberOfChannels) { 96 | this.dspUpdateKernel(this._curve, numberOfChannels); 97 | this.outputs[0].setNumberOfChannels(numberOfChannels); 98 | } 99 | }]); 100 | 101 | return WaveShaperNode; 102 | }(AudioNode); 103 | 104 | Object.assign(WaveShaperNode.prototype, WaveShaperNodeDSP); 105 | 106 | module.exports = WaveShaperNode; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/core/AudioData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * AudioData is struct like AudioBuffer. 5 | * This instance has no methods. 6 | * The channel data of this instance are taken via property accessor. 7 | * @prop {number} numberOfChannels 8 | * @prop {number} length 9 | * @prop {number} sampleRate 10 | * @prop {Float32Array[]} channelData 11 | */ 12 | 13 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 14 | 15 | var AudioData = 16 | /** 17 | * @param {number} numberOfChannels 18 | * @param {number} length 19 | * @param {number} sampleRate 20 | */ 21 | function AudioData(numberOfChannels, length, sampleRate) { 22 | var _this = this; 23 | 24 | _classCallCheck(this, AudioData); 25 | 26 | this.numberOfChannels = numberOfChannels | 0; 27 | this.length = length | 0; 28 | this.sampleRate = sampleRate | 0; 29 | this.channelData = Array.from({ length: this.numberOfChannels }, function () { 30 | return new Float32Array(_this.length); 31 | }); 32 | }; 33 | 34 | module.exports = AudioData; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/AnalyserNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var AnalyserNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | this.outputs[0].bus.copyFrom(this.inputs[0].bus); 6 | } 7 | }; 8 | 9 | module.exports = AnalyserNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/AudioBufferSourceNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var AudioBufferSourceNodeDSP = { 4 | dspInit: function dspInit() { 5 | this._phase = 0; 6 | }, 7 | dspStart: function dspStart() { 8 | var bufferSampleRate = this._audioData.sampleRate; 9 | var bufferDuration = this._audioData.length / bufferSampleRate; 10 | 11 | this._phase = Math.max(0, Math.min(this._offset, bufferDuration)) * bufferSampleRate; 12 | }, 13 | dspProcess: function dspProcess() { 14 | var _this = this; 15 | 16 | var blockSize = this.blockSize; 17 | var quantumStartFrame = this.context.currentSampleFrame; 18 | var quantumEndFrame = quantumStartFrame + blockSize; 19 | var sampleOffset = Math.max(0, this._startFrame - quantumStartFrame); 20 | var fillToSample = Math.min(quantumEndFrame, this._stopFrame) - quantumStartFrame; 21 | var outputs = this.outputs[0].bus.getMutableData(); 22 | 23 | var writeIndex = 0; 24 | 25 | writeIndex = this.dspBufferRendering(outputs, sampleOffset, fillToSample, this.sampleRate); 26 | 27 | // timeline 28 | // |----------------|-------*--------|----------------|----------------| 29 | // ^ ^ ^ 30 | // |------>| quantumEndFrame 31 | // | wrote | 32 | // | stopFrame 33 | // quantumStartFrame 34 | if (this._stopFrame <= quantumStartFrame + writeIndex) { 35 | // rest samples fill zero 36 | var numberOfChannels = outputs.length; 37 | 38 | while (writeIndex < blockSize) { 39 | for (var ch = 0; ch < numberOfChannels; ch++) { 40 | outputs[ch][writeIndex] = 0; 41 | } 42 | writeIndex += 1; 43 | } 44 | 45 | this.context.addPostProcess(function () { 46 | _this.outputs[0].bus.zeros(); 47 | _this.outputs[0].disable(); 48 | _this.dispatchEvent({ type: "ended" }); 49 | }); 50 | } 51 | }, 52 | dspBufferRendering: function dspBufferRendering(outputs, writeIndex, inNumSamples, sampleRate) { 53 | var playbackRateValues = this._playbackRate.getSampleAccurateValues(); 54 | var detuneValues = this._detune.getSampleAccurateValues(); 55 | var numberOfChannels = this._audioData.numberOfChannels; 56 | var bufferLength = this._audioData.length; 57 | var bufferSampleRate = this._audioData.sampleRate; 58 | var bufferChannelData = this._audioData.channelData; 59 | var playbackRateToPhaseIncr = bufferSampleRate / sampleRate; 60 | 61 | var phase = this._phase; 62 | 63 | while (writeIndex < inNumSamples) { 64 | var playbackRateValue = playbackRateValues[writeIndex]; 65 | var detuneValue = detuneValues[writeIndex]; 66 | var computedPlaybackRate = playbackRateValue * Math.pow(2, detuneValue / 1200); 67 | 68 | for (var ch = 0; ch < numberOfChannels; ch++) { 69 | var v0 = bufferChannelData[ch][phase | 0] || 0; 70 | var v1 = bufferChannelData[ch][(phase | 0) + 1] || 0; 71 | 72 | outputs[ch][writeIndex] = v0 + phase % 1 * (v1 - v0); 73 | } 74 | writeIndex += 1; 75 | 76 | phase += playbackRateToPhaseIncr * Math.max(0, computedPlaybackRate); 77 | 78 | var phaseTime = phase / bufferSampleRate; 79 | var bufferDuration = bufferLength / bufferSampleRate; 80 | 81 | if (this._loop) { 82 | if (bufferDuration <= phaseTime || 0 < this._loopEnd && this._loopEnd <= phaseTime) { 83 | phase = Math.max(0, Math.min(this._loopStart, bufferDuration)) * bufferSampleRate; 84 | } 85 | } else { 86 | if (bufferDuration <= phaseTime) { 87 | break; 88 | } 89 | } 90 | } 91 | 92 | this._phase = phase; 93 | 94 | return writeIndex; 95 | } 96 | }; 97 | 98 | module.exports = AudioBufferSourceNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/AudioDestinationNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var AudioDestinationDSP = { 4 | dspProcess: function dspProcess() { 5 | this.outputBus.copyFrom(this.inputs[0].bus); 6 | } 7 | }; 8 | 9 | module.exports = AudioDestinationDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/ChannelMergerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var ChannelMergerNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var outputBus = this.outputs[0].bus; 6 | var inputBuses = this.inputs.map(function (input) { 7 | return input.bus; 8 | }); 9 | var allSilent = inputBuses.every(function (inputBus) { 10 | return inputBus.isSilent; 11 | }); 12 | 13 | outputBus.zeros(); 14 | 15 | if (!allSilent) { 16 | var outputChannelData = outputBus.getMutableData(); 17 | 18 | for (var i = 0, imax = inputBuses.length; i < imax; i++) { 19 | outputChannelData[i].set(inputBuses[i].getChannelData()[0]); 20 | } 21 | } 22 | } 23 | }; 24 | 25 | module.exports = ChannelMergerNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/ChannelSplitterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var ChannelSplitterNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var inputBus = this.inputs[0].bus; 6 | var outputs = this.outputs; 7 | 8 | if (inputBus.isSilent) { 9 | for (var i = 0, imax = outputs.length; i < imax; i++) { 10 | outputs[i].bus.zeros(); 11 | } 12 | } else { 13 | var inputChannelData = inputBus.getChannelData(); 14 | 15 | for (var _i = 0, _imax = outputs.length; _i < _imax; _i++) { 16 | var outputBus = outputs[_i].bus; 17 | 18 | if (inputChannelData[_i]) { 19 | outputBus.getMutableData()[0].set(inputChannelData[_i]); 20 | } else { 21 | outputBus.zeros(); 22 | } 23 | } 24 | } 25 | } 26 | }; 27 | 28 | module.exports = ChannelSplitterNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/ConvolverNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var ConvolverNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var outputBus = this.outputs[0].bus; 6 | 7 | outputBus.zeros(); 8 | outputBus.sumFrom(this.inputs[0].bus); 9 | } 10 | }; 11 | 12 | module.exports = ConvolverNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/DynamicsCompressorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var DynamicsCompressorNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var outputBus = this.outputs[0].bus; 6 | 7 | outputBus.zeros(); 8 | outputBus.sumFrom(this.inputs[0].bus); 9 | } 10 | }; 11 | 12 | module.exports = DynamicsCompressorNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/GainNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var DSPAlgorithm = {}; 4 | 5 | var GainNodeDSP = { 6 | dspProcess: function dspProcess() { 7 | var inputBus = this.inputs[0].bus; 8 | var outputBus = this.outputs[0].bus; 9 | 10 | if (inputBus.isSilent) { 11 | outputBus.zeros(); 12 | return; 13 | } 14 | 15 | var gainParam = this._gain; 16 | 17 | if (gainParam.hasSampleAccurateValues()) { 18 | var _inputs = inputBus.getChannelData(); 19 | var _outputs = outputBus.getMutableData(); 20 | var gainValues = gainParam.getSampleAccurateValues(); 21 | var _numberOfChannels = _inputs.length; 22 | var _dsp = selectAlgorithm(_numberOfChannels, 1000); 23 | 24 | _dsp(_inputs, _outputs, gainValues, this.blockSize); 25 | 26 | return; 27 | } 28 | 29 | var gainValue = gainParam.getValue(); 30 | 31 | if (gainValue === 0) { 32 | outputBus.zeros(); 33 | return; 34 | } 35 | 36 | if (gainValue === 1) { 37 | outputBus.copyFrom(inputBus); 38 | return; 39 | } 40 | 41 | var inputs = inputBus.getChannelData(); 42 | var outputs = outputBus.getMutableData(); 43 | var numberOfChannels = outputs.length; 44 | var dsp = selectAlgorithm(numberOfChannels, 2000); 45 | 46 | dsp(inputs, outputs, gainValue, this.blockSize); 47 | } 48 | }; 49 | 50 | function selectAlgorithm(numberOfChannels, base) { 51 | var algorithmIndex = numberOfChannels + base; 52 | 53 | if (DSPAlgorithm[algorithmIndex]) { 54 | return DSPAlgorithm[algorithmIndex]; 55 | } 56 | 57 | return DSPAlgorithm[base]; 58 | } 59 | 60 | DSPAlgorithm[1000] = function (inputs, outputs, gainValues, blockSize) { 61 | var numberOfChannels = inputs.length; 62 | 63 | for (var ch = 0; ch < numberOfChannels; ch++) { 64 | for (var i = 0; i < blockSize; i++) { 65 | outputs[ch][i] = inputs[ch][i] * gainValues[i]; 66 | } 67 | } 68 | }; 69 | 70 | DSPAlgorithm[1001] = function (inputs, outputs, gainValues, blockSize) { 71 | var input = inputs[0]; 72 | var output = outputs[0]; 73 | 74 | for (var i = 0; i < blockSize; i++) { 75 | output[i] = input[i] * gainValues[i]; 76 | } 77 | }; 78 | 79 | DSPAlgorithm[1002] = function (inputs, outputs, gainValues, blockSize) { 80 | var inputL = inputs[0]; 81 | var inputR = inputs[1]; 82 | var outputL = outputs[0]; 83 | var outputR = outputs[1]; 84 | 85 | for (var i = 0; i < blockSize; i++) { 86 | outputL[i] = inputL[i] * gainValues[i]; 87 | outputR[i] = inputR[i] * gainValues[i]; 88 | } 89 | }; 90 | 91 | DSPAlgorithm[2000] = function (inputs, outputs, gainValue, blockSize) { 92 | var numberOfChannels = inputs.length; 93 | 94 | for (var ch = 0; ch < numberOfChannels; ch++) { 95 | for (var i = 0; i < blockSize; i++) { 96 | outputs[ch][i] = inputs[ch][i] * gainValue; 97 | } 98 | } 99 | }; 100 | 101 | DSPAlgorithm[2001] = function (inputs, outputs, gainValue, blockSize) { 102 | var input = inputs[0]; 103 | var output = outputs[0]; 104 | 105 | for (var i = 0; i < blockSize; i++) { 106 | output[i] = input[i] * gainValue; 107 | } 108 | }; 109 | 110 | DSPAlgorithm[2002] = function (inputs, outputs, gainValue, blockSize) { 111 | var inputL = inputs[0]; 112 | var inputR = inputs[1]; 113 | var outputL = outputs[0]; 114 | var outputR = outputs[1]; 115 | 116 | for (var i = 0; i < blockSize; i++) { 117 | outputL[i] = inputL[i] * gainValue; 118 | outputR[i] = inputR[i] * gainValue; 119 | } 120 | }; 121 | 122 | module.exports = GainNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/IIRFilterNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var IIRFilterNodeDSP = { 8 | dspInit: function dspInit() { 9 | this._kernels = []; 10 | }, 11 | dspUpdateKernel: function dspUpdateKernel(numberOfChannels) { 12 | if (numberOfChannels < this._kernels.length) { 13 | this._kernels.splice(numberOfChannels); 14 | } else if (this._kernels.length < numberOfChannels) { 15 | while (numberOfChannels !== this._kernels.length) { 16 | this._kernels.push(new IIRFilterKernel(this._feedforward, this._feedback)); 17 | } 18 | } 19 | 20 | switch (numberOfChannels) { 21 | case 1: 22 | this.dspProcess = this.dspProcess1; 23 | break; 24 | case 2: 25 | this.dspProcess = this.dspProcess2; 26 | break; 27 | default: 28 | this.dspProcess = this.dspProcessN; 29 | break; 30 | } 31 | }, 32 | dspProcess1: function dspProcess1() { 33 | var inputs = this.inputs[0].bus.getChannelData(); 34 | var outputs = this.outputs[0].bus.getMutableData(); 35 | var kernels = this._kernels; 36 | 37 | kernels[0].process(inputs[0], outputs[0], this.blockSize); 38 | }, 39 | dspProcess2: function dspProcess2() { 40 | var blockSize = this.blockSize; 41 | var inputs = this.inputs[0].bus.getChannelData(); 42 | var outputs = this.outputs[0].bus.getMutableData(); 43 | var kernels = this._kernels; 44 | 45 | kernels[0].process(inputs[0], outputs[0], blockSize); 46 | kernels[1].process(inputs[1], outputs[1], blockSize); 47 | }, 48 | dspProcessN: function dspProcessN() { 49 | var blockSize = this.blockSize; 50 | var inputs = this.inputs[0].bus.getChannelData(); 51 | var outputs = this.outputs[0].bus.getMutableData(); 52 | var kernels = this._kernels; 53 | 54 | for (var i = 0, imax = kernels.length; i < imax; i++) { 55 | kernels[i].process(inputs[i], outputs[i], blockSize); 56 | } 57 | } 58 | }; 59 | 60 | var IIRFilterKernel = function () { 61 | function IIRFilterKernel(feedforward, feedback) { 62 | _classCallCheck(this, IIRFilterKernel); 63 | 64 | this.a = toCoefficient(feedback, feedback[0]); 65 | this.b = toCoefficient(feedforward, feedback[0]); 66 | this.x = new Float32Array(this.b.length); 67 | this.y = new Float32Array(this.a.length); 68 | } 69 | 70 | _createClass(IIRFilterKernel, [{ 71 | key: "process", 72 | value: function process(input, output, inNumSamples) { 73 | var a = this.a; 74 | var b = this.b; 75 | var x = this.x; 76 | var y = this.y; 77 | var alen = this.a.length - 1; 78 | var blen = this.b.length; 79 | 80 | for (var i = 0; i < inNumSamples; i++) { 81 | x[blen - 1] = input[i]; 82 | y[alen] = 0; 83 | 84 | for (var j = 0; j < blen; j++) { 85 | y[alen] += b[j] * x[j]; 86 | x[j] = flushDenormalFloatToZero(x[j + 1]); 87 | } 88 | 89 | for (var _j = 0; _j < alen; _j++) { 90 | y[alen] -= a[_j] * y[_j]; 91 | y[_j] = flushDenormalFloatToZero(y[_j + 1]); 92 | } 93 | 94 | output[i] = y[alen]; 95 | } 96 | } 97 | }]); 98 | 99 | return IIRFilterKernel; 100 | }(); 101 | 102 | function toCoefficient(filter, a0) { 103 | var coeff = new Float32Array(filter.length); 104 | 105 | for (var i = 0, imax = coeff.length; i < imax; i++) { 106 | coeff[i] = filter[imax - i - 1] / a0; 107 | } 108 | 109 | return coeff; 110 | } 111 | 112 | function flushDenormalFloatToZero(f) { 113 | return Math.abs(f) < 1.175494e-38 ? 0.0 : f; 114 | } 115 | 116 | module.exports = IIRFilterNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/PannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var PannerNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var outputBus = this.outputs[0].bus; 6 | 7 | outputBus.zeros(); 8 | outputBus.sumFrom(this.inputs[0].bus); 9 | } 10 | }; 11 | 12 | module.exports = PannerNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/PeriodicWave.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var WAVE_TABLE_LENGTH = 8192; 4 | 5 | var PeriodicWaveDSP = { 6 | dspInit: function dspInit() { 7 | this._waveTable = null; 8 | }, 9 | dspBuildWaveTable: function dspBuildWaveTable() { 10 | if (this._waveTable !== null) { 11 | return this._waveTable; 12 | } 13 | 14 | var waveTable = new Float32Array(WAVE_TABLE_LENGTH + 1); 15 | var real = this._real; 16 | var imag = this._imag; 17 | 18 | var maxAbsValue = 0; 19 | var periodicWaveLength = Math.min(real.length, 16); 20 | 21 | for (var i = 0; i < WAVE_TABLE_LENGTH; i++) { 22 | var x = i / WAVE_TABLE_LENGTH * Math.PI * 2; 23 | 24 | for (var n = 1; n < periodicWaveLength; n++) { 25 | waveTable[i] += real[n] * Math.cos(n * x) + imag[n] * Math.sin(n * x); 26 | } 27 | 28 | maxAbsValue = Math.max(maxAbsValue, Math.abs(waveTable[i])); 29 | } 30 | 31 | if (!this._constants && maxAbsValue !== 1) { 32 | for (var _i = 0; _i < WAVE_TABLE_LENGTH; _i++) { 33 | waveTable[_i] *= maxAbsValue; 34 | } 35 | } 36 | waveTable[WAVE_TABLE_LENGTH] = waveTable[0]; 37 | 38 | this._waveTable = waveTable; 39 | 40 | return waveTable; 41 | } 42 | }; 43 | 44 | module.exports = PeriodicWaveDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/ScriptProcessorNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var util = require("../../util"); 4 | var AudioBuffer = require("../AudioBuffer"); 5 | 6 | var ScriptProcessorNodeDSP = { 7 | dspInit: function dspInit() { 8 | this._eventItem = null; 9 | this._inputChannelData = null; 10 | this._outputChannelData = null; 11 | this._writeIndex = 0; 12 | }, 13 | dspSetEventItem: function dspSetEventItem(eventItem) { 14 | var numberOfInputChannels = this.inputs[0].getNumberOfChannels(); 15 | var numberOfOutputChannels = this.outputs[0].getNumberOfChannels(); 16 | var inputBuffer = new AudioBuffer(this.context, { 17 | numberOfChannels: numberOfInputChannels, length: this._bufferSize, sampleRate: this.sampleRate 18 | }); 19 | var outputBuffer = new AudioBuffer(this.context, { 20 | numberOfChannels: numberOfOutputChannels, length: this._bufferSize, sampleRate: this.sampleRate 21 | }); 22 | 23 | eventItem.inputBuffer._impl = inputBuffer; 24 | eventItem.outputBuffer._impl = outputBuffer; 25 | 26 | this._inputChannelData = inputBuffer.audioData.channelData; 27 | this._outputChannelData = outputBuffer.audioData.channelData; 28 | 29 | this._eventItem = eventItem; 30 | }, 31 | dspProcess: function dspProcess() { 32 | var _this = this; 33 | 34 | var blockSize = this.blockSize; 35 | var quantumStartFrame = this.context.currentSampleFrame; 36 | var quantumEndFrame = quantumStartFrame + blockSize; 37 | var inputs = this.inputs[0].bus.getChannelData(); 38 | var outputs = this.outputs[0].bus.getMutableData(); 39 | var inputChannelData = this._inputChannelData; 40 | var outputChannelData = this._outputChannelData; 41 | var numberOfInputChannels = inputs.length; 42 | var numberOfOutputChannels = outputs.length; 43 | var copyFrom = this._writeIndex; 44 | var copyTo = copyFrom + blockSize; 45 | 46 | for (var ch = 0; ch < numberOfInputChannels; ch++) { 47 | inputChannelData[ch].set(inputs[ch], copyFrom); 48 | } 49 | for (var _ch = 0; _ch < numberOfOutputChannels; _ch++) { 50 | outputs[_ch].set(outputChannelData[_ch].subarray(copyFrom, copyTo)); 51 | } 52 | 53 | this._writeIndex += blockSize; 54 | 55 | if (this._writeIndex === this._bufferSize) { 56 | (function () { 57 | var playbackTime = quantumEndFrame / _this.sampleRate; 58 | 59 | _this.context.addPostProcess(function () { 60 | for (var _ch2 = 0; _ch2 < numberOfOutputChannels; _ch2++) { 61 | util.fill(outputChannelData[_ch2], 0); 62 | } 63 | _this._eventItem.playbackTime = playbackTime; 64 | _this.dispatchEvent(_this._eventItem); 65 | }); 66 | _this._writeIndex = 0; 67 | })(); 68 | } 69 | } 70 | }; 71 | 72 | module.exports = ScriptProcessorNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/SpatialPannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var SpatialPannerNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var outputBus = this.outputs[0].bus; 6 | 7 | outputBus.zeros(); 8 | outputBus.sumFrom(this.inputs[0].bus); 9 | } 10 | }; 11 | 12 | module.exports = SpatialPannerNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/StereoPannerNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var StereoPannerNodeDSP = { 4 | dspProcess: function dspProcess() { 5 | var inputBus = this.inputs[0].bus; 6 | var outputBus = this.outputs[0].bus; 7 | 8 | if (inputBus.isSilent) { 9 | outputBus.zeros(); 10 | return; 11 | } 12 | 13 | var panParam = this._pan; 14 | 15 | if (panParam.hasSampleAccurateValues()) { 16 | this.dspSampleAccurateValues(inputBus, outputBus, panParam.getSampleAccurateValues(), this.blockSize); 17 | } else { 18 | this.dspStaticValue(inputBus, outputBus, panParam.getValue(), this.blockSize); 19 | } 20 | }, 21 | dspSampleAccurateValues: function dspSampleAccurateValues(inputBus, outputBus, panValues, blockSize) { 22 | var outputs = outputBus.getMutableData(); 23 | var numberOfChannels = inputBus.getNumberOfChannels(); 24 | 25 | if (numberOfChannels === 1) { 26 | var input = inputBus.getChannelData()[0]; 27 | 28 | for (var i = 0; i < blockSize; i++) { 29 | var panValue = Math.max(-1, Math.min(panValues[i], +1)); 30 | var panRadian = (panValue * 0.5 + 0.5) * 0.5 * Math.PI; 31 | var gainL = Math.cos(panRadian); 32 | var gainR = Math.sin(panRadian); 33 | 34 | outputs[0][i] = input[i] * gainL; 35 | outputs[1][i] = input[i] * gainR; 36 | } 37 | } else { 38 | var inputs = inputBus.getChannelData()[0]; 39 | 40 | for (var _i = 0; _i < blockSize; _i++) { 41 | var _panValue = Math.max(-1, Math.min(panValues[_i], +1)); 42 | var _panRadian = (_panValue <= 0 ? _panValue + 1 : _panValue) * 0.5 * Math.PI; 43 | var _gainL = Math.cos(_panRadian); 44 | var _gainR = Math.sin(_panRadian); 45 | 46 | if (_panValue <= 0) { 47 | outputs[0][_i] = inputs[0][_i] + inputs[1][_i] * _gainL; 48 | outputs[1][_i] = inputs[1][_i] * _gainR; 49 | } else { 50 | outputs[0][_i] = inputs[0][_i] * _gainL; 51 | outputs[1][_i] = inputs[1][_i] + inputs[0][_i] * _gainR; 52 | } 53 | } 54 | } 55 | }, 56 | dspStaticValue: function dspStaticValue(inputBus, outputBus, panValue, blockSize) { 57 | var outputs = outputBus.getMutableData(); 58 | var numberOfChannels = inputBus.getNumberOfChannels(); 59 | 60 | panValue = Math.max(-1, Math.min(panValue, +1)); 61 | 62 | if (numberOfChannels === 1) { 63 | var input = inputBus.getChannelData()[0]; 64 | var panRadian = (panValue * 0.5 + 0.5) * 0.5 * Math.PI; 65 | var gainL = Math.cos(panRadian); 66 | var gainR = Math.sin(panRadian); 67 | 68 | for (var i = 0; i < blockSize; i++) { 69 | outputs[0][i] = input[i] * gainL; 70 | outputs[1][i] = input[i] * gainR; 71 | } 72 | } else { 73 | var inputs = inputBus.getChannelData()[0]; 74 | var _panRadian2 = (panValue <= 0 ? panValue + 1 : panValue) * 0.5 * Math.PI; 75 | var _gainL2 = Math.cos(_panRadian2); 76 | var _gainR2 = Math.sin(_panRadian2); 77 | 78 | if (panValue <= 0) { 79 | for (var _i2 = 0; _i2 < blockSize; _i2++) { 80 | outputs[0][_i2] = inputs[0][_i2] + inputs[1][_i2] * _gainL2; 81 | outputs[1][_i2] = inputs[1][_i2] * _gainR2; 82 | } 83 | } else { 84 | for (var _i3 = 0; _i3 < blockSize; _i3++) { 85 | outputs[0][_i3] = inputs[0][_i3] * _gainL2; 86 | outputs[1][_i3] = inputs[1][_i3] + inputs[0][_i3] * _gainR2; 87 | } 88 | } 89 | } 90 | } 91 | }; 92 | 93 | module.exports = StereoPannerNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/dsp/WaveShaperNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var WaveShaperNodeDSP = { 8 | dspInit: function dspInit() { 9 | this._kernels = []; 10 | }, 11 | dspUpdateKernel: function dspUpdateKernel(curve, numberOfChannels) { 12 | if (curve === null) { 13 | numberOfChannels = 0; 14 | } 15 | if (numberOfChannels < this._kernels.length) { 16 | this._kernels.splice(numberOfChannels); 17 | } else if (this._kernels.length < numberOfChannels) { 18 | while (numberOfChannels !== this._kernels.length) { 19 | this._kernels.push(new WaveShaperKernel(this, this._kernels.length)); 20 | } 21 | } 22 | 23 | switch (numberOfChannels) { 24 | case 0: 25 | this.dspProcess = this.dspProcess0; 26 | break; 27 | case 1: 28 | this.dspProcess = this.dspProcess1; 29 | break; 30 | case 2: 31 | this.dspProcess = this.dspProcess2; 32 | break; 33 | default: 34 | this.dspProcess = this.dspProcessN; 35 | break; 36 | } 37 | }, 38 | dspProcess0: function dspProcess0() { 39 | this.outputs[0].bus.copyFrom(this.inputs[0].bus); 40 | }, 41 | dspProcess1: function dspProcess1() { 42 | var inputBus = this.inputs[0].bus; 43 | var outputBus = this.outputs[0].bus; 44 | var inputs = inputBus.getChannelData(); 45 | var outputs = outputBus.getMutableData(); 46 | var kernels = this._kernels; 47 | 48 | kernels[0].process(inputs[0], outputs[0], this._curve, this.blockSize); 49 | }, 50 | dspProcess2: function dspProcess2() { 51 | var inputBus = this.inputs[0].bus; 52 | var outputBus = this.outputs[0].bus; 53 | var inputs = inputBus.getChannelData(); 54 | var outputs = outputBus.getMutableData(); 55 | var blockSize = this.blockSize; 56 | var curve = this._curve; 57 | var kernels = this._kernels; 58 | 59 | kernels[0].process(inputs[0], outputs[0], curve, blockSize); 60 | kernels[1].process(inputs[1], outputs[1], curve, blockSize); 61 | }, 62 | dspProcessN: function dspProcessN() { 63 | var inputBus = this.inputs[0].bus; 64 | var outputBus = this.outputs[0].bus; 65 | var inputs = inputBus.getChannelData(); 66 | var outputs = outputBus.getMutableData(); 67 | var blockSize = this.blockSize; 68 | var curve = this._curve; 69 | var kernels = this._kernels; 70 | 71 | for (var i = 0, imax = kernels.length; i < imax; i++) { 72 | kernels[i].process(inputs[i], outputs[i], curve, blockSize); 73 | } 74 | } 75 | }; 76 | 77 | var WaveShaperKernel = function () { 78 | function WaveShaperKernel() { 79 | _classCallCheck(this, WaveShaperKernel); 80 | } 81 | 82 | _createClass(WaveShaperKernel, [{ 83 | key: "process", 84 | value: function process(input, output, curve, inNumSamples) { 85 | for (var i = 0; i < inNumSamples; i++) { 86 | var x = (Math.max(-1, Math.min(input[i], 1)) + 1) * 0.5; 87 | var ix = x * (curve.length - 1); 88 | var i0 = ix | 0; 89 | var i1 = i0 + 1; 90 | 91 | if (curve.length <= i1) { 92 | output[i] = curve[curve.length - 1]; 93 | } else { 94 | output[i] = curve[i0] + ix % 1 * (curve[i1] - curve[i0]); 95 | } 96 | } 97 | } 98 | }]); 99 | 100 | return WaveShaperKernel; 101 | }(); 102 | 103 | module.exports = WaveShaperNodeDSP; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/impl/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | "use strict", module.exports = { 4 | AnalyserNode: require("./AnalyserNode"), 5 | AudioBuffer: require("./AudioBuffer"), 6 | AudioBufferSourceNode: require("./AudioBufferSourceNode"), 7 | AudioContext: require("./AudioContext"), 8 | AudioDestinationNode: require("./AudioDestinationNode"), 9 | AudioListener: require("./AudioListener"), 10 | AudioNode: require("./AudioNode"), 11 | AudioParam: require("./AudioParam"), 12 | AudioWorkerNode: require("./AudioWorkerNode"), 13 | BiquadFilterNode: require("./BiquadFilterNode"), 14 | ChannelMergerNode: require("./ChannelMergerNode"), 15 | ChannelSplitterNode: require("./ChannelSplitterNode"), 16 | ConvolverNode: require("./ConvolverNode"), 17 | DelayNode: require("./DelayNode"), 18 | DynamicsCompressorNode: require("./DynamicsCompressorNode"), 19 | GainNode: require("./GainNode"), 20 | IIRFilterNode: require("./IIRFilterNode"), 21 | OscillatorNode: require("./OscillatorNode"), 22 | PannerNode: require("./PannerNode"), 23 | PeriodicWave: require("./PeriodicWave"), 24 | ScriptProcessorNode: require("./ScriptProcessorNode"), 25 | SpatialPannerNode: require("./SpatialPannerNode"), 26 | StereoPannerNode: require("./StereoPannerNode"), 27 | WaveShaperNode: require("./WaveShaperNode") 28 | }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var OfflineAudioContext = require("./context/OfflineAudioContext"); 4 | var StreamAudioContext = require("./context/StreamAudioContext"); 5 | var RenderingAudioContext = require("./context/RenderingAudioContext"); 6 | var WebAudioContext = require("./context/WebAudioContext"); 7 | var api = require("./api"); 8 | var impl = require("./impl"); 9 | var decoder = require("./decoder"); 10 | var encoder = require("./encoder"); 11 | 12 | module.exports = { 13 | OfflineAudioContext: OfflineAudioContext, 14 | StreamAudioContext: StreamAudioContext, 15 | RenderingAudioContext: RenderingAudioContext, 16 | WebAudioContext: WebAudioContext, 17 | api: api, impl: impl, decoder: decoder, encoder: encoder 18 | }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/PCMArrayBufferWriter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var PCMArrayBufferWriter = function () { 8 | function PCMArrayBufferWriter(buffer) { 9 | _classCallCheck(this, PCMArrayBufferWriter); 10 | 11 | this._view = new DataView(buffer); 12 | this._pos = 0; 13 | } 14 | 15 | _createClass(PCMArrayBufferWriter, [{ 16 | key: "pcm8", 17 | value: function pcm8(value) { 18 | value = Math.max(-1, Math.min(value, +1)); 19 | value = (value * 0.5 + 0.5) * 128; 20 | this._view.setUint8(this._pos, value | 0); 21 | this._pos += 1; 22 | } 23 | }, { 24 | key: "pcm16", 25 | value: function pcm16(value) { 26 | value = Math.max(-1, Math.min(value, +1)); 27 | value = value < 0 ? value * 32768 : value * 32767; 28 | this._view.setInt16(this._pos, value | 0, true); 29 | this._pos += 2; 30 | } 31 | }, { 32 | key: "pcm32", 33 | value: function pcm32(value) { 34 | value = Math.max(-1, Math.min(value, +1)); 35 | value = value < 0 ? value * 2147483648 : value * 2147483647; 36 | this._view.setInt32(this._pos, value | 0, true); 37 | this._pos += 4; 38 | } 39 | }, { 40 | key: "pcm32f", 41 | value: function pcm32f(value) { 42 | this._view.setFloat32(this._pos, value, true); 43 | this._pos += 4; 44 | } 45 | }]); 46 | 47 | return PCMArrayBufferWriter; 48 | }(); 49 | 50 | module.exports = PCMArrayBufferWriter; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/PCMBufferWriter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6 | 7 | var PCMBufferWriter = function () { 8 | function PCMBufferWriter(buffer) { 9 | _classCallCheck(this, PCMBufferWriter); 10 | 11 | this._buffer = buffer; 12 | this._pos = 0; 13 | } 14 | 15 | _createClass(PCMBufferWriter, [{ 16 | key: "pcm8", 17 | value: function pcm8(value) { 18 | value = Math.max(-1, Math.min(value, +1)); 19 | value = (value * 0.5 + 0.5) * 128; 20 | this._buffer.writeUInt8(value | 0, this._pos); 21 | this._pos += 1; 22 | } 23 | }, { 24 | key: "pcm16", 25 | value: function pcm16(value) { 26 | value = Math.max(-1, Math.min(value, +1)); 27 | value = value < 0 ? value * 32768 : value * 32767; 28 | this._buffer.writeInt16LE(value | 0, this._pos); 29 | this._pos += 2; 30 | } 31 | }, { 32 | key: "pcm32", 33 | value: function pcm32(value) { 34 | value = Math.max(-1, Math.min(value, +1)); 35 | value = value < 0 ? value * 2147483648 : value * 2147483647; 36 | this._buffer.writeInt32LE(value | 0, this._pos); 37 | this._pos += 4; 38 | } 39 | }, { 40 | key: "pcm32f", 41 | value: function pcm32f(value) { 42 | this._buffer.writeFloatLE(value, this._pos); 43 | this._pos += 4; 44 | } 45 | }]); 46 | 47 | return PCMBufferWriter; 48 | }(); 49 | 50 | module.exports = PCMBufferWriter; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/PCMEncoder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var Buffer = global.Buffer; 4 | var PCMArrayBufferWriter = require("./PCMArrayBufferWriter"); 5 | var PCMBufferWriter = require("./PCMBufferWriter"); 6 | var PCMWriter = getPCMWriter(); 7 | var alloc = getAllocFunction(); 8 | 9 | function create(length, format) { 10 | var bitDepth = resolveBitDepth(format.bitDepth, format.float); 11 | var methodName = resolveWriteMethodName(bitDepth, format.float); 12 | var bytes = format.bitDepth >> 3; 13 | var numberOfChannels = format.channels; 14 | var bufferLength = numberOfChannels * length * bytes; 15 | 16 | if (numberOfChannels === 1) { 17 | return { 18 | encode: function encode(channelData) { 19 | var buffer = alloc(bufferLength); 20 | var writer = new PCMWriter(buffer); 21 | var output = channelData[0]; 22 | 23 | for (var i = 0, imax = length; i < imax; i++) { 24 | writer[methodName](output[i]); 25 | } 26 | 27 | return buffer; 28 | } 29 | }; 30 | } 31 | 32 | if (numberOfChannels === 2) { 33 | return { 34 | encode: function encode(channelData) { 35 | var buffer = alloc(bufferLength); 36 | var writer = new PCMWriter(buffer); 37 | var outputL = channelData[0]; 38 | var outputR = channelData[1]; 39 | 40 | for (var i = 0, imax = length; i < imax; i++) { 41 | writer[methodName](outputL[i]); 42 | writer[methodName](outputR[i]); 43 | } 44 | 45 | return buffer; 46 | } 47 | }; 48 | } 49 | 50 | return { 51 | encode: function encode(channelData) { 52 | var buffer = alloc(bufferLength); 53 | var writer = new PCMWriter(buffer); 54 | 55 | for (var i = 0, imax = length; i < imax; i++) { 56 | for (var ch = 0; ch < numberOfChannels; ch++) { 57 | writer[methodName](channelData[ch][i]); 58 | } 59 | } 60 | 61 | return buffer; 62 | } 63 | }; 64 | } 65 | 66 | /* istanbul ignore next */ 67 | function resolveBitDepth(bitDepth, float) { 68 | return float ? 32 : bitDepth; 69 | } 70 | 71 | /* istanbul ignore next */ 72 | function resolveWriteMethodName(bitDepth, float) { 73 | if (float) { 74 | return "pcm32f"; 75 | } 76 | return "pcm" + bitDepth; 77 | } 78 | 79 | /* istanbul ignore next */ 80 | function getPCMWriter() { 81 | return Buffer ? PCMBufferWriter : PCMArrayBufferWriter; 82 | } 83 | 84 | /* istanbul ignore next */ 85 | function getAllocFunction() { 86 | return Buffer ? Buffer.alloc ? Buffer.alloc : newBuffer : newArrayBuffer; 87 | } 88 | 89 | /* istanbul ignore next */ 90 | function newBuffer(size) { 91 | return new Buffer(size); 92 | } 93 | 94 | /* istanbul ignore next */ 95 | function newArrayBuffer(size) { 96 | return new Uint8Array(size).buffer; 97 | } 98 | 99 | module.exports = { create: create }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/audioDataUtil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {*} data 5 | * @return {boolean} 6 | */ 7 | 8 | function isAudioData(data) { 9 | if (!data) { 10 | return false; 11 | } 12 | if (!Number.isFinite(data.sampleRate)) { 13 | return false; 14 | } 15 | if (!Array.isArray(data.channelData)) { 16 | return false; 17 | } 18 | if (!data.channelData.every(function (data) { 19 | return data instanceof Float32Array; 20 | })) { 21 | return false; 22 | } 23 | return true; 24 | } 25 | 26 | /** 27 | * @param {object} data 28 | * @return {AudioData} 29 | */ 30 | function toAudioData(data) { 31 | if (isAudioData(data)) { 32 | var numberOfChannels = data.channelData.length; 33 | var length = numberOfChannels ? data.channelData[0].length : 0; 34 | var sampleRate = data.sampleRate; 35 | var channelData = data.channelData; 36 | 37 | return { numberOfChannels: numberOfChannels, length: length, sampleRate: sampleRate, channelData: channelData }; 38 | } 39 | if (isAudioBuffer(data)) { 40 | var _numberOfChannels = data.numberOfChannels; 41 | var _sampleRate = data.sampleRate; 42 | var _channelData = Array.from({ length: _numberOfChannels }, function (_, ch) { 43 | return data.getChannelData(ch); 44 | }); 45 | var _length = _numberOfChannels ? _channelData[0].length : 0; 46 | 47 | return { numberOfChannels: _numberOfChannels, length: _length, sampleRate: _sampleRate, channelData: _channelData }; 48 | } 49 | return { numberOfChannels: 0, length: 0, sampleRate: 0, channelData: [] }; 50 | } 51 | 52 | /** 53 | * @param {*} data 54 | * @return {boolean} 55 | */ 56 | function isAudioBuffer(data) { 57 | if (!data) { 58 | return false; 59 | } 60 | if (typeof data.numberOfChannels !== "number") { 61 | return false; 62 | } 63 | if (typeof data.sampleRate !== "number") { 64 | return false; 65 | } 66 | if (typeof data.getChannelData !== "function") { 67 | return false; 68 | } 69 | return true; 70 | } 71 | 72 | /** 73 | * @param {object} data 74 | * @param {class} AudioBuffer 75 | * @return {AudioBuffer} 76 | */ 77 | function toAudioBuffer(data, AudioBuffer) { 78 | data = toAudioData(data); 79 | 80 | var audioBuffer = new AudioBuffer({ sampleRate: data.sampleRate }); 81 | var audioData = (audioBuffer._impl || audioBuffer).audioData; 82 | 83 | audioData.numberOfChannels = data.numberOfChannels; 84 | audioData.length = data.length; 85 | audioData.sampleRate = data.sampleRate; 86 | audioData.channelData = data.channelData; 87 | 88 | return audioBuffer; 89 | } 90 | 91 | module.exports = { isAudioData: isAudioData, toAudioData: toAudioData, isAudioBuffer: isAudioBuffer, toAudioBuffer: toAudioBuffer }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/audioParamUtil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var SET_VALUE_AT_TIME = 1; 4 | var LINEAR_RAMP_TO_VALUE_AT_TIME = 2; 5 | var EXPONENTIAL_RAMP_TO_VALUE_AT_TIME = 3; 6 | var SET_TARGET_AT_TIME = 4; 7 | var SET_VALUE_CURVE_AT_TIME = 5; 8 | 9 | /** 10 | * @param {object[]} timeline 11 | * @param {number} time 12 | * @param {number} defaultValue 13 | */ 14 | function computeValueAtTime(timeline, time, defaultValue) { 15 | var value = defaultValue; 16 | 17 | for (var i = 0, imax = timeline.length; i < imax; i++) { 18 | var e0 = timeline[i]; 19 | var e1 = timeline[i + 1]; 20 | var t0 = Math.min(time, e1 ? e1.time : time); 21 | 22 | if (time < e0.time) { 23 | break; 24 | } 25 | 26 | switch (e0.type) { 27 | case SET_VALUE_AT_TIME: 28 | case LINEAR_RAMP_TO_VALUE_AT_TIME: 29 | case EXPONENTIAL_RAMP_TO_VALUE_AT_TIME: 30 | value = e0.args[0]; 31 | break; 32 | case SET_TARGET_AT_TIME: 33 | value = getTargetValueAtTime(t0, value, e0.args[0], e0.args[1], e0.args[2]); 34 | break; 35 | case SET_VALUE_CURVE_AT_TIME: 36 | value = getValueCurveAtTime(t0, e0.args[0], e0.args[1], e0.args[2]); 37 | break; 38 | } 39 | if (e1) { 40 | switch (e1.type) { 41 | case LINEAR_RAMP_TO_VALUE_AT_TIME: 42 | value = getLinearRampToValueAtTime(t0, value, e1.args[0], e0.time, e1.args[1]); 43 | break; 44 | case EXPONENTIAL_RAMP_TO_VALUE_AT_TIME: 45 | value = getExponentialRampToValueAtTime(t0, value, e1.args[0], e0.time, e1.args[1]); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | return value; 52 | } 53 | 54 | function getLinearRampToValueAtTime(t, v0, v1, t0, t1) { 55 | var a; 56 | 57 | if (t <= t0) { 58 | return v0; 59 | } 60 | if (t1 <= t) { 61 | return v1; 62 | } 63 | 64 | a = (t - t0) / (t1 - t0); 65 | 66 | return v0 + a * (v1 - v0); 67 | } 68 | 69 | function getExponentialRampToValueAtTime(t, v0, v1, t0, t1) { 70 | var a; 71 | 72 | if (t <= t0) { 73 | return v0; 74 | } 75 | if (t1 <= t) { 76 | return v1; 77 | } 78 | 79 | a = (t - t0) / (t1 - t0); 80 | 81 | return v0 * Math.pow(v1 / v0, a); 82 | } 83 | 84 | function getTargetValueAtTime(t, v0, v1, t0, timeConstant) { 85 | if (t <= t0) { 86 | return v0; 87 | } 88 | return v1 + (v0 - v1) * Math.exp((t0 - t) / timeConstant); 89 | } 90 | 91 | function getValueCurveAtTime(t, curve, t0, duration) { 92 | var x, ix, i0, i1; 93 | var y0, y1, a; 94 | 95 | x = (t - t0) / duration; 96 | ix = x * (curve.length - 1); 97 | i0 = ix | 0; 98 | i1 = i0 + 1; 99 | 100 | if (curve.length <= i1) { 101 | return curve[curve.length - 1]; 102 | } 103 | 104 | y0 = curve[i0]; 105 | y1 = curve[i1]; 106 | a = ix % 1; 107 | 108 | return y0 + a * (y1 - y0); 109 | } 110 | 111 | module.exports = { computeValueAtTime: computeValueAtTime, getLinearRampToValueAtTime: getLinearRampToValueAtTime, getExponentialRampToValueAtTime: getExponentialRampToValueAtTime, getTargetValueAtTime: getTargetValueAtTime, getValueCurveAtTime: getValueCurveAtTime }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/clip.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {number} value 5 | * @param {number} minValue 6 | * @param {number} maxValue 7 | */ 8 | 9 | function clip(value, minValue, maxValue) { 10 | return Math.max(minValue, Math.min(value, maxValue)); 11 | } 12 | 13 | module.exports = clip; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/decoderUtil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var audioDataUtil = require("./audioDataUtil"); 4 | var resampler = require("./resampler"); 5 | 6 | /** 7 | * @param {function} decodeFn 8 | * @param {ArrayBuffer} audioData 9 | * @param {object} opts 10 | * @return {Promise} 11 | */ 12 | function decode(decodeFn, audioData, opts) { 13 | opts = opts /* istanbul ignore next */ || {}; 14 | 15 | return new Promise(function (resolve, reject) { 16 | return decodeFn(audioData, opts).then(function (result) { 17 | if (audioDataUtil.isAudioData(result)) { 18 | if (typeof opts.sampleRate === "number") { 19 | result = resampler.resample(result, opts.sampleRate); 20 | } 21 | return resolve(result); 22 | } 23 | return reject(new TypeError("Failed to decode audio data")); 24 | }, reject); 25 | }); 26 | } 27 | 28 | module.exports = { decode: decode }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/defaults.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {*} value 5 | * @param {*) defaultValue 6 | */ 7 | 8 | function defaults(value, defaultValue) { 9 | return typeof value !== "undefined" ? value : defaultValue; 10 | } 11 | 12 | module.exports = defaults; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/defineProp.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {object} target 5 | * @param {string} name 6 | * @param {*} value 7 | */ 8 | 9 | function defineProp(target, name, value) { 10 | Object.defineProperty(target, name, { value: value, enumerable: false, writable: true, configurable: true }); 11 | } 12 | 13 | module.exports = defineProp; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/encoderUtil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var audioDataUtil = require("./audioDataUtil"); 4 | 5 | /** 6 | * @param {function} encodeFn 7 | * @param {AudioData} audioData 8 | * @param {object} opts 9 | */ 10 | function encode(encodeFn, audioData, opts) { 11 | opts = opts /* istanbul ignore next */ || {}; 12 | if (!audioDataUtil.isAudioData(audioData)) { 13 | audioData = audioDataUtil.toAudioData(audioData); 14 | } 15 | return encodeFn(audioData, opts); 16 | } 17 | 18 | module.exports = { encode: encode }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/fill.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {number[]} list 5 | * @param {number} value 6 | * @return {number[]} 7 | */ 8 | 9 | function fill(list, value) { 10 | if (list.fill) { 11 | return list.fill(value); 12 | } 13 | 14 | for (var i = 0, imax = list.length; i < imax; i++) { 15 | list[i] = value; 16 | } 17 | 18 | return list; 19 | } 20 | 21 | module.exports = fill; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/fillRange.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {number[]} list 5 | * @param {number} value 6 | * @param {number} start 7 | * @param {number} end 8 | * @return {number[]} 9 | */ 10 | 11 | function fillRange(list, value, start, end) { 12 | if (list.fill) { 13 | return list.fill(value, start, end); 14 | } 15 | 16 | for (var i = start; i < end; i++) { 17 | list[i] = value; 18 | } 19 | 20 | return list; 21 | } 22 | 23 | module.exports = fillRange; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports.clip = require("./clip"); 4 | module.exports.defaults = require("./defaults"); 5 | module.exports.defineProp = require("./defineProp"); 6 | module.exports.fill = require("./fill"); 7 | module.exports.fillRange = require("./fillRange"); 8 | module.exports.toArrayIfNeeded = require("./toArrayIfNeeded"); 9 | module.exports.toAudioTime = require("./toAudioTime"); 10 | module.exports.toImpl = require("./toImpl"); 11 | module.exports.toNumber = require("./toNumber"); 12 | module.exports.toPowerOfTwo = require("./toPowerOfTwo"); 13 | module.exports.toValidBitDepth = require("./toValidBitDepth"); 14 | module.exports.toValidBlockSize = require("./toValidBlockSize"); 15 | module.exports.toValidNumberOfChannels = require("./toValidNumberOfChannels"); 16 | module.exports.toValidSampleRate = require("./toValidSampleRate"); -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/resampler.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {AudioData} audioData 5 | * @param {number} sampleRate 6 | */ 7 | 8 | function resample(audioData, sampleRate) { 9 | if (audioData.sampleRate === sampleRate) { 10 | return audioData; 11 | } 12 | 13 | var rate = audioData.sampleRate / sampleRate; 14 | var numberOfChannels = audioData.channelData.length; 15 | var length = Math.round(audioData.channelData[0].length / rate); 16 | var channelData = Array.from({ length: numberOfChannels }, function () { 17 | return new Float32Array(length); 18 | }); 19 | 20 | for (var i = 0; i < length; i++) { 21 | var ix = i * rate; 22 | var i0 = ix | 0; 23 | var i1 = i0 + 1; 24 | var ia = ix % 1; 25 | 26 | for (var ch = 0; ch < numberOfChannels; ch++) { 27 | var v0 = audioData.channelData[ch][i0]; 28 | var v1 = audioData.channelData[ch][i1]; 29 | 30 | channelData[ch][i] = v0 + ia * (v1 - v0); 31 | } 32 | } 33 | 34 | return { numberOfChannels: numberOfChannels, length: length, sampleRate: sampleRate, channelData: channelData }; 35 | } 36 | 37 | module.exports = { resample: resample }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/setImmediate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = global.setImmediate /* istanbul ignore next */ || function (fn) { 4 | return setTimeout(fn, 0); 5 | }; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toArrayIfNeeded.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {*} value 5 | * @return {Array} 6 | */ 7 | 8 | function toArrayIfNeeded(value) { 9 | return Array.isArray(value) ? value : [value]; 10 | } 11 | 12 | module.exports = toArrayIfNeeded; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toAudioTime.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {number|string} str 5 | * @return {number} 6 | */ 7 | 8 | function toAudioTime(str) { 9 | if (Number.isFinite(+str)) { 10 | return Math.max(0, +str); 11 | } 12 | 13 | var matched = ("" + str).match(/^(?:(\d\d+):)?(\d\d?):(\d\d?(?:\.\d+)?)$/); 14 | 15 | if (matched) { 16 | var hours = +matched[1] | 0; 17 | var minutes = +matched[2]; 18 | var seconds = +matched[3]; 19 | 20 | return hours * 3600 + minutes * 60 + seconds; 21 | } 22 | 23 | return 0; 24 | } 25 | 26 | module.exports = toAudioTime; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toImpl.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {object} value 5 | * @return {object} 6 | */ 7 | 8 | function toImpl(value) { 9 | return value._impl || value; 10 | } 11 | 12 | module.exports = toImpl; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toNumber.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {*} value 5 | * @return {number} 6 | */ 7 | 8 | function toNumber(value) { 9 | return +value || 0; 10 | } 11 | 12 | module.exports = toNumber; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toPowerOfTwo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * @param {number} value 5 | * @param {function} round 6 | * @return {number} 7 | */ 8 | 9 | function toPowerOfTwo(value, round) { 10 | round = round || Math.round; 11 | return 1 << round(Math.log(value) / Math.log(2)); 12 | } 13 | 14 | module.exports = toPowerOfTwo; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toValidBitDepth.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | "use stirct"; 3 | 4 | /** 5 | * @param {number} value 6 | * @return {number} 7 | */ 8 | 9 | function toValidBitDepth(value) { 10 | value = value | 0; 11 | if (value === 8 || value === 16 || value === 32) { 12 | return value; 13 | } 14 | return 16; 15 | } 16 | 17 | module.exports = toValidBitDepth; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toValidBlockSize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var clip = require("./clip"); 4 | var toPowerOfTwo = require("./toPowerOfTwo"); 5 | var MIN_BLOCK_SIZE = 8; 6 | var MAX_BLOCK_SIZE = 1024; 7 | 8 | /** 9 | * @param {number} value 10 | * @return {number} 11 | */ 12 | function toValidBlockSize(value) { 13 | return clip(toPowerOfTwo(value), MIN_BLOCK_SIZE, MAX_BLOCK_SIZE); 14 | } 15 | 16 | module.exports = toValidBlockSize; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toValidNumberOfChannels.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var toNumber = require("./toNumber"); 4 | var clip = require("./clip"); 5 | var MAX_NUMBER_OF_CHANNELS = 32; 6 | 7 | /** 8 | * @param {number} value 9 | * @return {number} 10 | */ 11 | function toValidNumberOfChannels(value) { 12 | return clip(toNumber(value), 1, MAX_NUMBER_OF_CHANNELS) | 0; 13 | } 14 | 15 | module.exports = toValidNumberOfChannels; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/lib/util/toValidSampleRate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var toNumber = require("./toNumber"); 4 | var clip = require("./clip"); 5 | var MIN_SAMPLERATE = 3000; 6 | var MAX_SAMPLERATE = 192000; 7 | 8 | /** 9 | * @param {number} value 10 | * @return {number} 11 | */ 12 | function toValidSampleRate(value) { 13 | return clip(toNumber(value), MIN_SAMPLERATE, MAX_SAMPLERATE) | 0; 14 | } 15 | 16 | module.exports = toValidSampleRate; -------------------------------------------------------------------------------- /node_modules/web-audio-engine/node_modules/wav-decoder/README.md: -------------------------------------------------------------------------------- 1 | # wav-decoder 2 | [![Build Status](http://img.shields.io/travis/mohayonao/wav-decoder.svg?style=flat-square)](https://travis-ci.org/mohayonao/wav-decoder) 3 | [![NPM Version](http://img.shields.io/npm/v/wav-decoder.svg?style=flat-square)](https://www.npmjs.org/package/wav-decoder) 4 | [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://mohayonao.mit-license.org/) 5 | 6 | > promise-based wav decoder 7 | 8 | ## Installation 9 | 10 | ``` 11 | $ npm install wav-decoder 12 | ``` 13 | 14 | ## API 15 | 16 | - `decode(src: ArrayBuffer): Promise` 17 | - if provide an instance of `Buffer`, it is converted to `ArrayBuffer` like `Uint8Array.from(src).buffer` implicitly. 18 | 19 | ##### Returns 20 | 21 | ```js 22 | interface AudioData { 23 | sampleRate: number; 24 | channelData: Float32Array[]; 25 | } 26 | ``` 27 | 28 | ## Usage 29 | 30 | ```js 31 | const fs = require("fs"); 32 | const WavDecoder = require("wav-decoder"); 33 | 34 | const readFile = (filepath) => { 35 | return new Promise((resolve, reject) => { 36 | fs.readFile(filepath, (err, buffer) => { 37 | if (err) { 38 | return reject(err); 39 | } 40 | return resolve(buffer); 41 | }); 42 | }); 43 | }; 44 | 45 | readFile("foobar.wav").then((buffer) => { 46 | return WavDecoder.decode(buffer); 47 | }).then(function(audioData) { 48 | console.log(audioData.sampleRate); 49 | console.log(audioData.channelData[0]); // Float32Array 50 | console.log(audioData.channelData[1]); // Float32Array 51 | }); 52 | ``` 53 | 54 | ## License 55 | MIT 56 | -------------------------------------------------------------------------------- /node_modules/web-audio-engine/node_modules/wav-decoder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wav-decoder", 3 | "description": "promise-based wav decoder", 4 | "version": "1.1.0", 5 | "author": { 6 | "name": "Nao Yonamine", 7 | "email": "mohayonao@gmail.com" 8 | }, 9 | "bugs": { 10 | "url": "https://github.com/mohayonao/wav-decoder/issues" 11 | }, 12 | "dependencies": {}, 13 | "devDependencies": { 14 | "ava": "^0.13.0", 15 | "eslint": "^2.7.0" 16 | }, 17 | "files": [ 18 | "package.json", 19 | "README.md", 20 | "index.js" 21 | ], 22 | "homepage": "https://github.com/mohayonao/wav-decoder/", 23 | "keywords": [ 24 | "decode", 25 | "universal", 26 | "wav" 27 | ], 28 | "license": "MIT", 29 | "main": "index.js", 30 | "repository": { 31 | "type": "git", 32 | "url": "git+https://github.com/mohayonao/wav-decoder.git" 33 | }, 34 | "scripts": { 35 | "lint": "eslint index.js", 36 | "postversion": "git push && git push --tags", 37 | "prepublish": "npm run lint && npm run test", 38 | "preversion": "npm run lint && npm run test", 39 | "test": "ava test", 40 | "travis": "npm run lint && npm run test" 41 | }, 42 | "gitHead": "2b31fcd57ab77d0ad3e103304a32b46f28e1d2a1", 43 | "_id": "wav-decoder@1.1.0", 44 | "_shasum": "de00a4414456093f7928b7a2f5ecf0d86ffd8676", 45 | "_from": "wav-decoder@>=1.1.0 <2.0.0", 46 | "_npmVersion": "3.8.3", 47 | "_nodeVersion": "5.10.0", 48 | "_npmUser": { 49 | "name": "mohayonao", 50 | "email": "mohayonao@gmail.com" 51 | }, 52 | "dist": { 53 | "shasum": "de00a4414456093f7928b7a2f5ecf0d86ffd8676", 54 | "tarball": "https://registry.npmjs.org/wav-decoder/-/wav-decoder-1.1.0.tgz" 55 | }, 56 | "maintainers": [ 57 | { 58 | "name": "mohayonao", 59 | "email": "mohayonao@gmail.com" 60 | } 61 | ], 62 | "_npmOperationalInternal": { 63 | "host": "packages-12-west.internal.npmjs.com", 64 | "tmp": "tmp/wav-decoder-1.1.0.tgz_1459893387994_0.47906184126622975" 65 | }, 66 | "directories": {}, 67 | "_resolved": "https://registry.npmjs.org/wav-decoder/-/wav-decoder-1.1.0.tgz" 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/web-audio-engine/node_modules/wav-encoder/README.md: -------------------------------------------------------------------------------- 1 | # wav-encoder 2 | [![Build Status](http://img.shields.io/travis/mohayonao/wav-encoder.svg?style=flat-square)](https://travis-ci.org/mohayonao/wav-encoder) 3 | [![NPM Version](http://img.shields.io/npm/v/wav-encoder.svg?style=flat-square)](https://www.npmjs.org/package/wav-encoder) 4 | [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://mohayonao.mit-license.org/) 5 | 6 | > promise-based wav encoder 7 | 8 | ## Installation 9 | 10 | ``` 11 | $ npm install wav-encoder 12 | ``` 13 | 14 | ## API 15 | 16 | - `encode(audioData: AudioData, [format: object]): Promise` 17 | - `audioData` should contain two fields `sampleRate` and `channelData`. 18 | - `format` is an optional parameter which used to design the output wav format. 19 | - The default format is `{ float: false, bitDepth: 16 }` 20 | 21 | ```js 22 | interface AudioData { 23 | sampleRate: number; 24 | channelData: Float32Array[]; 25 | } 26 | ``` 27 | 28 | ## Usage 29 | 30 | ```js 31 | const fs = require("fs"); 32 | const WavEncoder = require("wav-encoder"); 33 | 34 | const whiteNoise1sec = { 35 | sampleRate: 44100, 36 | channelData: [ 37 | new Float32Array(44100).map(() => Math.random() - 0.5), 38 | new Float32Array(44100).map(() => Math.random() - 0.5) 39 | ] 40 | }; 41 | 42 | WavEncoder.encode(whiteNoise1sec).then((buffer) => { 43 | fs.writeFileSync("noise.wav", new Buffer(buffer)); 44 | }); 45 | ``` 46 | 47 | ## License 48 | MIT 49 | -------------------------------------------------------------------------------- /node_modules/web-audio-engine/node_modules/wav-encoder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wav-encoder", 3 | "description": "promise-based wav encoder", 4 | "version": "1.1.0", 5 | "author": { 6 | "name": "Nao Yonamine", 7 | "email": "mohayonao@gmail.com" 8 | }, 9 | "bugs": { 10 | "url": "https://github.com/mohayonao/wav-encoder/issues" 11 | }, 12 | "dependencies": {}, 13 | "devDependencies": { 14 | "ava": "^0.13.0", 15 | "eslint": "^2.7.0" 16 | }, 17 | "files": [ 18 | "package.json", 19 | "README.md", 20 | "index.js" 21 | ], 22 | "homepage": "https://github.com/mohayonao/wav-encoder/", 23 | "keywords": [ 24 | "encode", 25 | "universal", 26 | "wav" 27 | ], 28 | "license": "MIT", 29 | "main": "index.js", 30 | "repository": { 31 | "type": "git", 32 | "url": "git+https://github.com/mohayonao/wav-encoder.git" 33 | }, 34 | "scripts": { 35 | "lint": "eslint index.js", 36 | "postversion": "git push && git push --tags", 37 | "prepublish": "npm run lint && npm run test", 38 | "preversion": "npm run lint && npm run test", 39 | "test": "ava test", 40 | "travis": "npm run lint && npm run test" 41 | }, 42 | "gitHead": "89c39756bd729e2116dd7bae7f781cb737f6022c", 43 | "_id": "wav-encoder@1.1.0", 44 | "_shasum": "24251eeb31bf32f6363d9be5069bf95a4f5a920f", 45 | "_from": "wav-encoder@>=1.1.0 <2.0.0", 46 | "_npmVersion": "3.8.3", 47 | "_nodeVersion": "5.10.0", 48 | "_npmUser": { 49 | "name": "mohayonao", 50 | "email": "mohayonao@gmail.com" 51 | }, 52 | "dist": { 53 | "shasum": "24251eeb31bf32f6363d9be5069bf95a4f5a920f", 54 | "tarball": "https://registry.npmjs.org/wav-encoder/-/wav-encoder-1.1.0.tgz" 55 | }, 56 | "maintainers": [ 57 | { 58 | "name": "mohayonao", 59 | "email": "mohayonao@gmail.com" 60 | } 61 | ], 62 | "_npmOperationalInternal": { 63 | "host": "packages-12-west.internal.npmjs.com", 64 | "tmp": "tmp/wav-encoder-1.1.0.tgz_1459893151331_0.022955830907449126" 65 | }, 66 | "directories": {}, 67 | "_resolved": "https://registry.npmjs.org/wav-encoder/-/wav-encoder-1.1.0.tgz" 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/web-audio-engine/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-audio-engine", 3 | "description": "Pure JS implementation of the Web Audio API", 4 | "version": "0.8.5", 5 | "author": { 6 | "name": "Nao Yonamine", 7 | "email": "mohayonao@gmail.com" 8 | }, 9 | "bugs": { 10 | "url": "https://github.com/mohayonao/web-audio-engine/issues" 11 | }, 12 | "dependencies": { 13 | "wav-decoder": "^1.1.0", 14 | "wav-encoder": "^1.1.0" 15 | }, 16 | "devDependencies": { 17 | "babel-cli": "^6.7.7", 18 | "babel-plugin-transform-es2015-classes": "^6.7.7", 19 | "babel-plugin-unassert": "^2.1.0", 20 | "babel-preset-es2015": "^6.6.0", 21 | "babel-preset-power-assert": "^1.0.0", 22 | "babel-register": "^6.7.2", 23 | "babelify": "^7.3.0", 24 | "browserify": "^13.0.0", 25 | "deep-equal": "^1.0.1", 26 | "eslint": "^2.9.0", 27 | "eslint-plugin-node": "^1.1.0", 28 | "eslint-watch": "^2.1.10", 29 | "mocha": "^2.4.5", 30 | "npm-run-all": "^1.8.0", 31 | "nyc": "^6.4.2", 32 | "power-assert": "^1.3.1", 33 | "sinon": "^1.17.3" 34 | }, 35 | "engines": { 36 | "node": ">= 4.0.0" 37 | }, 38 | "files": [ 39 | "package.json", 40 | "README.md", 41 | "index.js", 42 | "build", 43 | "lib" 44 | ], 45 | "homepage": "https://github.com/mohayonao/web-audio-engine/", 46 | "keywords": [ 47 | "web audio api" 48 | ], 49 | "license": "MIT", 50 | "main": "index.js", 51 | "nyc": { 52 | "exclude": [ 53 | "src/impl/dsp/*.js", 54 | "test/**/*.js" 55 | ] 56 | }, 57 | "repository": { 58 | "type": "git", 59 | "url": "git+https://github.com/mohayonao/web-audio-engine.git" 60 | }, 61 | "scripts": { 62 | "build": "npm-run-all build:*", 63 | "build:browser": "mkdir -p build && BABEL_ENV=production browserify src -s WebAudioEngine -o build/web-audio-engine.js -t [ babelify ]", 64 | "build:to5": "mkdir -p lib && BABEL_ENV=production babel --out-dir=lib src", 65 | "clean": "rm -rf lib coverage .nyc_output npm-debug.log", 66 | "cover": "BABEL_ENV=coverage nyc --reporter text --reporter html mocha --require babel-register", 67 | "gh-pages": "git checkout gh-pages && git merge master && git push origin gh-pages && git checkout master", 68 | "lint": "eslint src test", 69 | "mocha": "mocha", 70 | "postversion": "git push && git push --tags && npm run clean", 71 | "prepublish": "npm-run-all clean lint test build", 72 | "preversion": "npm-run-all clean lint test", 73 | "test": "mocha --require babel-register", 74 | "travis": "npm-run-all lint mocha", 75 | "version": "npm run build && git add -A build", 76 | "watch": "npm-run-all -p watch:*", 77 | "watch:lint": "esw --watch src test", 78 | "watch:test": "mocha --require babel-register --watch" 79 | }, 80 | "gitHead": "4622c1c3f086190d709ac56704e159e66585a99e", 81 | "_id": "web-audio-engine@0.8.5", 82 | "_shasum": "7b9675c91f038c240c4cd3d686f7a72454f57e62", 83 | "_from": "web-audio-engine@*", 84 | "_npmVersion": "3.8.6", 85 | "_nodeVersion": "6.0.0", 86 | "_npmUser": { 87 | "name": "mohayonao", 88 | "email": "mohayonao@gmail.com" 89 | }, 90 | "dist": { 91 | "shasum": "7b9675c91f038c240c4cd3d686f7a72454f57e62", 92 | "tarball": "https://registry.npmjs.org/web-audio-engine/-/web-audio-engine-0.8.5.tgz" 93 | }, 94 | "maintainers": [ 95 | { 96 | "name": "mohayonao", 97 | "email": "mohayonao@gmail.com" 98 | } 99 | ], 100 | "_npmOperationalInternal": { 101 | "host": "packages-12-west.internal.npmjs.com", 102 | "tmp": "tmp/web-audio-engine-0.8.5.tgz_1462279024488_0.3051515731494874" 103 | }, 104 | "directories": {}, 105 | "_resolved": "https://registry.npmjs.org/web-audio-engine/-/web-audio-engine-0.8.5.tgz" 106 | } 107 | -------------------------------------------------------------------------------- /samples/IMreverbs1.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1.rar -------------------------------------------------------------------------------- /samples/IMreverbs1/Five Columns Long.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Five Columns Long.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Five Columns.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Five Columns.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/French 18th Century Salon.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/French 18th Century Salon.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Going Home.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Going Home.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/In The Silo Revised.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/In The Silo Revised.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Narrow Bumpy Space.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Narrow Bumpy Space.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Nice Drum Room.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Nice Drum Room.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Parking Garage.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Parking Garage.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Rays.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Rays.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/Trig Room.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/IMreverbs1/Trig Room.wav -------------------------------------------------------------------------------- /samples/IMreverbs1/license.txt: -------------------------------------------------------------------------------- 1 | All impulses in this archive were created with Impulse Modeler that can be downloaded at http://www.voxengo.com/imodeler/ 2 | 3 | By extracting and using provided impulse files you signify acceptance of the following terms and conditions: 4 | 5 | 1. All copyrights to these impulse files are exclusively owned by the Distributor - Aleksey Vaneev. All rights not expressly granted here are reserved by Aleksey Vaneev. 6 | 7 | 2. Permission is granted to anyone to use these impulse files royalty-free for any purpose, including commercial usage. 8 | 9 | 3. You may not sell these impulse files or earn any direct or indirect profit from their distribution. 10 | 11 | 4. You may not copy and distribute these impulse files in whole or in part unless: 12 | a) the copyright notice and this list of conditions appear on all copies; 13 | b) copies are complete and unaltered with all messages intact; 14 | c) no charge is associated with the distribution of such copies; and 15 | d) any distribution made by you hereunder is expressly made subject to an acknowledgment by you and the recipient of such distribution that Aleksey Vaneev retains exclusive ownership of these impulse files including all intellectual property rights therein, at all times. 16 | 17 | 5. THESE IMPULSE FILES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, TRADE OR PRACTICE. Some jurisdictions do not allow the exclusion of implied warranties, so the above disclaimer may not apply to you. 18 | 19 | IN NO EVENT SHALL THE DISTRIBUTOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THESE IMPULSE FILES. 20 | -------------------------------------------------------------------------------- /samples/chh.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/chh.wav -------------------------------------------------------------------------------- /samples/kick.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/kick.wav -------------------------------------------------------------------------------- /samples/kick2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/kick2.wav -------------------------------------------------------------------------------- /samples/snare.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g200kg/LiveBeats/92b8b87d48e0971fcb1c8679f6ab97cd740a48e8/samples/snare.wav -------------------------------------------------------------------------------- /vj_graph.js: -------------------------------------------------------------------------------- 1 | // vj_graph.js : vj plugin sample 2 | // 3 | // Should define same name function as 4 | // function(param) 5 | // param={ 6 | // 'w':elementWidth, 7 | // 'h':elementHeight, 8 | // 'n':numOfData, 9 | // 'wavedat':timeDomainDataUint8Array, 10 | // 'freqdat':freqDomainDataUint8Array 11 | // } 12 | // 13 | // Return object should define: 14 | // this.elem : dom-element of this plugin 15 | // this.anim : animation callback function 16 | // this.param : control parameter list. 17 | // number or string, number value range is recommended to 0.0-1.0 for typical use. 18 | // following params are pre-defined at host. 19 | // 'a' : alpha 20 | // 'b' : blur 21 | // 'h' : height 22 | // 'w' : width 23 | // 'x' : x-pos 24 | // 'y' : y-pos 25 | // 'z' : zoom ratio 26 | // 'r' : rotate 27 | // 28 | vj_graph=function(param) { 29 | this.w=param.w; 30 | this.h=param.h; 31 | this.elem=document.createElement("canvas"); 32 | this.elem.width=this.w; 33 | this.elem.height=this.h; 34 | this.ctx=this.elem.getContext("2d"); 35 | this.ctx.lineJoin="round"; 36 | this.lasttime=0; 37 | this.anim=function(timestamp) { 38 | if(timestamp-this.lasttime<50) 39 | return; 40 | this.lasttime=timestamp; 41 | this.param={ 42 | "type":{"value":0, "type":"double", "min":1, "max":20}, 43 | "col":{"value":"#f00", "type":"string"}, 44 | "bcol":{"value":"#fff", "type":"string"}, 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /vj_matrix.js: -------------------------------------------------------------------------------- 1 | // vj_simplewave.js : vj plugin sample 2 | // 3 | // Should define same name function as 4 | // function(param) 5 | // param={ 6 | // 'w':elementWidth, 7 | // 'h':elementHeight, 8 | // 'n':numOfData, 9 | // 'wavedat':timeDomainDataUint8Array, 10 | // 'freqdat':freqDomainDataUint8Array 11 | // } 12 | // 13 | // Return object should define: 14 | // this.elem : dom-element of this plugin 15 | // this.anim : animation callback function 16 | // this.param : control parameter list. 17 | // number or string, number value range is recommended to 0.0-1.0 for typical use. 18 | // following params are pre-defined at host. 19 | // 'a' : alpha 20 | // 'b' : blur 21 | // 'h' : height 22 | // 'w' : width 23 | // 'x' : x-pos 24 | // 'y' : y-pos 25 | // 'z' : zoom ratio 26 | // 'r' : rotate 27 | // 28 | vj_matrix=function(param) { 29 | function MakeCol(hue,bri){ 30 | return "hsl("+(hue*360)+",100%,"+(bri*100)+"%)"; 31 | } 32 | this.w=param.w; 33 | this.h=param.h; 34 | this.wavedat=param.wavedat; 35 | this.freqdat=param.freqdat; 36 | this.elem=document.createElement("canvas"); 37 | this.elem.width=this.w; 38 | this.elem.height=this.h; 39 | this.elemwork=document.createElement("canvas"); 40 | this.elemwork.width=this.w; 41 | this.elemwork.height=this.h; 42 | this.ctx=this.elem.getContext("2d"); 43 | this.ctxwork=this.elemwork.getContext("2d"); 44 | this.mat=Array(64); 45 | for(var i=0;i<64;++i) 46 | this.mat[i]=-1; 47 | this.mrx=this.w/64; 48 | this.mry=this.h/48; 49 | this.lasttime=0; 50 | this.anim=function(timestamp) { 51 | // console.log(this.param.a.value,this.elem.style.opacity); 52 | this.elem.style.opacity=this.param.a.value; 53 | if(this.param.a.value==0) 54 | return; 55 | if(timestamp-this.lasttime<50) 56 | return; 57 | this.lasttime=timestamp; 58 | var rz=this.param.effz.value; 59 | var sx=(this.w*rz)|0; 60 | var sy=(this.h*rz)|0; 61 | var sxoff=(this.w*this.param.cx.value-sx*.5)|0+this.param.effx.value; 62 | var syoff=(this.h*this.param.cy.value-sy*.5)|0+this.param.effy.value; 63 | this.ctx.shadowBlur=0; 64 | this.ctxwork.clearRect(0,0,this.w,this.h); 65 | this.ctxwork.drawImage(this.elem,sxoff,syoff,sx,sy); 66 | this.ctx.clearRect(0,0,this.w,this.h); 67 | this.ctx.globalAlpha=this.param.effr.value; 68 | this.ctx.drawImage(this.elemwork,0,0,this.w,this.h); 69 | var rad=this.param.rot.value*3.14159/180; 70 | var sn=Math.sin(rad); 71 | var cs=Math.cos(rad); 72 | this.ctx.translate(this.w*0.5,this.h*0.5); 73 | this.ctx.transform(cs, sn, -sn, cs, 0,0 ); 74 | this.ctx.translate(-this.w*0.5,-this.h*0.5); 75 | 76 | // console.log(this.param.a.value) 77 | this.ctx.globalAlpha=1.0;//this.param.a.value; 78 | var i=this.wavedat[0]>>2; 79 | if(this.mat[i]<0) 80 | this.mat[i]=0; 81 | // this.ctx.fillStyle=this.param.col.value; 82 | this.ctx.fillStyle=MakeCol(this.param.hue.value,this.param.bri.value); 83 | this.ctx.shadowBlur=this.param.effb.value; 84 | this.ctx.shadowColor=this.param.bcol.value; 85 | this.ctx.strokeStyle="#000"; 86 | this.ctx.font="bold "+this.mry+"px Courier,monospace"; 87 | this.ctx.lineWidth=3; 88 | for(var i=0;i<64;++i) { 89 | if(this.mat[i]>=0) { 90 | this.ctx.strokeText(String.fromCharCode(0x21+(this.wavedat[i*2]&0x3f)),i*this.mrx,this.mat[i]*this.mry); 91 | this.ctx.fillText(String.fromCharCode(0x21+(this.wavedat[i*2]&0x3f)),i*this.mrx,this.mat[i]*this.mry); 92 | if((this.mat[i]+=1)>48) 93 | this.mat[i]=0; 94 | } 95 | } 96 | this.ctx.setTransform(1,0,0,1,0,0); 97 | }; 98 | this.param={ 99 | "rot":{"value":0, "type":"double", "min":-1000,"max":1000}, 100 | "z":{"value":2, "define":1, "type":"double", "min":0, "max":20}, 101 | "a":{"value":0, "type":"double", "min":0, "max":1}, 102 | "effb":{"value":0, "type":"double", "min":0, "max":20}, 103 | "effr":{"value":0.95, "type":"double", "min":0.9, "max":0.99}, 104 | "effx":{"value":0, "type":"double", "min":-20, "max":20}, 105 | "effy":{"value":0, "type":"double", "min":-20, "max":20}, 106 | "effz":{"value":1, "type":"double", "min":0.5, "max":2}, 107 | "hue":{"value":0.3, "type":"double", "min":-1, "max":1}, 108 | "bri":{"value":0.5, "type":"double", "min":0, "max":1}, 109 | "col":{"value":"#0f0", "type":"string"}, 110 | "bcol":{"value":"#fff", "type":"string"}, 111 | "cx":{"value":.5, "type":"double", "min":0, "max":1}, 112 | "cy":{"value":.5, "type":"double", "min":0, "max":1}, 113 | }; 114 | } 115 | -------------------------------------------------------------------------------- /vj_simplewave.js: -------------------------------------------------------------------------------- 1 | // vj_simplewave.js : vj plugin sample 2 | // 3 | // Should define same name function as 4 | // function(param) 5 | // param={ 6 | // 'w':elementWidth, 7 | // 'h':elementHeight, 8 | // 'wavedat':timeDomainDataUint8Array, 9 | // 'freqdat':freqDomainDataUint8Array 10 | // } 11 | // 12 | // Return object should define: 13 | // this.elem : dom-element of this plugin 14 | // this.anim : animation callback function 15 | // this.param : control parameter list. 16 | // number or string, number value range is recommended to 0.0-1.0 for typical use. 17 | // following params are pre-defined at host. 18 | // 'a' : alpha 19 | // 'b' : blur 20 | // 'h' : height 21 | // 'w' : width 22 | // 'x' : x-pos 23 | // 'y' : y-pos 24 | // 'z' : zoom ratio 25 | // 'r' : rotate 26 | // 27 | vj_simplewave=function(param) { 28 | this.w=param.w; 29 | this.h=param.h; 30 | this.wavedat=param.wavedat; 31 | this.freqdat=param.freqdat; 32 | this.elem=document.createElement("canvas"); 33 | this.elem.width=this.w; 34 | this.elem.height=this.h; 35 | this.ctx=this.elem.getContext("2d"); 36 | this.ctx.lineJoin="round"; 37 | this.anim=function(timestamp) { 38 | this.ctx.strokeStyle=this.param.col.value; 39 | this.ctx.lineWidth=this.param.line.value; 40 | this.ctx.clearRect(0,0,this.w,this.h); 41 | this.ctx.beginPath(); 42 | this.ctx.moveTo(0,this.h/2-(this.wavedat[0]-128)*this.h/512); 43 | for(var i=1,e=this.wavedat.length;i=3){ 72 | this.curcnt=0; 73 | var m=this.ctx.measureText(this.cmds.log[0]).width|0; 74 | this.ctx.globalCompositeOperation="xor"; 75 | this.ctx.fillRect(m+12,this.yheight-this.mry+4,this.mrx|0,this.mry); 76 | } 77 | }; 78 | this.param={ 79 | "a":{"value":1,"type":"double"}, 80 | "col":{"value":"#0f0","type":"string"}, 81 | }; 82 | } 83 | -------------------------------------------------------------------------------- /vj_wave.js: -------------------------------------------------------------------------------- 1 | // vj_simplewave.js : vj plugin sample 2 | // 3 | // Should define same name function as 4 | // function(param) 5 | // param={ 6 | // 'w':elementWidth, 7 | // 'h':elementHeight, 8 | // 'n':numOfData, 9 | // 'wavedat':timeDomainDataUint8Array, 10 | // 'freqdat':freqDomainDataUint8Array 11 | // } 12 | // 13 | // Return object should define: 14 | // this.elem : dom-element of this plugin 15 | // this.anim : animation callback function 16 | // this.param : control parameter list. 17 | // number or string, number value range is recommended to 0.0-1.0 for typical use. 18 | // following params are pre-defined at host. 19 | // 'a' : alpha 20 | // 'b' : blur 21 | // 'h' : height 22 | // 'w' : width 23 | // 'x' : x-pos 24 | // 'y' : y-pos 25 | // 'z' : zoom ratio 26 | // 'r' : rotate 27 | // 28 | vj_wave=function(param) { 29 | this.w=param.w; 30 | this.h=param.h; 31 | this.wavedat=param.wavedat; 32 | this.freqdat=param.freqdat; 33 | this.elem=document.createElement("canvas"); 34 | this.elem.width=this.w; 35 | this.elem.height=this.h; 36 | this.elemwork=document.createElement("canvas"); 37 | this.elemwork.width=this.w; 38 | this.elemwork.height=this.h; 39 | this.ctx=this.elem.getContext("2d"); 40 | this.ctxwork=this.elemwork.getContext("2d"); 41 | this.ctx.lineJoin="round"; 42 | this.lasttime=0; 43 | this.anim=function(timestamp) { 44 | if(timestamp-this.lasttime<50) 45 | return; 46 | this.lasttime=timestamp; 47 | var rz=this.param.effz.value; 48 | var sx=(this.w*rz)|0; 49 | var sy=(this.h*rz)|0; 50 | var sxoff=((this.w-sx)*.5)|0+this.param.effx.value; 51 | var syoff=((this.h-sy)*.5)|0+this.param.effy.value; 52 | this.ctx.shadowBlur=0; 53 | this.ctxwork.clearRect(0,0,this.w,this.h); 54 | this.ctxwork.drawImage(this.elem,sxoff,syoff,sx,sy); 55 | this.ctx.clearRect(0,0,this.w,this.h); 56 | this.ctx.globalAlpha=this.param.effr.value; 57 | this.ctx.drawImage(this.elemwork,0,0,this.w,this.h); 58 | this.ctx.globalAlpha=1.0; 59 | 60 | this.ctx.strokeStyle=this.param.col.value; 61 | this.ctx.fillStyle=this.param.col.value; 62 | this.ctx.lineWidth=this.param.line.value; 63 | this.ctx.shadowBlur=this.param.effb.value; 64 | this.ctx.shadowColor=this.param.bcol.value; 65 | this.ctx.beginPath(); 66 | if(this.param.type.value==2) { 67 | var hh=this.h*.5; 68 | var hw=this.w*.5; 69 | var n=this.wavedat.length; 70 | for(var i=0;i=2*Math.PI) 79 | this.ph-=2*Math.PI; 80 | this.ctx.closePath(); 81 | } 82 | else if(this.param.type.value==1) { 83 | var hh=this.h*.75; 84 | var n=this.freqdat.length; 85 | this.ctx.moveTo(0,hh); 86 | for(var i=0;i