| 1 |
|
| 2 |
<refentry id="UtilityAtsa"> |
| 3 |
<refentryinfo><title>Utilities</title></refentryinfo> |
| 4 |
<refmeta> |
| 5 |
<refentrytitle>atsa</refentrytitle> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname>atsa</refname> |
| 10 |
<refpurpose> |
| 11 |
Performs ATS analysis on a soundfile. |
| 12 |
<indexterm id="IndexAtsa"><primary>atsa</primary></indexterm> |
| 13 |
</refpurpose> |
| 14 |
</refnamediv> |
| 15 |
|
| 16 |
<refsect1> |
| 17 |
<title>Description</title> |
| 18 |
<para> |
| 19 |
ATS analysis for use with the Csound <link |
| 20 |
linkend="SpectralATS"><citetitle>ATS Resynthesis</citetitle></link> opcodes. |
| 21 |
</para> |
| 22 |
</refsect1> |
| 23 |
|
| 24 |
<refsect1> |
| 25 |
<title>Syntax</title> |
| 26 |
<synopsis><command>csound -U atsa</command> [flags] infilename outfilename</synopsis> |
| 27 |
|
| 28 |
|
| 29 |
</refsect1> |
| 30 |
<refsect1> |
| 31 |
<title>Initialization</title> |
| 32 |
<para> |
| 33 |
The following flags can be set for atsa (The default values are |
| 34 |
stated in parenthesis): |
| 35 |
<simplelist type='horiz'> |
| 36 |
<member>-b start (0.000000 seconds)</member> |
| 37 |
<member>-e duration (0.000000 seconds or end)</member> |
| 38 |
<member>-l lowest frequency (20.000000 Hertz)</member> |
| 39 |
<member>-H highest frequency (20000.000000 Hertz)</member> |
| 40 |
<member>-d frequency deviation (0.100000 of partial freq.)</member> |
| 41 |
<member>-c window cycles (4 cycles)</member> |
| 42 |
<member>-w window type (type: 1) (Options: 0=BLACKMAN, 1=BLACKMAN_H, 2=HAMMING, 3=VONHANN)</member> |
| 43 |
<member>-h hop size (0.250000 of window size)</member> |
| 44 |
<member>-m lowest magnitude (-60.000000)</member> |
| 45 |
<member>-t track length (3 frames)</member> |
| 46 |
<member>-s min. segment length (3 frames)</member> |
| 47 |
<member>-g min. gap length (3 frames)</member> |
| 48 |
<member>-T SMR threshold (30.000000 dB SPL)</member> |
| 49 |
<member>-S min. segment SMR (60.000000 dB SPL)</member> |
| 50 |
<member>-P last peak contribution (0.000000 of last peak's parameters)</member> |
| 51 |
<member>-M SMR contribution (0.500000)</member> |
| 52 |
<member>-F File Type (type: 4) (Options: 1=amp.and freq. only, |
| 53 |
2=amp.,freq. and phase, 3=amp.,freq. and residual, |
| 54 |
4=amp.,freq.,phase, and residual)</member> |
| 55 |
</simplelist> |
| 56 |
</para> |
| 57 |
</refsect1> |
| 58 |
|
| 59 |
<refsect1> |
| 60 |
<title>Parameters</title> |
| 61 |
<para>ATS analysis was devised by Juan Pampin. For complete |
| 62 |
information on ATS visit: <ulink |
| 63 |
url="https://ccrma.stanford.edu/~juan/ATS_manual.html">https://ccrma.stanford.edu/~juan/ATS_manual.html</ulink>. |
| 64 |
</para> |
| 65 |
<para>Analysis parameters must be carefully tuned for the Analysis |
| 66 |
Algorithm (ATSA) to properly capture the nature of the signal to |
| 67 |
be analyzed. As there are a significant number of them, ATSH |
| 68 |
offers the possibility of Saving/Loading them in a Binary File |
| 69 |
carrying the extension "*.apf". The extension is not mandatory, |
| 70 |
but recommended. A brief explanation of each Analysis Parameters |
| 71 |
follows: |
| 72 |
</para> |
| 73 |
<orderedlist> |
| 74 |
<listitem><para>Start (secs.): the starting time of the analysis in seconds.</para> |
| 75 |
</listitem> |
| 76 |
<listitem><para>Duration (secs.): the duration time of the analysis in |
| 77 |
seconds. A zero means the whole duration of the input sound file.</para> |
| 78 |
</listitem> |
| 79 |
<listitem><para>Lowest Frequency (Hz.): this parameter will partially |
| 80 |
determine the size of the Analysis Window to be used. To compute |
| 81 |
the size of the Analysis Window, the period of the Lowest |
| 82 |
Frequency in samples (SR / LF) is multiplied by the number of |
| 83 |
cycles of it the user wants to fit in the Analysis Window (see |
| 84 |
parameter 6). This value is rounded to the next power of two to |
| 85 |
determine the size of the FFT for the analysis. The remaining |
| 86 |
samples are zero-padded. If the signal is a single, harmonic |
| 87 |
sound, then the value of the Lowest Frequency should be its |
| 88 |
fundamental frequency or a sub-harmonic of it. If it is not |
| 89 |
harmonic, then its lowest significant frequency component may be a |
| 90 |
good starting value.</para> |
| 91 |
</listitem> |
| 92 |
<listitem><para>Highest Frequency (Hz.): highest frequency to be taken |
| 93 |
into account for Peak Detection. Once it is determined that no |
| 94 |
relevant information is found beyond a certain frequency, the |
| 95 |
analysis may be faster and more accurate setting the Highest |
| 96 |
Frequency parameter to that value.</para> |
| 97 |
</listitem> |
| 98 |
<listitem><para>Frequency Deviation (Ratio): frequency deviation |
| 99 |
allowed for each peak in the Peak Continuation Algorithm, as a |
| 100 |
ratio of the frequency involved. For instance, considering a peak |
| 101 |
at 440 Hz and a Deviation of .1 will produce that the Peak |
| 102 |
Continuation Algorithm will only try to find candidates for its |
| 103 |
continuation between 396 and 484 Hz (10% above and below the |
| 104 |
frequency of the peak). A small value is likely to produce more |
| 105 |
trajectories whilst a large value will reduce them, but at the |
| 106 |
cost of rendering information difficult to be further processed.</para> |
| 107 |
</listitem> |
| 108 |
<listitem><para>Number of Cycles of Lowest Frequency to fit in |
| 109 |
Analysis Window: this will also partially determine the size of |
| 110 |
the Fourier Analysis Window to be used. See Parameter 3. For |
| 111 |
single harmonic signals, it is supposed to be more than one |
| 112 |
(typically 4).</para> |
| 113 |
</listitem> |
| 114 |
<listitem><para>Hop Size (Ratio): size of the gap between one Analysis |
| 115 |
Window and the next expressed as a ratio of the Window Size. For |
| 116 |
instance, a Hop Size value of .25 will "jump" by 512 samples |
| 117 |
(Windows will overlap for a 75% of their size). This parameter |
| 118 |
will also determine the size of the analysis frames |
| 119 |
obtained. Signals that change their spectra very fast (such as |
| 120 |
Speech sounds) may need a high frame rate in order to properly |
| 121 |
track their changes.</para> |
| 122 |
</listitem> |
| 123 |
<listitem><para>Amplitude Threshold (dB): the highest amplitude value |
| 124 |
to be taken into account for Peak Detection.</para> |
| 125 |
</listitem> |
| 126 |
<listitem><para>Window Type: the shape of the smoothing function to be |
| 127 |
used for the Fourier Analysis. There are four choices available at |
| 128 |
present: Blackman, Blackman-Harris, Von Hann, and Hanning. Precise |
| 129 |
specifications about them are easily found on D.S.P. bibliography.</para> |
| 130 |
</listitem> |
| 131 |
<listitem><para>Track Length (Frames): The Peak Continuation Algorithm |
| 132 |
will "look-back" by Length frames in order to do its job better, |
| 133 |
preventing frequency trajectories from curving too much and |
| 134 |
loosing stability. However, a large value for this parameter will |
| 135 |
slow down the analysis significantly.</para> |
| 136 |
</listitem> |
| 137 |
<listitem><para>Minimal Segment Length (Frames): once the analysis is |
| 138 |
done, the spectral data can be further "cleaned" up during |
| 139 |
post-processing. Trajectories shorter than this value are |
| 140 |
suppressed if their average SMR is below Minimal Segment SMR (see |
| 141 |
parameters 16 and 14). This might help to avoid non-relevant |
| 142 |
sudden changes while keeping a high frame rate, reducing also the |
| 143 |
number of intermittent sinusoids during synthesis.</para> |
| 144 |
</listitem> |
| 145 |
<listitem><para>Minimal Gap Length (Frames): as parameter 11, this one |
| 146 |
is also used to clean up the data during post-processing. In this |
| 147 |
case, gaps (zero amplitude values, i.e. theoretical "silence") |
| 148 |
longer than Length frames are filled up with amplitude/frequency |
| 149 |
values obtained by linear interpolation of the adjacent active |
| 150 |
frames. This parameter prevents sudden interruptions of stable |
| 151 |
trajectories while keeping a high frame rate.</para> |
| 152 |
</listitem> |
| 153 |
<listitem><para>SMR Threshold (dB SPL): also a post-processing |
| 154 |
parameter, the SMR Threshold is used to eliminate partials with |
| 155 |
low averages.</para> |
| 156 |
</listitem> |
| 157 |
<listitem><para>Minimal Segment SMR (dB SPL): this parameter is used |
| 158 |
in combination with parameter 11. Short segments with SMR average |
| 159 |
below this value will be removed during post-processing.</para> |
| 160 |
</listitem> |
| 161 |
<listitem><para>Last Peak Contribution (0 to 1): as explained in |
| 162 |
Parameter 10, the Peak Continuation Algorithm "looks-back" several |
| 163 |
number of frames to do its job better. This parameter will help to |
| 164 |
weight the contribution of the first precedent peak over the |
| 165 |
others. A zero value means that all precedent peaks (to the size |
| 166 |
of Parameter 10) are equally taken in account.</para> |
| 167 |
</listitem> |
| 168 |
<listitem><para>SMR Contribution (0 to 1): In addition to the |
| 169 |
proximity in frequency of the peaks, the ATS Peak Continuation |
| 170 |
Algorithm may use psycho-acoustic information (the |
| 171 |
Signal-to-Mask-Ratio, or SMR) to improve the perceptual |
| 172 |
results. This parameter indicates how much the SMR information is |
| 173 |
used during tracking. For instance, a value of .5 makes the Peak |
| 174 |
Continuation Algorithm to use a 50% of SMR information and a 50% |
| 175 |
of Frequency Proximity information to decide which is the best |
| 176 |
candidate to continue a sinusoidal track.</para> |
| 177 |
</listitem> |
| 178 |
</orderedlist> |
| 179 |
|
| 180 |
<note> |
| 181 |
<title>Note</title> |
| 182 |
<para> |
| 183 |
The soundfile file to analyze must be mono. Otherwise atsa will not work. |
| 184 |
</para> |
| 185 |
</note> |
| 186 |
</refsect1> |
| 187 |
|
| 188 |
<refsect1> |
| 189 |
<title>Examples</title> |
| 190 |
<para> |
| 191 |
The following command: |
| 192 |
|
| 193 |
<programlisting> |
| 194 |
<emphasis>atsa</emphasis> -b0.1 -e1 -l100 -H10000 -w2 audiofile.wav audiofile.ats</programlisting> |
| 195 |
|
| 196 |
Generates the ATS analysis file 'audiofile.ats' from the original 'audiofile.wav' file. It begins analysis from second 0.1 |
| 197 |
of the file and the analysis is performed for 1 second thereafter. The lowest frequency stored is 100 Hz and the highest |
| 198 |
is 10kHz. A Hamming window is used for each analysis frame. |
| 199 |
</para> |
| 200 |
<para> |
| 201 |
Here is an example of the atsa utility. It uses the file <ulink url="examples/atsa.csd"><citetitle>atsa.csd</citetitle></ulink>. |
| 202 |
|
| 203 |
<example> |
| 204 |
<title>Example of the atsa utility.</title> |
| 205 |
|
| 206 |
<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 207 |
<xi:include href="examples-xml/atsa.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 208 |
|
| 209 |
</example> |
| 210 |
</para> |
| 211 |
</refsect1> |
| 212 |
|
| 213 |
</refentry> |