📄 soundviewer.aspx.htm
字号:
<div class="MI" id="Section114"><a href="http://www.codeproject.com/KB/usability/">Usability</a></div>
</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=11" onclick="return ToggleMenu('Chapter11');">Development Lifecycle</a></div>
<div class="MenuSectionBlock" id="Chapter11" style="display: none;">
<div class="MI" id="Section51"><a href="http://www.codeproject.com/KB/debug/">Debug Tips</a></div>
<div class="MI" id="Section39"><a href="http://www.codeproject.com/KB/architecture/">Design and Architecture</a></div>
<div class="MI" id="Section112"><a href="http://www.codeproject.com/KB/install/">Installation</a></div>
<div class="MI" id="Section41"><a href="http://www.codeproject.com/KB/work/">Work Issues</a></div>
<div class="MI" id="Section126"><a href="http://www.codeproject.com/KB/codegen/">Code Generation</a></div>
</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=7" onclick="return ToggleMenu('Chapter7');">General Reading</a></div>
<div class="MenuSectionBlock" id="Chapter7" style="display: none;">
<div class="MI" id="Section60"><a href="http://www.codeproject.com/KB/books/">Book Chapters</a></div>
<div class="MI" id="Section61"><a href="http://www.codeproject.com/KB/book-reviews/">Book Reviews</a></div>
<div class="MI" id="Section109"><a href="http://www.codeproject.com/KB/hardware-review/">Hardware Reviews</a></div>
<div class="MI" id="Section63"><a href="http://www.codeproject.com/KB/interviews/">Interviews</a></div>
<div class="MI" id="Section62"><a href="http://www.codeproject.com/KB/scrapbook/">Scrapbook</a></div>
<div class="MI" id="Section48"><a href="http://www.codeproject.com/KB/system/">Hardware & System</a></div>
</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=12" onclick="return ToggleMenu('Chapter12');">Third Party Products</a></div>
<div class="MenuSectionBlock" id="Chapter12" style="display: none;">
<div class="MI" id="Section65"><a href="http://www.codeproject.com/KB/showcase/">Product Showcase</a></div>
<div class="MI" id="Section124"><a href="http://www.codeproject.com/KB/solution-center/">Solution Center</a></div>
</div>
</div>
<br>
<div class="MenuCat">Feature Zones</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/IBM">IBM DeveloperWorks</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/WhitePapers">WhitePapers</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/CodeGeneration">Code Generation</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/QuestSQL">Quest SQL Zone</a></div>
<br>
<iframe src="SoundViewer.aspx_files/ServeThirdParty_003.htm" scrolling="no" width="160" frameborder="0" height="600"></iframe>
<img src="SoundViewer.aspx_files/t.gif" alt="" width="160" height="1">
</td>
<td class="ArticlePane" valign="top">
<table class="SearchHeaderBar" width="100%" cellspacing="0">
<tbody><tr>
<td style="white-space: nowrap; width: 60%;" valign="middle" align="right">
<form method="get" action="/info/search.aspx" name="Search" style="margin: 0pt;">
<b>Search </b>
<input class="SmallText" name="artkw" style="width: 200px;">
<select class="SmallText" style="font-weight: bold;" name="sbo">
<option value="kw">Articles</option>
<!--<option value="au">Authors</option>-->
<option value="fm">Messages</option>
</select>
<input class="SmallText" style="font-weight: bold;" value=" Go! " type="submit">
</form>
</td>
<td class="TinyText" style="white-space: nowrap;">
<a href="http://www.codeproject.com/info/search.aspx">Advanced Search</a><br>
<a href="http://www.codeproject.com/script/Content/SiteMap.aspx">Sitemap</a>
</td>
</tr>
</tbody></table>
<span id="ctl00_ResultMessage"></span>
<div id="ctl00_ArtDiv">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody><tr valign="top">
<td valign="top">
<table>
</table>
<div class="SmallText" style="white-space: nowrap;">
<img src="SoundViewer.aspx_files/print.gif" alt="print" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_PrintLnk" href="http://www.codeproject.com/KB/audio-video/SoundViewer.aspx?display=Print">Print</a>
<img src="SoundViewer.aspx_files/report.gif" alt="Broken Article?" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_BrokenLnk" href="http://www.codeproject.com/script/Articles/Report.aspx?aid=20025">Report Article</a>
<img src="SoundViewer.aspx_files/discuss.gif" alt="Discuss" style="vertical-align: middle;" width="15" height="16">
<a href="#_comments">Discuss</a>
<img src="SoundViewer.aspx_files/mail.gif" alt="Recommend Article" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_Recommend" href="http://www.codeproject.com/script/common/TellFriend.aspx?obtid=2&obid=20025">Send to a friend</a>
</div>
</td>
<td style="text-align: right; white-space: nowrap; width: 100px;">
<table id="CurRat"><tbody><tr><td>
<table><tbody><tr>
<td style="white-space: nowrap;" class="SmallText" align="right">
<span id="ctl00_ArticleRating_VoteLabel">14 votes for this Article.</span></td>
<td><table border="1" cellpadding="0" cellspacing="0">
<tbody><tr>
<td width="20" bgcolor="White" height="7"><img src="SoundViewer.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
<td width="20" bgcolor="White" height="7"><img src="SoundViewer.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
<td width="20" bgcolor="White" height="7"><img src="SoundViewer.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
<td width="20" bgcolor="White" height="7"><img src="SoundViewer.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
<td width="20" bgcolor="White" height="7" nowrap="nowrap"><img src="SoundViewer.aspx_files/red.gif" width="17" align="center" border="0" height="7"></td>
</tr>
</tbody></table>
</td>
</tr>
<tr id="ctl00_ArticleRating_PopularityRow">
<td colspan="2" class="SmallText" align="right">
<a id="ctl00_ArticleRating_PopularityLnk" title="Calculated as rating x Log10(# votes)" href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=1">Popularity: 5.56</a>
<span id="ctl00_ArticleRating_PopularityLbl"></span><span id="ratingVal">Rating: <b>4.85</b> out of 5</span></td>
</tr>
</tbody></table>
</td>
<td>
<div>
<table class="HistTable" title="Voting Distribution. Recent data only"><tbody><tr><td><img src="SoundViewer.aspx_files/t.htm" alt="0 votes, 0.0%" title="0 votes, 0.0%" width="10" border="0" height="1"><br>1</td>
<td><img src="SoundViewer.aspx_files/t.htm" alt="0 votes, 0.0%" title="0 votes, 0.0%" width="10" border="0" height="1"><br>2</td>
<td><img src="SoundViewer.aspx_files/t.htm" alt="0 votes, 0.0%" title="0 votes, 0.0%" width="10" border="0" height="1"><br>3</td>
<td><img src="SoundViewer.aspx_files/pollcol.gif" alt="2 votes, 14.3%" title="2 votes, 14.3%" width="10" border="0" height="3"><br>4</td>
<td><img src="SoundViewer.aspx_files/pollcol.gif" alt="12 votes, 85.7%" title="12 votes, 85.7%" width="10" border="0" height="20"><br>5</td>
</tr></tbody></table>
</div>
</td></tr></tbody></table>
</td>
</tr>
</tbody></table>
<span id="intelliTXT">
<div id="contentdiv">
<!-- Main Page Contents Start -->
<!-- Article Starts -->
<ul class="download">
<li><a href="http://www.codeproject.com/KB/audio-video/SoundViewer/SoundViewer.zip">Download demo project - 28.6 KB</a> </li>
<li><a href="http://www.codeproject.com/KB/audio-video/SoundViewer/SoundViewerSource.zip">Download source files - 27.6 KB</a> </li>
</ul>
<img alt="Screenshot - SoundViewer.jpg" src="SoundViewer.aspx_files/SoundViewer.jpg" width="598" border="0" height="645">
<h2>Introduction</h2>
<p>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.</p>
<h2>Background</h2>
<p>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.</p>
<h2>Using the Code</h2>
<p>Audio input for this demonstration is provided by the <code>Wave</code> classes developed by Ianier Munoz. <code>Wave</code> samples are further processed using the <code>AudioFrame</code> class.</p>
<pre lang="cs"><span class="code-keyword">class</span> AudioFrame
{
<span class="code-keyword">private</span> Bitmap _canvasTimeDomain;
<span class="code-keyword">private</span> Bitmap _canvasFrequencyDomain;
<span class="code-keyword">private</span> <span class="code-keyword">double</span>[] _waveLeft;
<span class="code-keyword">private</span> <span class="code-keyword">double</span>[] _waveRight;
<span class="code-keyword">private</span> <span class="code-keyword">double</span>[] _fftLeft;
<span class="code-keyword">private</span> <span class="code-keyword">double</span>[] _fftRight;
<span class="code-keyword">private</span> SignalGenerator _signalGenerator;
<span class="code-keyword">private</span> <span class="code-keyword">bool</span> _isTest = <span class="code-keyword">false</span>;
<span class="code-keyword">public</span> AudioFrame(<span class="code-keyword">bool</span> isTest)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -