This probably doesn’t have an easy solution, but I’m working on a music visualizer. Currently, it has some preloaded tracks is uses for the audio, but I’d like the app to be able to use any audio the user has playing on their computer. For example, they can run the app then go to Youtube and play any song they want. The app will listen to that audio.
Essentially, I want the app to be able to use the desktop audio as the audio source. Is there an existing plugin I can use or some other method to do this?
Preview of the project: Plum Blossom Visualizer Preview - YouTube
TLDR: How do I make Unity listen to the desktop audio and use it as the audio source?
NOTE: I’ve been writing this program in C#.
EDIT: Looks like what I need specifically is to give Unity “WASAPI Loopback Capture,” at least for Windows. It would be nice if I could get this to work on OSX as well, but it’s a start.
I’m not sure where you ended up with this, but I’ve been playing around with a visualizer of my own, and I wanted the same thing.
I used the excellent CSCore library (GitHub - filoe/cscore: An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.) to accomplish it. It’s capable of visualizing “what you hear” (WASAPI Loopback Capture). I came across this while searching for a way to feed the raw audio data into a Unity AudioSource since I’m too lazy to write my own beat detectors and all of the Asset Store assets work off AudioSource. If you’re just interested in spectrum data though, it works great. I don’t have a problem sharing it with you.
If you’re still interested, reply here and I’ll put something together for you.
Edit: Since OP showed interest, here’s a working example