Skip to content

Commit

Permalink
I should probably call the function if I want it to work...
Browse files Browse the repository at this point in the history
  • Loading branch information
krismakesstuff committed Apr 29, 2024
1 parent 22fcfb5 commit 5fee31c
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions rnbo-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,36 +149,40 @@ export async function createRNBODevice(patchExportURL) {
downloadLink.download = fileName;
downloadLink.click();
}
else {

const reader = new FileReader();


// returns and array buffer
reader.onloadend = function() {
console.log("FileReader onloadend");
console.log(reader.result);

// decode audio data
context.decodeAudioData(reader.result, function(audioBuffer) {
console.log("Decoded audio data");
const waveBlob = bufferToWave(audioBuffer, audioBuffer.length);

let url = URL.createObjectURL(waveBlob);
console.log("waveBlob url: " + url);
let downloadLink = document.getElementById("download-link");
let fileName = "shift-recording-" + (Date.now() - date);

downloadLink.href = url;
downloadLink.download = fileName;
downloadLink.click();

}, function(e){"Error with decoding audio data" + e.err});
const reader = new FileReader();

// returns and array buffer
reader.onloadend = function() {
console.log("FileReader onloadend");
console.log(reader.result);

// decode audio data
context.decodeAudioData(reader.result, function(audioBuffer) {
console.log("Decoded audio data");

// writes the wave header for file
const waveBlob = bufferToWave(audioBuffer, audioBuffer.length);

let url = URL.createObjectURL(waveBlob);
console.log("waveBlob url: " + url);
let downloadLink = document.getElementById("download-link");
let fileName = "shift-recording-" + (Date.now() - date);

// downloads the file
downloadLink.href = url;
downloadLink.download = fileName;
downloadLink.click();

}, function(e){"Error with decoding audio data" + e.err});

}

// reads blob as an ArrayBuffer
reader.readAsArrayBuffer(recordedBlob[0]);
}

// reads blob as an ArrayBuffer
//reader.readAsArrayBuffer(recordedBlob[0]);


}

Expand Down

0 comments on commit 5fee31c

Please sign in to comment.