3D Audio with Spotify

I’m looking to utilize the Spotify API to play music tracks through a BabylonJS project. I know how to set up the music player to play from Spotify using ‘2D’ sound, but I’d like to include some 3d speakers and have a character walk around to hear the music using 3D Spatial sound.

Is there a way to do this? The audio examples I’ve seen in the documentation references individual music files but how would I set that up to work with the Spotify player and 3d audio?

It should be possible as long as the spotify APIs are providing you with a stream you can plug into WebAudio. I unfortunately do not know their APIs enough e.g. are they playing through an iFrame ? their own audio context ? or going deeper with providing you the stream you need ?

I’m pretty sure there will be some CORS limitation

I really wonder what their API offer but in theory I d bet on some CORS restrictions as well :slight_smile:

Thanks, I’ve worked with the Spotify API before to play within a ThreeJS project before but I never tried using it with 3d Audio. I’ll give it a try and see if I can get it working.

1 Like