Click here to Skip to main content
11,928,403 members (52,087 online)
Click here to Skip to main content
Add your own
alternative version


216 bookmarked

Sound visualizer in C#

, 15 Aug 2007 GPL3
Rate this:
Please Sign up or sign in to vote.
Simple sound sampler with visualization
Screenshot - SoundViewer.jpg


This project demonstrates the use of the Fast Fourier Transform and Windows GDI to produce near real-time visualizations of the time and frequency domains of sound.


While looking for information on signal processing for a robotics project, it became apparent that examples written in C# were hard to find. This led me to create some of my own classes, which I have provided here for this demonstration.

Using the Code

Audio input for this demonstration is provided by the Wave classes developed by Ianier Munoz. Wave samples are further processed using the AudioFrame class.

class AudioFrame
    private Bitmap _canvasTimeDomain;
    private Bitmap _canvasFrequencyDomain;
    private double[] _waveLeft;
    private double[] _waveRight;
    private double[] _fftLeft;
    private double[] _fftRight;
    private SignalGenerator _signalGenerator;
    private bool _isTest = false;
    public AudioFrame(bool isTest)
        _isTest = isTest;

    /// <span class="code-SummaryComment"><summary>


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Jeff Morton
Systems / Hardware Administrator
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralRe: Media file Pin
diogopms27-Jun-09 16:37
memberdiogopms27-Jun-09 16:37 
GeneralRe: Media file Pin
Ankur Dukare11-Mar-10 23:34
memberAnkur Dukare11-Mar-10 23:34 
GeneralRe: Media file Pin
gerardo_00115-Mar-10 9:15
membergerardo_00115-Mar-10 9:15 
QuestionWhere is the Documentation? Pin
Member 603819619-Mar-09 8:37
memberMember 603819619-Mar-09 8:37 
QuestionaudioFrameSize in waveformat correct ? Pin
radio_gaga8-Mar-09 9:16
memberradio_gaga8-Mar-09 9:16 
AnswerRe: audioFrameSize in waveformat correct ? Pin
Jeff Morton8-Mar-09 10:59
memberJeff Morton8-Mar-09 10:59 
GeneralIt won't work on desktop PC Pin
max_99014-Feb-09 1:15
membermax_99014-Feb-09 1:15 
QuestionInput delays Pin
Joe Wright1-Sep-08 8:12
memberJoe Wright1-Sep-08 8:12 
We are using this code for a application that requires immediate response times, With some slower computers that get momentarily stress, delays of a second or longer can appear in the microphone input signal, regaurdless of the number of buffers used. Is there any way to avoid this or tell what the delay is?
AnswerRe: Input delays Pin
Jeff Morton1-Sep-08 13:45
memberJeff Morton1-Sep-08 13:45 
GeneralIt works! Pin
Member 470880128-Aug-08 22:08
memberMember 470880128-Aug-08 22:08 
GeneralShutdown addition Pin
firmwaredsp31-Oct-07 23:26
memberfirmwaredsp31-Oct-07 23:26 
GeneralRe: Shutdown addition Pin
Ri Qen-Sin20-Nov-07 18:39
memberRi Qen-Sin20-Nov-07 18:39 
GeneralRe: Shutdown addition Pin
Jeff Morton27-Nov-07 3:57
memberJeff Morton27-Nov-07 3:57 
GeneralRe: Shutdown addition Pin
firmwaredsp28-Nov-07 0:21
memberfirmwaredsp28-Nov-07 0:21 
QuestionHow it works?? Pin
Ibrahim Dwaikat28-Oct-07 10:22
memberIbrahim Dwaikat28-Oct-07 10:22 
AnswerRe: How it works?? Pin
j_morton28-Oct-07 10:29
memberj_morton28-Oct-07 10:29 
GeneralRe: How it works?? Pin
Ibrahim Dwaikat28-Oct-07 10:34
memberIbrahim Dwaikat28-Oct-07 10:34 
GeneralRe: How it works?? Pin
firmwaredsp31-Oct-07 23:47
memberfirmwaredsp31-Oct-07 23:47 
GeneralRe: How it works?? Pin
Jeff Morton28-Nov-07 4:44
memberJeff Morton28-Nov-07 4:44 
GeneralVery nice Pin
blackjack215023-Oct-07 2:01
memberblackjack215023-Oct-07 2:01 
QuestionHow To Get Frequency, or Period of the Wave? Pin
Paul Chin PC29-Sep-07 5:45
memberPaul Chin PC29-Sep-07 5:45 
QuestionDoesn't work :( Pin
Vladimir Grankovsky27-Aug-07 2:39
memberVladimir Grankovsky27-Aug-07 2:39 
AnswerRe: Doesn't work :( Pin
JeffMorton28-Aug-07 8:08
memberJeffMorton28-Aug-07 8:08 
GeneralRe: Doesn't work :( [modified] Pin
meliton gavia8-Jan-09 18:08
membermeliton gavia8-Jan-09 18:08 
AnswerRe: Doesn't work :( Pin
ajgreen198723-Jul-09 6:36
memberajgreen198723-Jul-09 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 15 Aug 2007
Article Copyright 2007 by Jeff Morton
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid