]> git.r.bdr.sh - rbdr/r.bdr.sh/commitdiff
Adds weird reverb code
authorBen Beltran <redacted>
Wed, 25 Feb 2015 14:08:21 +0000 (08:08 -0600)
committerBen Beltran <redacted>
Wed, 25 Feb 2015 14:08:21 +0000 (08:08 -0600)
jekyll/js/unlimited_pizza/pepperoni.js
jekyll/reverb.aiff [new file with mode: 0644]

index 58bcc5f29cfc7d77024f5c6893792264454f79b2..9bb27a2167bce4a52e3910f28ea14dc0539bb703 100644 (file)
@@ -1,3 +1,5 @@
+'use strict';
+
 Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
   INNER_HTML : ' \
 <a class="record-button">&#11044</a> \
@@ -13,6 +15,7 @@ Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
     <input class="filter-switch" name="bandpass-filter" type="checkbox" /> <label for="bandpass-filter">Band Pass</label> \
     <input class="filter-switch" name="hipass-filter" type="checkbox" /> <label for="hipass-filter">Hi Pass</label> \
     <input class="filter-switch" name="lopass-filter" type="checkbox" /> <label for="lopass-filter">Lo Pass</label> \
+    <input class="filter-switch" name="reverb-filter" type="checkbox" /> <label for="reverb-filter">Reverb</label> \
     <input class="filter-switch" name="distort-filter" type="checkbox" /> <label for="distort-filter">Distort</label> \
   </div> \
 </div> \
@@ -34,6 +37,8 @@ Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
     _activatedNodes : null,
     workerPath : '/js/vendor/recorderjs/recorderWorker.js',
     init : function init(config) {
+      var channels, frameCount, reverbBuffer, request, requestHandler;
+
       Widget.prototype.init.call(this, config);
 
       if (!this.context) {
@@ -67,6 +72,21 @@ Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
       this._bandPassFilterNode.frequency.value = 2000;
       this._bandPassFilterNode.gain.value = 25;
 
+      requestHandler = function bufferFile(ev) {
+        var request = event.target;
+        console.log("Reverb loading");
+        this.context.decodeAudioData(request.response, function(buffer){ 
+          console.log("Reverb loaded");
+          this._convolverNode.buffer = buffer;
+        });
+      }.bind(this);
+
+      request = new XMLHttpRequest();
+      request.open('GET', '/reverb.aiff', true);
+      request.responseType = 'arraybuffer';
+      request.addEventListener('load', requestHandler, false);
+      request.send();
+
       if (!this.source) {
         this._getUserMedia({
           audio : true
diff --git a/jekyll/reverb.aiff b/jekyll/reverb.aiff
new file mode 100644 (file)
index 0000000..54226d5
Binary files /dev/null and b/jekyll/reverb.aiff differ