Loading a local audio file through AudioLoader

I’m somewhat new to using Three.js, and I’m trying to make use of it to create an application. I’ve gotten a bit stuck at a certain step, and I can’t seem to find any answers online to solve this.

What I want to do is let the user choose a local file, and then control the playback of that file through audio controls. I’ve been able to make it work successfully simply by making an tag and then passing that value on to the audio controls. However, I would like to instead use AudioLoader as I would need to get the average frequency for the audio file further on.

I’ve created a jsfiddle with the code that I’ve got so far, and commented on the part I am wondering about inside the function loadAudio().

https://jsfiddle.net/3w78ujx2/11/

Currently it runs, but I want to change from passing “input.files[0]” to “audio.src”, and instead pass “sound” to it, but to be able to do that I first need to find out how I can change the value of the current file “cold.mp3” to a variable containing the file loaded by the user.

If anyone knows how to do this I’d be much obliged!