Audio playback and spectrum analysis libarary for C #

I would like to create a small application that plays a music file (the format does not matter). The hard part: at the same time, I would like to display the current amplitude of the low frequencies (bass), mid frequencies and high frequencies.

So, I need some simple spectral analysis along with playback functions. Is there a C # audio library that can do this without the hassle?

The goal of this project is to control the RGB-LED lighting system that I recently installed in my room; -)

+4
source share
1 answer

NAudio: http://naudio.codeplex.com/ (open source)

Bass and Bass.Net: http://www.un4seen.com/ (free for non-profit)

Fmod Ex: http://www.fmod.org/index.html (also free for non-commercial use)

Doing what you need with Bass is very simple:

string filepath =""; Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero, null); int handle = Bass.BASS_StreamCreateFile(filepath, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT); Bass.BASS_ChannelPlay(handle,false); 

Then to get the spectrum:

 float[] buffer = new float[256]; Bass.BASS_ChannelGetData(handle, buffer, (int)BASSData.BASS_DATA_FFT256); 

From there, you can easily average the bands for specific frequencies.

+9
source

Source: https://habr.com/ru/post/1436535/


All Articles