This file is indexed.

/usr/share/doc/libaudiomask-dev/API-libaudiomask/AudioMaskerExample.cc-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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!-- 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.cc</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&nbsp;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.cc</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="comment">/*</span>
<span class="comment">* </span>
<span class="comment">* This example shows how to use Dr M.R. Flax&#39;s (2000) hybrid</span>
<span class="comment">* simultaneous audio masking class to find the masking threshold of a time domain signal.</span>
<span class="comment">* </span>
<span class="comment">* The compilation of this file is demonstrated in Makefile.</span>
<span class="comment">* Run this file : ./AudioMaskerExample</span>
<span class="comment">* View the results of this file using www.octave.org by running the script view.m</span>
<span class="comment">* - simply type view once octave has started and you are in the suitable directory.</span>
<span class="comment">* </span>
<span class="comment">* The input audio should be stored in the file INPUTFILENAME in text format - each sample seperated by a * white space.</span>
<span class="comment">* </span>
<span class="comment">* ========================= HOWTO ===============================</span>
<span class="comment">* \code</span>
<span class="comment">*     // First find the masking threshold</span>
<span class="comment">*     AudioMasker masker(sampleFreq, count); // Create the audio masker class using fs=sampleFreq and count filters</span>
<span class="comment">*     masker.excite(input, sampleCount); // find the mask for the array of input data which has sampleCount time samples.</span>
<span class="comment">* </span>
<span class="comment">*     // Now do something with the masking threshold ...</span>
<span class="comment">* </span>
<span class="comment">*     // The frequency domain mask is now located here</span>
<span class="comment">*     for (int j=0; j&lt;count;j++)</span>
<span class="comment">*         masker.mask[j]; // This is the mask at each of the count frequencies of interest</span>
<span class="comment">* </span>
<span class="comment">*     // A more sophisticated example - find the threshold for each Fourier bin</span>
<span class="comment">*     double fact=(double)sampleFreq/((double)sampleCount-1.0); // convert from an index to the equivalent * Fourier bin frequency</span>
<span class="comment">*     for (int j=0; j&lt;halfSampleCount;j++){</span>
<span class="comment">*         cout&lt;&lt;&quot;finding for freq &quot;&lt;&lt;j*fact&lt;&lt;&#39;\t&#39;; // The frequency we are inspecting</span>
<span class="comment">*         double threshold=masker.findThreshold(j*fact); // The masking threshold</span>
<span class="comment">*         20*log10(threshold); // The threshold in decibels (dB)</span>
<span class="comment">*     }</span>
<span class="comment">* </span>
<span class="comment">* \endcode</span>
<span class="comment">*   // The following example calculates the spectral power and the masking threshold for each Fourier bin of interest ...</span>
<span class="comment">*/</span>

<span class="preprocessor">#include &lt;math.h&gt;</span>
<span class="preprocessor">#include &quot;AudioMasker.H&quot;</span>

<span class="preprocessor">#define INPUTFILENAME &quot;audio.44100.txt&quot; // input file - text written samples seperated by white spaces</span>
<span class="preprocessor"></span><span class="preprocessor">#define POWFILENAME &quot;fa.pow&quot; // The power spectrum of the input signal</span>
<span class="preprocessor"></span><span class="preprocessor">#define THRESHFILENAME &quot;thresh.dat&quot; // The masking threshold at each frequency of the input signal</span>
<span class="preprocessor"></span><span class="preprocessor">#define TMASKFILENAME &quot;fa.t.mask&quot; // The masking threshold for each filter CF</span>
<span class="preprocessor"></span><span class="preprocessor">#define EXCITEFILENAME &quot;fa.excite&quot; // The excitation</span>
<span class="preprocessor"></span><span class="preprocessor">#include &lt;fstream&gt;</span>

<span class="keywordtype">int</span> main(<span class="keywordtype">void</span>){

    <span class="comment">// Setup many variables</span>
    <span class="comment">// The number of time domain samples</span>
  <span class="keywordtype">int</span> sampleCount=1024, halfSampleCount=(int)rint((<span class="keywordtype">double</span>)sampleCount/2.0);
  <span class="comment">// The filter bank count and sample frequency</span>
  <span class="keywordtype">int</span> count=50, sampleFreq=44100;
  <span class="comment">// The number of time domain samples to skip before the sample of interest.</span>
  <span class="keywordtype">int</span> skip=8192-sampleCount-1;
  <span class="comment">// The input array to hold the input time data</span>
  <span class="keywordtype">double</span> input[sampleCount];

  <span class="comment">// open the input file</span>
  ifstream inputF(INPUTFILENAME);

  <span class="comment">// Skip the first 2*&#39;skip&#39; samples.</span>
  <span class="keywordtype">int</span> temp;
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;skip;i++)
    inputF &gt;&gt; temp &gt;&gt; input[0];

    <span class="comment">// load sampleCount samples as the input to the algorithm</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;sampleCount;i++)
    inputF &gt;&gt; input[i];
  inputF.close();

  ofstream outputCF(<span class="stringliteral">&quot;cf.dat&quot;</span>); <span class="comment">// central freq. output file</span>
  ofstream outputT(TMASKFILENAME);
  ofstream outputP(POWFILENAME); <span class="comment">// Input data Fourier power file</span>

  <span class="comment">// Get our masking function (class) ...</span>
  <a name="_a0"></a><a class="code" href="classAudioMasker.html">AudioMasker</a> masker(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="comment">// find the mask</span>

  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;count;j++){ <span class="comment">// Output the central freq to file</span>
    outputCF &lt;&lt;masker.<a name="a2"></a><a class="code" href="classAudioMasker.html#a5fcc150b323bb9e75a99b4f81fc4d689" title="roex filters">pfb</a>-&gt;<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)&lt;&lt;<span class="charliteral">&#39;\t&#39;</span>;
    outputT  &lt;&lt; 20*log10(masker.<a name="a4"></a><a class="code" href="classAudioMask.html#ad8c88f5ec9efdeed95affa6c23d25417" title="The audio mask.">mask</a>[j])&lt;&lt;<span class="charliteral">&#39;\t&#39;</span>; <span class="comment">// output the mask for each filter CF to file</span>
  }
  outputCF&lt;&lt;endl;
  outputT&lt;&lt;endl;

  realFFTData fftData(sampleCount); <span class="comment">// Find the fourier transform for the output of the power to file</span>
  realFFT fft(&amp;fftData); <span class="comment">// init the Fourier transform</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;sampleCount;j++) <span class="comment">// load the time domain input to the Fourier transform</span>
    fftData.in[j]=input[j];
  fft.fwdTransform(); <span class="comment">// Perform the transformation of the time domain to the frequency domain.</span>
  fftData.compPowerSpec(); <span class="comment">// Find the power spectrum</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;sampleCount/2;j++) <span class="comment">// Output the power spectrum to file</span>
    outputP&lt;&lt;20*log10(sqrt(fftData.power_spectrum[j]))&lt;&lt;<span class="charliteral">&#39;\t&#39;</span>;
  outputP&lt;&lt;endl;

  outputCF.close();
  outputT.close();
  outputP.close();

  ofstream outputF(THRESHFILENAME); <span class="comment">// Find and output the masking threshold for each Fourier bin in the power spectrum</span>
  <span class="keywordtype">double</span> fact=(double)sampleFreq/((<span class="keywordtype">double</span>)sampleCount-1.0); <span class="comment">// convert from an index to the equivalent Fourier bin frequency</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;halfSampleCount;j++){
    <span class="comment">//    cout&lt;&lt;&quot;finding for freq &quot;&lt;&lt;j*fact&lt;&lt;&#39;\t&#39;;</span>
    outputF&lt;&lt;20*log10(masker.<a name="a5"></a><a class="code" href="classAudioMasker.html#a13dd56b43780b2e45199c449866f5616">findThreshold</a>(j*fact))&lt;&lt;<span class="charliteral">&#39;\t&#39;</span>;
  }
  outputF&lt;&lt;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">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</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 Sat Jun 19 15:23:29 2010 for libaudiomask by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>