| 1 |
|
| 2 |
<refentry id="hetro"> |
| 3 |
<refentryinfo><title>Utilities</title></refentryinfo> |
| 4 |
<refmeta> |
| 5 |
<refentrytitle>hetro</refentrytitle> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname>hetro</refname> |
| 10 |
<refpurpose> |
| 11 |
Decomposes an input soundfile into component sinusoids. |
| 12 |
<indexterm id="IndexHetro"><primary>hetro</primary></indexterm> |
| 13 |
</refpurpose> |
| 14 |
</refnamediv> |
| 15 |
|
| 16 |
<refsect1> |
| 17 |
<title>Description</title> |
| 18 |
<para> |
| 19 |
Hetrodyne filter analysis for the Csound <link linkend="adsyn"><citetitle>adsyn</citetitle></link> generator. |
| 20 |
</para> |
| 21 |
</refsect1> |
| 22 |
|
| 23 |
<refsect1> |
| 24 |
<title>Syntax</title> |
| 25 |
<synopsis><command>csound -U hetro</command> [flags] infilename outfilename</synopsis> |
| 26 |
|
| 27 |
<synopsis><command>hetro</command> [flags] infilename outfilename</synopsis> |
| 28 |
</refsect1> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Initialization</title> |
| 32 |
<para> |
| 33 |
<emphasis>hetro</emphasis> takes an input soundfile, decomposes it into component sinusoids, and outputs a description of the components in the form of breakpoint amplitude and frequency tracks. Analysis is conditioned by the control flags below. A space is optional between flag and value. |
| 34 |
</para> |
| 35 |
|
| 36 |
<para> |
| 37 |
<emphasis>-s srate</emphasis> -- sampling rate of the audio input file. This will over-ride the srate of the soundfile header, which otherwise applies. If neither is present, the default is 10000. Note that for <emphasis>adsyn</emphasis> synthesis the srate of the source file and the generating orchestra need not be the same. |
| 38 |
</para> |
| 39 |
|
| 40 |
<para> |
| 41 |
<emphasis>-c channel</emphasis> -- channel number sought. The default is 1. |
| 42 |
</para> |
| 43 |
|
| 44 |
<para> |
| 45 |
<emphasis>-b begin</emphasis> -- beginning time (in seconds) of the audio segment to be analyzed. The default is 0.0 |
| 46 |
</para> |
| 47 |
|
| 48 |
<para> |
| 49 |
<emphasis>-d duration</emphasis> -- duration (in seconds) of the audio segment to be analyzed. The default of 0.0 means to the end of the file. Maximum length is 32.766 seconds. |
| 50 |
</para> |
| 51 |
|
| 52 |
<para> |
| 53 |
<emphasis>-f begfreq</emphasis> -- estimated starting frequency of the fundamental, necessary to initialize the filter analysis. The default is 100 (cps). |
| 54 |
</para> |
| 55 |
|
| 56 |
<para> |
| 57 |
<emphasis>-h partials</emphasis> -- number of harmonic partials sought in the audio file. Default is 10, maximum is a function of memory available. |
| 58 |
</para> |
| 59 |
|
| 60 |
<para> |
| 61 |
<emphasis>-M maxamp</emphasis> -- maximum amplitude summed across all concurrent tracks. The default is 32767. |
| 62 |
</para> |
| 63 |
|
| 64 |
<para> |
| 65 |
<emphasis>-m minamp</emphasis> -- amplitude threshold below which a single pair of amplitude/frequency tracks is considered dormant and will not contribute to output summation. Typical values: 128 (48 db down from full scale), 64 (54 db down), 32 (60 db down), 0 (no thresholding). The default threshold is 64 (54 db down). |
| 66 |
</para> |
| 67 |
|
| 68 |
<para> |
| 69 |
<emphasis>-n brkpts</emphasis> -- initial number of analysis |
| 70 |
breakpoints in each amplitude and frequency track, prior to |
| 71 |
thresholding (<emphasis>-m</emphasis>) and linear breakpoint |
| 72 |
consolidation. The initial points are spread evenly over the |
| 73 |
duration. The default is 256. |
| 74 |
</para> |
| 75 |
|
| 76 |
<para> |
| 77 |
<emphasis>-l cutfreq</emphasis> -- substitute a 3rd order |
| 78 |
Butterworth low-pass filter with cutoff frequency |
| 79 |
<emphasis>cutfreq</emphasis> (in Hz), in place of the default |
| 80 |
averaging comb filter. The default is 0 (don't use). |
| 81 |
</para> |
| 82 |
</refsect1> |
| 83 |
|
| 84 |
<refsect1> |
| 85 |
<title>Performance</title> |
| 86 |
<para> |
| 87 |
As of Csound 4.08, <emphasis>hetro</emphasis> can write SDIF |
| 88 |
output files if the output file name ends with |
| 89 |
".sdif" or ".SDIF". See the <link |
| 90 |
linkend="sdif2ad"><citetitle>sdif2ad utility</citetitle></link> |
| 91 |
for more information about the Csound's SDIF support. |
| 92 |
</para> |
| 93 |
</refsect1> |
| 94 |
|
| 95 |
<refsect1> |
| 96 |
|
| 97 |
<refsect2 id="HetroFileFormat"> |
| 98 |
<title>File Format</title> |
| 99 |
<para> |
| 100 |
The output file contains time-sequenced amplitude and |
| 101 |
frequency values for each partial of an additive complex audio |
| 102 |
source. The information is in the form of breakpoints (time, |
| 103 |
value, time, value, ....) using 16-bit integers in the range 0 - |
| 104 |
32767. Time is given in milliseconds, and frequency in Hertz |
| 105 |
(cps). The breakpoint data is exclusively non-negative, and the |
| 106 |
values -1 and -2 uniquely signify the start of new amplitude and |
| 107 |
frequency tracks. A track is terminated by the value |
| 108 |
32767. Before being written out, each track is data-reduced by |
| 109 |
amplitude thresholding and linear breakpoint consolidation. |
| 110 |
</para> |
| 111 |
|
| 112 |
<para> |
| 113 |
A component partial is defined by two breakpoint sets: an |
| 114 |
amplitude set, and a frequency set. Within a composite file |
| 115 |
these sets may appear in any order (amplitude, frequency, |
| 116 |
amplitude ....; or amplitude, amplitude..., then frequency, |
| 117 |
frequency,...). During <link |
| 118 |
linkend="adsyn"><citetitle>adsyn</citetitle></link> resynthesis |
| 119 |
the sets are automatically paired (amplitude, frequency) from |
| 120 |
the order in which they were found. There should be an equal |
| 121 |
number of each. |
| 122 |
</para> |
| 123 |
|
| 124 |
<para> |
| 125 |
A legal <emphasis>adsyn</emphasis> control file could have |
| 126 |
following format: |
| 127 |
<informalexample> |
| 128 |
<programlisting> |
| 129 |
-1 time1 value1 ... timeK valueK 32767 ; amplitude breakpoints for partial 1 |
| 130 |
-2 time1 value1 ... timeL valueL 32767 ; frequency breakpoints for partial 1 |
| 131 |
-1 time1 value1 ... timeM valueM 32767 ; amplitude breakpoints for partial 2 |
| 132 |
-2 time1 value1 ... timeN valueN 32767 ; frequency breakpoints for partial 2 |
| 133 |
-2 time1 value1 .......... |
| 134 |
-2 time1 value1 .......... ; pairable tracks for partials 3 and 4 |
| 135 |
-1 time1 value1 .......... |
| 136 |
-1 time2 value1 ..........</programlisting> |
| 137 |
</informalexample> |
| 138 |
</para> |
| 139 |
</refsect2> |
| 140 |
</refsect1> |
| 141 |
|
| 142 |
<refsect1> |
| 143 |
<title>Examples</title> |
| 144 |
<para> |
| 145 |
|
| 146 |
<programlisting> |
| 147 |
<emphasis>hetro</emphasis> -s44100 -b.5 -d2.5 -h16 -M24000 audiofile.test adsynfile7</programlisting> |
| 148 |
|
| 149 |
|
| 150 |
This will analyze 2.5 seconds of channel 1 of a file |
| 151 |
"audiofile.test", recorded at 44.1 kHz, beginning .5 |
| 152 |
seconds from the start, and place the result in a file |
| 153 |
"adsynfile7". We request just the first 16 harmonics of |
| 154 |
the sound, with 256 initial breakpoint values per amplitude or |
| 155 |
frequency track, and a peak summation amplitude of 24000. The |
| 156 |
fundamental is estimated to begin at 100 Hz. Amplitude |
| 157 |
thresholding is at 54 db down. |
| 158 |
</para> |
| 159 |
|
| 160 |
<para> |
| 161 |
The Butterworth LPF is not enabled. |
| 162 |
</para> |
| 163 |
<para> |
| 164 |
Here is an example of the hetro utility. It uses the file <ulink url="examples/hetro.csd"><citetitle>hetro.csd</citetitle></ulink>. |
| 165 |
|
| 166 |
<example> |
| 167 |
<title>Example of the hetro utility.</title> |
| 168 |
|
| 169 |
<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> |
| 170 |
<xi:include href="examples-xml/hetro.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 171 |
</example> |
| 172 |
</para> |
| 173 |
</refsect1> |
| 174 |
|
| 175 |
<refsect1> |
| 176 |
<title>Credits</title> |
| 177 |
<para> |
| 178 |
<simplelist> |
| 179 |
<member>Author: Tom Sullivan</member> |
| 180 |
<member>1992</member> |
| 181 |
<member>Author: &namejohn;</member> |
| 182 |
<member>1994</member> |
| 183 |
<member>Author: Richard Dobson</member> |
| 184 |
<member>2000</member> |
| 185 |
</simplelist> |
| 186 |
</para> |
| 187 |
<para> |
| 188 |
October 2002. Thanks to &namerasmus;, added a note about the SDIF format. |
| 189 |
</para> |
| 190 |
</refsect1> |
| 191 |
</refentry> |