Audio Spectrum Software [C#]




Introduction: Audio Spectrum Software [C#]

About: Computer Engineering @ASU in JO.

what is this project ?

this project will allow you to capture the output audio of you pc and analyze it using fast fourier transform which allow us to draw a spectrum, such as the video shows

what language are we using ?

i'm using c# to build a windows application form

what software to are we using to build this program ?

visual studio 2015, worked with express and community.

what are the benefits of doing such a thing ?

first of all it's cool, :D, and i'm specifically using it to feed my rgb leds all over my desktop, in pc chassis, around the screen, and inside my keyboard and mousepad.

download spectrum rar file.

let's start coding ..

Step 1: Add Tool to Your Form

now your form need the tools we are using, which is the following:

1 ComboBox, 1 Spectrum, 2 PB.

that's about all, in my video i have hidden those extra controls other than the spectrum.

some advance stuff you can go with, make your spectrum larger like in my video.

which is done by modifying the Analyzer.cs and the Spectrum.xaml tool.

in the file you downloaded we are using 16 spectrum bars, to add more spectrums, let's say i want 64 spectrums

simply copy and paste the last two lines and change there Bar names.

at last, i have uploaded my example with one extra thing is drawing the spectrum as a line using charting.

Step 2: Start Your Windows Forms Applecation

first, start a windows forms application project.

what we are going to do in this project is capturing the audio output of the pc and convert it to a wave from using FFT, then take points on that wave form and convert it into an array of data changing from 0 - 255 for a certain amount of bars, all of that is done by the Analyzer class which uses the Bass.dll library.

include the Analyzer.cs class to your project along with the user controls and the libraries from the rar file.

also include the following references:

PresentationCore, PresentationFramework, System.Xaml, WindowsBase

now we need to define an instance of the class Analyzer as a global instance

then in the form constructor give it a value as a new instance, then enabling it and the display, your code should look something like this:

Analyzer analyzer;

public Form1()

analyzer = new Analyzer(pb1, pb2, spectrum1, comboBox1);

analyzer.Enable = true;

analyzer.DisplayEnable = true;


Step 3: More Advance Stuff

i have setup some addressable leds ws2801 around my screen and in my pc chassis, also there's addressable leds in my keyboard and mousepad.

the ws2801 strips are connected to an arduino and controlling them is done via serial.

also the banner of the bass.dll that comes up when starting the form can be removed by signing up here for free:

here's an instructable to do as such:

at last, i'm going to make a tutorial on how to control the ws2801 leds also in c#.

special thanks to the guy who made the Analyzer.cs class and bass.dll library and it .net wrapper.

Be the First to Share


    • Origami Speed Challenge

      Origami Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge



    4 weeks ago

    Yes, it's cool project!) Respect to you!!!!!


    2 years ago

    Really nice post.
    Thank you very much.

    P/s: I made a circular audio spectrum bar base-on your source code.


    Reply 2 years ago

    Wow, that’s pretty good .. well done.. thank you for letting me know.


    5 years ago

    Thanks, in that case it would be fine if the combobox were active; it is gray and can't select any device. The solution builds ok, starts running but all the controls are empty.


    5 years ago

    Hi, I noted at the end that it works with arduino. You have nice controls in place, do you have a solution to just play from a desktop wav file?


    Reply 5 years ago

    this solution doesn't work with arduino, but you can always set it up to send serial data to your arduino.


    6 years ago

    do you have ever processing a signal with 40KHz frequency with arduino?


    Reply 6 years ago

    no i have not, .. :(