I’m starting to think we might need a sub category for web based questions
@stevenyi, @hlolli sorry to ping you, but I can’t seem to play back samples using the same code I used in earlier versions of Csound wasm. The following sketch just can’t find the files I’m trying to load? Any ideas?
you pass in “siren.ogg” but perhaps it’s getting modified somewhere? The absolute url is coming from the csound logs, so it must be passed into csound incorrectly. Also there’s a chance this csound web module has the http request built in, not sure.
I modified the code to write to a different file name than what I wanted to fetch and it worked here so it’s an issue with p5.js’s online editor. The code I used is:
const orcCode = `
; Initialize the global variables.
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
//imports files for use with Csound
function CopyUrlToLocal(name, file, callback = null) {
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onload = function() {
var data = new Uint8Array(xmlHttpRequest.response);
csound.writeToFS(name, data);
};
xmlHttpRequest.open(“get”, file, true);
xmlHttpRequest.responseType = “arraybuffer”;
xmlHttpRequest.send(null);
}
And now I have a nice example of doppler shift to show my students, albeit a completely crude implementation! I updated it to use a proper doppler implementation curtesy of some code Victor posted to the list.