Drum machine doesn't play audio after deploying

Hi. I was trying to deploy my react drum machine project to github pages but after deploying none of the audio is playing. It still works fine on my local dev but on GitHub pages no sound.

Has anyone had a similar issue?

Here is repo: https://github.com/linardsblk/drum-machine/t
Link to GH pages: https://linardsblk.github.io/drum-machine/

Any help would be appreciated.

The errors showing in your browser console tells you what the problem is. You are trying to reference a file located https://linardsblk.github.io/audio/808-Clap13.wav, when instead you should be referencing https://linardsblk.github.io/drum-machine/audio/808-Clap13.wav based on how you have things referenced.

1 Like

Okay, how should I set the audio source so that it works on both dev and deployed site?

I fixed it by adding . before my audio source. ie. ./audio/808-Cowbell1.wav Hope this helps anyone else with this problem!