enzienaudio / heavy

heavy public issue tracker and static dsp code releases
https://enzienaudio.com
ISC License
71 stars 4 forks source link

js-loading-samples fails "getTableForName is not a function" #197

Open kristoferhagbard opened 7 years ago

kristoferhagbard commented 7 years ago

Trying to use the js-loading-samples example from github examples, but after recompiling and making the appropriate changes in index.html (adding the loadAudio function) I'm getting "getTableForName is not a function".

Looking closer at the compiled .js the getTableForName is missing. (but It does exist in the precompiled .js supplied with the github example, presumably compiled in an earlier version )

diplojocus commented 7 years ago

hey @kristoferhagbard apologies, it looks like we need to update those examples to match the latest version of heavy.

You should be able to just call fillTableWithFloatBuffer and pass table name (string) and the audio buffer (Float32Array).

fillTableWithFloatBuffer = function(tableName, buffer)

diplojocus commented 7 years ago

created an issue for that here: https://github.com/enzienaudio/heavy/issues/198

kristoferhagbard commented 7 years ago

Hi!

Thanks for quick reply!

I didn't quite get how to replace the getTableForName with fillTableWithFloatBuffer in the code below (from the example):

      // Sample loading
      function loadAudio(url) {
        var rq = new XMLHttpRequest();
        rq.open("GET", url, true);
        rq.responseType = "arraybuffer";
        rq.send();

        rq.onload = function() {
          var audioData = rq.response;
          webAudioContext.decodeAudioData(audioData, function(buffer){
              var testTable = testSample123.getTableForName("test");
              testTable.setBufferWithData(buffer.getChannelData(0));
              testSample123.sendFloatToReceiver("table-size", testTable.length);
          });
        }
      }
diplojocus commented 7 years ago

Something like:

        rq.onload = function() {
          var audioData = rq.response;
          webAudioContext.decodeAudioData(audioData, function(buffer){
              heavyLib.fillTableWithFloatBuffer("test", buffer.getChannelData(0));
          });
        }

should work, can't remember if decodeAudioData provides a Float32Array or not.

kristoferhagbard commented 7 years ago

Thank you so much! this makes it possible to load samples! :-)

kristoferhagbard commented 6 years ago

Hi,

Unfortunately, this does not work anymore. Is there any chance you could give me a hint how to get it working again while the site is still up? (very sad to hear you are closing! any chance of an OS continuation?)