I’m creating a project in which i’m trying to implement music streaming services like Spotify and Deezer for the Oculus Rift in Unity3D. But i just can’t find any resources to successfully implement this in Unity.
If virtual reality takes over this year then we need music (Sitting behind the VR desk programming in the jungle listening to some nice trance mixes threw my Spotify playlist).
I know it’s possible to stream your own music to unity to the AudioSource, Ogg only right? no mp3 (desktop)?!
I know NAudio does enables MP3 streaming to unity3d, but not to the AudioSource and i need the AudioSource to call GetSpectrumData on it and do magic things with it.
But also no commercial music streaming services like spotify and deezer with full track streaming support can be implemented in Unity, or i’m i wrong?
Because i think this should even be made native in Unity, what about you?
I can see where it could be useful in some games, but for your example of going through jungle terrain, music beyond ambient noise would seem inappropriate. I’d also probably just run VLC or some other music player in the background instead of adding stress to my game, if the point was to enjoy some unrelated background music.
True, true. I do think that someday windows would also support VR and people would rather by a HMD instead of a monitor and play their music the usual way.
But now in the present i’m trying to create a unityproject where the 3D environment reacts to the music. With that i need to stream music from Spotify to an AudioSource, so i could call GetSpectrumData on it and use the frequency bands to change my objects in the scene. Everything works like a charm, except for the fact that i can’t stream mp3 to the AudioSource on Desktop and that i’m failing to implement the fully libspotify SDK see my thread here.
Local MP3 files imported in Unity is not a problem, Unity3D changes it to OGG and GetSpectrumData works fine. I also use music analyse data from Deezer like BPM and gain to adjust my scenery. This is what i have now, but i’m wandering… is it even possible to stream MP3 to an AudioSource and call GetSpectrumData on it and did anyone ever succeeded to implement the libspotify SDK in Unity?
I’m not familiar with the Spotify or Deezer APIs (yet), but I think Bass.dll does file streaming. You don’t even need to get the song into Unity. You should be able to play it with Bass.dll and then get the spectrum data directly from there to use it in Unity. Maybe you can get it to work that way.
Bass.dll does have libraries for other platforms, but I don’t know if it will work with the bass.net wrapper. Naudio Nlayer should work with mono on other platforms.
Thx!! importing local mp3 files at runtime was my secondary option, should save some time :-). I would then get the music analysis data by track. But i will try the first suggestion! sounds good.
Lol, guess i was living in the Oculus for too long… It indeed does not necessarily specific relate to VR. Except that the user experience is entirely different within my scenery when using VR. Cause the music in VR (which i like it to be streamed) makes the difference between an Windows Media Player virtualisation on your desktop and your entire surroundings which reacts to the music. So, if i could integrate the libspotify successfully i can dream very happily.
Yes, you could! This tutorial from Unity describes the ways how to use different types of dlls in Unity3D. You could start with the libspotify.dll if you like, maybe then you are The One that could answer my troublings.