Debian Codegraph @

opcodes/lpcanal.xml

raw symbols SCIP
1
2 <refentry id="lpcanal">
3 <indexterm id="IndexLpcanal"><primary>lpcanal</primary></indexterm>
4 <refentryinfo><title>Spectral Processing:LPC</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>lpcanal</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>lpcanal</refname>
11 <refpurpose>
12 Streaming linear prediction analysis.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 This opcode implements streaming linear prediction analysis. Two versions
20 exist, one taking input from an audio signal, and the other from
21 a function table.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>kCoef[],krms,kerr,kcps <command>lpcanal</command> asrc, kflg,
28 kprd, isiz, iord[,iwin] </synopsis>
29 <synopsis>kCoef[],krms,kerr,kcps <command>lpcanal</command> koff, kflg,
30 ifn, isiz, iord[,iwin] </synopsis>
31 <synopsis>iCoef[],irms,ierr,icps <command>lpcanal</command> ioff, iflg,
32 ifn, isiz, iord[,iwin] </synopsis>
33
34 </refsect1>
35 <refsect1>
36 <title>Initialization</title>
37 <para>
38 <emphasis>isiz</emphasis> -- size of lpc input frame in samples.
39 </para>
40
41 <para>
42 <emphasis>iord</emphasis> -- linear predictor order.
43 </para>
44
45 <para>
46 <emphasis>ifn</emphasis> -- streaming LPC analysis source function table
47 </para>
48
49 <para>
50 <emphasis>iwin</emphasis> -- window function table number (optional)
51 </para>
52
53 </refsect1>
54
55 <refsect1>
56 <title>Performance</title>
57 <para>
58 <emphasis>kCoef[]</emphasis> -- all-pole filter coefficients
59 (iord-size array)
60 </para>
61
62 <para>
63 <emphasis>krms</emphasis> - RMS estimate of source signal.
64 </para>
65
66 <para>
67 <emphasis>kerr</emphasis> - linear prediction error (or residual).
68 </para>
69
70 <para>
71 <emphasis>kcps</emphasis> - fundamental frequency estimate, from
72 the autocorrelation function.
73 </para>
74
75 <para>
76 <emphasis>asrc</emphasis> -- streaming LPC analysis source signal
77 </para>
78
79 <para>
80 <emphasis>kflg</emphasis> -- compute flag, non-zero values
81 switch on linear prediction analysis replacing filter coefficients, zero switch it off,
82 keeping current filter coefficients.
83 </para>
84
85 <para>
86 <emphasis>kprd</emphasis> -- analysis period in samples,
87 determining how often new coefficients are computed.
88 </para>
89
90 <para>
91 <emphasis>koff</emphasis> -- function table position offset, in
92 samples, determining the start position of analysis frame.
93 </para>
94 </refsect1>
95
96 <refsect1>
97 <para>
98 This opcode is part of a suite of streaming linear prediction
99 opcodes. It analyses an input signal, either as an audio input
100 or stored in a function table and produces a set of
101 coefficients for an all-pole filter that models the signal's
102 spectral envelope. These coefficients are placed in a k-rate array,
103 and output along with other analysis measurements.
104 </para>
105
106 <para>
107 The fundamental analysis parameters are input frame size and
108 filter order. Longer input frames will produce a more accurate
109 result in terms of frequency resolution, but will also involve
110 more computation. This is due to the computation of the
111 autocorrelation function, which is then used in the coefficient
112 computation. This part is more efficient and depends only
113 on the linear prediction order, which is also the number of
114 coefficients computed. Typical lp orders may range from
115 about 30 to 100 coefficients, but larger values can also
116 be used.
117 </para>
118
119 <para>
120 If the LPC source signal is derived from an audio input, then
121 the computation of coefficients is dependent on two parameters,
122 kflg and kprd. The first is an on/off switch that determines
123 whether coefficients are replaced by newly-computed ones
124 or the coefficients are kept fixed to their last value. The
125 other determines the frequency of analyses, by setting a
126 time interval (in samples) between new coefficient computation.
127 This ranges from coefficients being replaced every sample,
128 to never replaced (if the period is larger than the synthesis duration).
129 Overlapped analyses will take place if the value of kprd is less
130 than the input size. Decreasing the spacing of analyses will
131 also increase computation demands.
132 </para>
133 <para>
134 If the LPC source signal is derived from a function table,
135 then kflg determines wheter an analysis should be performed
136 or not (1 or 0). The value of koff is then used as an offset
137 (in samples) into the function table determining the position
138 of the analysis frame. For example, if kflg is permanently set
139 to 1 and koff is set to ksmps, then at every kcycle an
140 analysis frame will be taken from successive positions in the
141 function table. Changing koff to fewer samples will produce
142 a timestretched result and increasing it will time compress.
143 </para>
144 <para>
145 Once the signal is extracted from either an audio input or
146 function table then it can be optionally windowed if a function
147 table is provided. While this is optional, it is a recommended
148 procedure (GEN20 can provide the most common windows).
149 The signal is then analysed and coefficients produced.
150 </para>
151
152 </refsect1>
153
154 <refsect1>
155 <title>Examples</title>
156 <para>
157 Here is an example of the lpcanal opcode using an audio input
158 signal as lpc source. It uses the file <ulink url="examples/lpcanal.csd"><citetitle>lpcanal.csd</citetitle></ulink>.
159 <example>
160 <title>Example of the lpcanal opcode.</title>
161 <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>
162 <xi:include href="examples-xml/lpcanal.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
163 </example>
164 </para>
165 <para>
166 Here is another example of the lpcanal opcode, now using a
167 function table as lpc source. It uses the file <ulink url="examples/lpcanal-2.csd"><citetitle>lpcanal-2.csd</citetitle></ulink>.
168 <example>
169 <title>Another example of the lpcanal opcode.</title>
170 <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>
171 <xi:include href="examples-xml/lpcanal-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
172 </example>
173 </para>
174 </refsect1>
175
176 <refsect1>
177 <title>See also</title>
178 <para><link linkend="SpectralLpcresyn"><citetitle>Streaming Linear Predictive Coding (SLPC) Resynthesis</citetitle></link></para>
179 </refsect1>
180
181 </refentry>