SpectMorph
smlpc.hh
1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_LPC_HH
4 #define SPECTMORPH_LPC_HH
5 
6 #include <vector>
7 #include <complex>
8 
9 namespace SpectMorph
10 {
11 
12 namespace LPC
13 {
14 
15 /* always use the mix_freq for computing the LPC coefficients, in order to be
16  * able to morph LSF coefficients for different input sample rate
17  */
18 const float MIX_FREQ = 44100;
19 
20 void compute_lpc (std::vector<double>& lpc, const float *begin, const float *end);
21 void lpc2lsf (const std::vector<double>& lpc, std::vector<float>& lpc_lsf_p, std::vector<float>& lpc_lsf_q);
22 void lsf2lpc (const std::vector<float>& lsf_p, const std::vector<float>& lsf_q, std::vector<double>& lpc);
23 
24 double eval_lpc (const std::vector<double>& lpc, double f);
25 
26 class LSFEnvelope {
27  std::vector<double> p_a;
28  std::vector<double> p_b;
29  double p_real_root;
30 
31  std::vector<double> q_a;
32  std::vector<double> q_b;
33  double q_real_root;
34 
35  bool m_init;
36 public:
37  LSFEnvelope();
38 
39  bool init (const std::vector<float>& lpc_lsf_p, const std::vector<float>& lpc_lsf_q);
40  double eval (double f);
41 };
42 
43 long double eval_z (const std::vector<double>& lpc, std::complex<long double> z);
44 bool find_roots (const std::vector<double>& lpc, std::vector< std::complex<double> >& roots);
45 void roots2lpc (const std::vector< std::complex<double> >& roots, std::vector<double>& lpc);
46 void make_stable_roots (std::vector< std::complex<double> >& roots);
47 
48 }
49 
50 }
51 
52 #endif
Definition: smlpc.hh:26
Definition: smalignedarray.cc:7