Debian Codegraph @

opcodes/harmon234.xml

raw symbols SCIP
1
2 <refentry id="harmon2">
3 <indexterm id="IndexHarmon2"><primary>harmon2</primary></indexterm>
4 <refentryinfo><title>Signal Modifiers:Special Effects</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>harmon2</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>harmon2</refname>
11 <refpurpose>
12 Analyze an audio input and generate harmonizing voices in
13 synchrony with formants preserved.
14 </refpurpose>
15 </refnamediv>
16
17 <refsect1>
18 <title>Description</title>
19 <para>
20 Generate harmonizing voices with formants preserved.
21 </para>
22 </refsect1>
23
24 <refsect1>
25 <title>Syntax</title>
26 <synopsis>ares <command>harmon2</command> asig, koct, kfrq1, kfrq2, icpsmode, ilowest[, ipolarity]</synopsis>
27 <synopsis>ares <command>harmon3</command> asig, koct, kfrq1, \
28 kfrq2, kfrq3, icpsmode, ilowest[, ipolarity]</synopsis>
29 <synopsis>ares <command>harmon4</command> asig, koct, kfrq1, \
30 kfrq2, kfrq3, kfrq4, icpsmode, ilowest[, ipolarity]</synopsis>
31 </refsect1>
32
33 <refsect1>
34 <title>Initialization</title>
35 <para>
36 <emphasis>icpsmode</emphasis> -- interpreting mode for the
37 generating frequency inputs <emphasis>kfrq1</emphasis>, <emphasis>kfrq2</emphasis>, <emphasis>kfrq3</emphasis> and <emphasis>kfrq4</emphasis>:
38 0: input values are ratios w.r.t. the cps equivalent of <emphasis>koct</emphasis>.
39 1: input values are the actual requested frequencies in cps.
40 </para>
41
42 <para>
43 <emphasis>ilowest</emphasis> -- lowest value of the <emphasis>koct</emphasis> input for which harmonizing voices will be generated.
44 </para>
45
46 <para>
47 <emphasis>ipolarity</emphasis> -- polarity of <emphasis>asig</emphasis> input, 1 = positive glottal pulses, 0 = negative. Default is 1.
48 </para>
49 </refsect1>
50
51 <refsect1>
52 <title>Performance</title>
53 <para>
54 <command>Harmon2</command>, <command>harmon3</command>
55 and <command>harmon4</command> are high-performance harmonizers,
56 able to provide up to four pitch-shifted copies of the input
57 <emphasis>asig</emphasis> with spectral formants preserved. The
58 pitch-shifting algorithm requires an accurate running estimate
59 (<emphasis>koct</emphasis>, in decimal oct units) of the pitched
60 content of <emphasis>asig</emphasis>, normally gained from an
61 independent pitch tracker such as <emphasis>specptrk</emphasis>.
62 The algorithm then isolates the most recent full pulse
63 within <emphasis>asig</emphasis>, and uses this to generate the
64 other voices at their required pulse rates.
65 </para>
66 <para>
67 If the frequency (or ratio) presented
68 to <emphasis>kfrq1</emphasis>, <emphasis>kfrq2</emphasis>, <emphasis>kfrq3</emphasis>
69 or <emphasis>kfrq4</emphasis> is zero, then no signal is
70 generated for that voice. If any of them is non-zero, but
71 the <emphasis>koct</emphasis> input is below the
72 value <emphasis>ilowest</emphasis>, then that voice will output
73 a direct copy of the input <emphasis>asig.</emphasis> As a
74 consequence, the data arriving at the k-rate inputs can
75 variously cause the generated voices to be turned on or off, to
76 pass a direct copy of a non-voiced fricative source, or to
77 harmonize the source according to some constructed algorithm.
78 The transition from one mode to another is cross-faded, giving
79 seemless alternating between voiced (harmonized) and non-voiced
80 fricatives during spoken or sung input.
81 </para>
82 <para>
83 <emphasis>harmon2</emphasis>, <emphasis>harmon3</emphasis>,
84 <emphasis>harmon4</emphasis> are especially matched to the output
85 of <emphasis>specptrk</emphasis>. The latter generates pitch
86 data in decimal octave format; it also emits its base value if
87 no pitch is identified (as in fricative noise) and emits zero if
88 the energy falls below a threshold, so
89 that <emphasis>harmon2</emphasis>, <emphasis>harmon3</emphasis>,
90 <emphasis>harmon4</emphasis> can be set to pass the direct
91 signal in both cases. Of course, any other form of pitch
92 estimation could also be used. Since pitch trackers usually
93 incur a slight delay for accurate estimation
94 (for <emphasis>specptrk</emphasis> the delay is printed by the
95 <emphasis>spectrum</emphasis> unit), it is normal to delay the audio signal by the
96 same amount so that <emphasis>harmon2</emphasis>,
97 <emphasis>harmon3</emphasis>, <emphasis>harmon4</emphasis>
98 can work from a fully concurrent estimate.
99 </para>
100 </refsect1>
101
102 <refsect1>
103 <title>Examples</title>
104 <para>
105 Here is an example of the harmon2 opcode. It uses the file <ulink url="examples/harmon.csd"><citetitle>harmon.csd</citetitle></ulink>.
106
107 <example>
108 <title>Example of the harmon2 opcode.</title>
109
110 <programlisting>
111 a1,a2 <emphasis role="opc">ins</emphasis> <emphasis role="comment">; get mic input</emphasis>
112 w1 <emphasis role="opc">spectrum</emphasis> a1, .02, 7, 24, 12, 1, 3 <emphasis role="comment">; and examine it</emphasis>
113 koct,kamp <emphasis role="opc">specptrk</emphasis> w1, 1, 6.5, 9.5, 7.5, 10, 7, .7, 0, 3, 1
114 a3 <emphasis role="opc">delay</emphasis> a1, .065 <emphasis role="comment">; allow for ptrk delay</emphasis>
115 a4 <emphasis role="opc">harmon2</emphasis> a3, koct, 1.25, 0.75, 0, 6.9 <emphasis role="comment">; output a fixed 6-4 harmony</emphasis>
116 <emphasis role="opc">outs</emphasis> a3, a4 <emphasis role="comment">; as well as the original</emphasis></programlisting>
117 </example>
118 </para>
119 <para>
120 Here is a complete example of the harmon3 opcode. It uses the file <ulink url="examples/harmon3.csd"><citetitle>harmon3.csd</citetitle></ulink>.
121 <example>
122 <title>Example of the harmon3 opcode.</title>
123 <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>
124 <xi:include href="examples-xml/harmon3.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
125 </example>
126 </para>
127 </refsect1>
128
129 <refsect1>
130 <title>See also</title>
131 <para><link linkend="SigmodSpeciale"><citetitle>Special Effects</citetitle></link></para>
132 </refsect1>
133
134 <refsect1>
135 <title>Credits</title>
136 <para>
137 <simplelist>
138 <member>Author: &namebarry;</member>
139 <member>M.I.T., Cambridge, Mass</member>
140 <member>2006</member>
141 </simplelist>
142 </para>
143 <para>New in version 5.04</para>
144 </refsect1>
145 </refentry>