/usr/share/doc/libaudiomask-dev/API-libaudiomask/AudioMaskerExample.cpp-example.html is in libaudiomask-dev 1.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | <!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libaudiomask: AudioMaskerExample.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<img id="MSearchSelect" src="search/search.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</div>
</li>
</ul>
</div>
</div>
<div class="contents">
<h1>AudioMaskerExample.cpp</h1><p>This is an example of how to use the <a class="el" href="classAudioMasker.html">AudioMasker</a> class See the example file to work out how to use these Audio masking classes</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include <math.h></span>
<span class="preprocessor">#include "AudioMasker.H"</span>
<span class="preprocessor">#define INPUTFILENAME "audio.44100.txt"</span>
<span class="preprocessor"></span><span class="preprocessor">#define TMASKFILENAME "fa.t.mask"</span>
<span class="preprocessor"></span><span class="preprocessor">#define POWFILENAME "fa.pow"</span>
<span class="preprocessor"></span><span class="preprocessor">#define EXCITEFILENAME "fa.excite"</span>
<span class="preprocessor"></span><span class="preprocessor">#define THRESHFILENAME "thresh.dat"</span>
<span class="preprocessor"></span><span class="preprocessor">#include <fstream></span>
<span class="keywordtype">int</span> main(<span class="keywordtype">void</span>){
<span class="keywordtype">int</span> sampleCount=1024, halfSampleCount=(int)rint((<span class="keywordtype">double</span>)sampleCount/2.0);
<span class="keywordtype">int</span> count=50, sampleFreq=44100;
<span class="keywordtype">int</span> skip=8192-sampleCount-1;
<span class="keywordtype">double</span> input[sampleCount];
ifstream inputF(INPUTFILENAME);
<span class="keywordtype">int</span> temp;
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<skip;i++)
inputF >> temp >> input[0];
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<sampleCount;i++)
inputF >> temp >> input[i];
inputF.close();
ofstream outputCF(<span class="stringliteral">"cf.dat"</span>);
ofstream outputT(TMASKFILENAME);
ofstream outputP(POWFILENAME);
<span class="comment">// Get our masking function ...</span>
<a name="_a0"></a><a class="code" href="classAudioMasker.html">AudioMasker</a> masker(sampleFreq, count);
<a class="code" href="classAudioMasker.html">AudioMasker</a> masker1(sampleFreq, count);
<a class="code" href="classAudioMasker.html">AudioMasker</a> masker2(sampleFreq, count);
<span class="comment">//AudioMasker masker; // Can also be called like so with default filter banks and sampleFrequency</span>
masker.<a name="a1"></a><a class="code" href="classAudioMasker.html#ae7182941513eab5853dc65ebe03e0529">excite</a>(input, sampleCount);
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j<count;j++){
outputCF <<masker.<a name="a2"></a><a class="code" href="classAudioMasker.html#a5fcc150b323bb9e75a99b4f81fc4d689" title="roex filters">pfb</a>-><a name="a3"></a><a class="code" href="classDepUKFB.html#ad0783de52b1d2ab777484d344e566514" title="The filter centre frequencies.">cf</a>[j]*((double)sampleCount/(<span class="keywordtype">double</span>)sampleFreq)<<<span class="charliteral">'\t'</span>;
outputT << 20*log10(masker.<a name="a4"></a><a class="code" href="classAudioMask.html#ad8c88f5ec9efdeed95affa6c23d25417" title="The audio mask.">mask</a>[j])<<<span class="charliteral">'\t'</span>;
}
outputCF<<endl;
outputT<<endl;
realFFTData fftData(sampleCount);
realFFT fft(&fftData);
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j<sampleCount;j++)
fftData.in[j]=input[j];
fft.fwdTransform();
fftData.compPowerSpec();
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j<sampleCount/2;j++)
outputP<<20*log10(sqrt(fftData.power_spectrum[j]))<<<span class="charliteral">'\t'</span>;
outputP<<endl;
outputCF.close();
outputT.close();
outputP.close();
ofstream outputF(THRESHFILENAME);
<span class="keywordtype">double</span> fact=(double)sampleFreq/((<span class="keywordtype">double</span>)sampleCount-1.0);
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j<halfSampleCount;j++){
<span class="comment">// cout<<"finding for freq "<<j*fact<<'\t';</span>
outputF<<20*log10(masker.<a name="a5"></a><a class="code" href="classAudioMasker.html#a13dd56b43780b2e45199c449866f5616">findThreshold</a>(j*fact))<<<span class="charliteral">'\t'</span>;
}
outputF<<endl;
outputF.close();
}
</pre></div> </div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Sun Jun 6 21:25:14 2010 for libaudiomask by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
|