Click here to Skip to main content
11,634,568 members (74,966 online)
Click here to Skip to main content

Sound visualizer in C#

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

Introduction

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.

Background

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>
</span>

License

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

Share

About the Author

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

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
Metafunken3-Mar-15 2:13
memberMetafunken3-Mar-15 2:13 
GeneralRe: My vote of 1 Pin
Member 1150355227-May-15 4:58
memberMember 1150355227-May-15 4:58 
Questionis y axis desibel or amplitude ? Pin
Member 1041172813-Oct-14 1:37
memberMember 1041172813-Oct-14 1:37 
Questionhow to open an existing wav file Pin
Member 228177120-Nov-13 11:12
memberMember 228177120-Nov-13 11:12 
GeneralMy vote of 5 Pin
Gun Gun Febrianza28-Aug-13 12:35
member Gun Gun Febrianza28-Aug-13 12:35 
QuestionNullReferenceException occured Pin
MA_hosseini28-Feb-13 0:53
memberMA_hosseini28-Feb-13 0:53 
AnswerRe: NullReferenceException occured Pin
k0ennn28-Feb-13 22:51
memberk0ennn28-Feb-13 22:51 
AnswerRe: NullReferenceException occured Pin
James Melkon Smith2-Mar-13 7:34
memberJames Melkon Smith2-Mar-13 7:34 
GeneralRe: NullReferenceException occured Pin
Gettor900011-Apr-13 23:42
memberGettor900011-Apr-13 23:42 
GeneralMy vote of 5 Pin
sanosay9-Aug-12 3:09
membersanosay9-Aug-12 3:09 
QuestionProblems with Windows 7 Pin
valeriopini13-Mar-12 0:51
membervaleriopini13-Mar-12 0:51 
GeneralMy vote of 1 Pin
rrossenbg12-Jan-12 5:33
memberrrossenbg12-Jan-12 5:33 
GeneralRe: My vote of 1 Pin
sanosay9-Aug-12 3:08
membersanosay9-Aug-12 3:08 
Questionwhat are the values representing in arrays? [modified] Pin
D__I___O31-Aug-11 0:11
memberD__I___O31-Aug-11 0:11 
Questionis this code possible to save as Wav or MP3 File after recording process Pin
myatthu198617-Aug-11 23:37
membermyatthu198617-Aug-11 23:37 
GeneralMy vote of 5 Pin
AlexB4715-Jun-11 23:02
memberAlexB4715-Jun-11 23:02 
Generali want to convert it into WPF Pin
vishal_h18-May-11 23:21
membervishal_h18-May-11 23:21 
i want to create same application in WPF then what i have to do..can any one tell me..i used image control for picture box..but its giving me error like .....
Connvert from 'ref System.Windows.Controls.Image' to 'ref System.Drawing.Image'
please any one can give me some input..
GeneralProb with the frequency domain Pin
joeblogg6-Jan-11 8:03
memberjoeblogg6-Jan-11 8:03 
GeneralRe: Prob with the frequency domain Pin
Piligrim200729-Jan-11 5:31
memberPiligrim200729-Jan-11 5:31 
QuestionHow to get the frequency in real-time? Pin
gmajkun22-Dec-10 19:54
groupgmajkun22-Dec-10 19:54 
AnswerRe: How to get the frequency in real-time? Pin
Piligrim200729-Jan-11 5:37
memberPiligrim200729-Jan-11 5:37 
GeneralMy vote of 5 Pin
Dennis Betten3-Nov-10 1:41
memberDennis Betten3-Nov-10 1:41 
GeneralError Pin
dreje20105-Oct-10 23:53
memberdreje20105-Oct-10 23:53 
QuestionDoes this analyse the code with in milisecond accurancy? Pin
Rahdu15-Sep-10 9:50
memberRahdu15-Sep-10 9:50 
GeneralDetect Peak on single channel Pin
survcopt5-Mar-10 3:47
membersurvcopt5-Mar-10 3:47 
Questionhow can I determine the sound level without waveFormat ? Pin
fasialkk24-Feb-10 13:44
memberfasialkk24-Feb-10 13:44 
QuestionHow To Open Recorded Wav File Pin
TV Mogul14-Jan-10 2:38
memberTV Mogul14-Jan-10 2:38 
Generalimportant reguest Pin
seka2087-Dec-09 22:04
memberseka2087-Dec-09 22:04 
QuestionDoes not work in Windows 7 (64bit) Why? Pin
a.mueller2-Dec-09 5:31
membera.mueller2-Dec-09 5:31 
AnswerRe: Does not work in Windows 7 (64bit) Why? Pin
eweewf15-Feb-10 8:42
membereweewf15-Feb-10 8:42 
QuestionIs this available in VB.NET? Pin
Simon Williamson2-Apr-09 1:21
memberSimon Williamson2-Apr-09 1:21 
GeneralMedia file Pin
Babgi26-Mar-09 9:19
memberBabgi26-Mar-09 9:19 
GeneralRe: Media file Pin
gamosemalaka30-May-09 22:00
membergamosemalaka30-May-09 22:00 
GeneralRe: Media file Pin
diogopms27-Jun-09 15:37
memberdiogopms27-Jun-09 15:37 
GeneralRe: Media file Pin
Ankur Dukare11-Mar-10 22:34
memberAnkur Dukare11-Mar-10 22:34 
GeneralRe: Media file Pin
gerardo_00115-Mar-10 8:15
membergerardo_00115-Mar-10 8:15 
QuestionWhere is the Documentation? Pin
Member 603819619-Mar-09 7:37
memberMember 603819619-Mar-09 7:37 
QuestionaudioFrameSize in waveformat correct ? Pin
radio_gaga8-Mar-09 8:16
memberradio_gaga8-Mar-09 8:16 
AnswerRe: audioFrameSize in waveformat correct ? Pin
Jeff Morton8-Mar-09 9:59
memberJeff Morton8-Mar-09 9:59 
GeneralIt won't work on desktop PC Pin
max_99014-Feb-09 0:15
membermax_99014-Feb-09 0:15 
QuestionInput delays Pin
Joe Wright1-Sep-08 7:12
memberJoe Wright1-Sep-08 7:12 
AnswerRe: Input delays Pin
Jeff Morton1-Sep-08 12:45
memberJeff Morton1-Sep-08 12:45 
GeneralIt works! Pin
Member 470880128-Aug-08 21:08
memberMember 470880128-Aug-08 21:08 
GeneralShutdown addition Pin
firmwaredsp31-Oct-07 22:26
memberfirmwaredsp31-Oct-07 22:26 
GeneralRe: Shutdown addition Pin
Ri Qen-Sin20-Nov-07 17:39
memberRi Qen-Sin20-Nov-07 17:39 
GeneralRe: Shutdown addition Pin
Jeff Morton27-Nov-07 2:57
memberJeff Morton27-Nov-07 2:57 
GeneralRe: Shutdown addition Pin
firmwaredsp27-Nov-07 23:21
memberfirmwaredsp27-Nov-07 23:21 
QuestionHow it works?? Pin
Ibrahim Dwaikat28-Oct-07 9:22
memberIbrahim Dwaikat28-Oct-07 9:22 
AnswerRe: How it works?? Pin
j_morton28-Oct-07 9:29
memberj_morton28-Oct-07 9:29 
GeneralRe: How it works?? Pin
Ibrahim Dwaikat28-Oct-07 9:34
memberIbrahim Dwaikat28-Oct-07 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web01 | 2.8.150728.1 | Last Updated 15 Aug 2007
Article Copyright 2007 by Jeff Morton
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid