r/learnjavascript • • Mar 19 '21

My hand-made vanilla JavaScript audio visualizers :D (source code included)

358 Upvotes

23 comments sorted by

View all comments

1

u/amadeusjustinn Mar 20 '21

This is brilliant. But I have to ask what is that long string that audioSource is set to?

1

u/darkersauru5 Mar 20 '21 edited Mar 20 '21

He converted the audio file to base64 encoding

2

u/frank0117 Mar 21 '21

Yup. I linked YouTube tutorial where I code it and explain every line of code. Browsers block audio files and images when you try to analyse them so converting images and sound files to base64 string bypasses built in browser CORS security that would otherwise block it

1

u/amadeusjustinn Mar 22 '21

Oh I see. Thank you!