C
C#4mo ago
PowerZox

Easy to use C# audio library for spectrum analyzer?

Hi, I'm making a spectrum analyzer and wanted to know what's an appropriate audio library. My goal is to get the audio level of the desktop at a specific frequency at a decent rate (5-40ms). I specifically want the real-time desktop audio, not reading a file. So far I've made a VU meter with the NAudio library and the following
MMDevice defaultDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);

defaultDevice.AudioMeterInformation.MasterPeakValue
MMDevice defaultDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);

defaultDevice.AudioMeterInformation.MasterPeakValue
but making a spectrum analyzer with this library without reading a file seems much much more complicated and I wouldn't know where to start. Does anyone have any suggestion of how to go about doing this (with any library not necessarily NAudio).
No description
5 Replies
PowerZox
PowerZoxOP4mo ago
I will then send those amplitude values to my arduino through the serial port so it can display it on the array of neon bargraph tubes I made. The arduino handles the actual displaying and protection for the neons and circuit. That is already all covered. Here it is displaying a sine wave. What I'm struggling with is getting the values from the desktop audio source.
canton7
canton74mo ago
Might be easiest to go straight for doing an FFT? Someone's got to have implemented FFT in C# somewhere
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Keswiik
Keswiik4mo ago
there is also bass.net http://www.bass.radio42.com/ (haven't used this in like a decade though lol) https://github.com/swharden/FftSharp (haven't used but looks fine) https://github.com/filoe/cscore (been a while since i used this one but was easy enough to work with) naudio also works, used it before as well and has decent docs
PowerZox
PowerZoxOP4mo ago
The FftSharp link led me to exactly the right place! The creator of it also has a project called CSharp Data Visualisation which has an example of a FFT graph from any audio input or output (i.e. Desktop Audio). I'll modify it to send the values to my neon bargraphs through serial port and that should be it https://github.com/swharden/Csharp-Data-Visualization/blob/main/projects/audio/AudioMonitor/screenshot2.gif
GitHub
Csharp-Data-Visualization/projects/audio/AudioMonitor/screenshot2.g...
Resources for visualizing data using C# and the .NET platform - swharden/Csharp-Data-Visualization
Want results from more Discord servers?
Add your server