So I've been trying this "Get sound from URL" thingy using this Java Script code, and it just returns this:
I don't know how much trickery I have to do to turn this into a Snap! readable sound, so i might need help with this...

replace Audio with Sound

I managed to fix this problem with "Javascript functions"
untitled script pic
Just wait for a few seconds and it plays a sound

... Why

Sound is the sound type that snap uses
Javascript function (url, name) {return new Sound(url, name)}
then you can use it in play blocks and such

honestly i'm surprised this isn't already a primitive. i think i'll make a pr later

True, idk why but i always imagined that "snd_load(url)" existed... But it never did

getting the name is fine, until you report duration, length, samples, etc

Just look at how snap loads sounds from a file, then try to use that, but change it from a local file to a url.

pretty sure file loading uses blobs, which are essentially urls for things that don't actually have a url
that's because pretty much all these web technologies were designed before all the javascript apis for loading files and such

dropping a url in its place should work fine, reading over the code i can't figure out why what i suggested doesn't work
i'll need to do a bunch of testing

found my mistake, it should be return new Sound(new Audio(url), name)
it won't work for your url because of CORS
it works with or any other sound on snap itself

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.