Introduction: Audio Spectrum Software [C#]

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

Picture of 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:

http://bass.radio42.com/

here's an instructable to do as such:

https://www.instructables.com/id/WS2801-addressable-LEDs-Class/

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.

Comments

GingerO3 (author)2016-09-02

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.

GingerO3 (author)2016-09-01

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?

h0uri (author)GingerO32016-09-02

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

jharefa (author)2015-12-06

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

h0uri (author)jharefa2015-12-07

no i have not, .. :(

About This Instructable

4,798views

29favorites

License:

Bio: Computer Engineering @ASU in JO.
More by h0uri:Remote Hardware MonitorAmbilight DFMirage [super fast screen capture and processing]Audio Spectrum Software [C#]
Add instructable to: