-
Notifications
You must be signed in to change notification settings - Fork 79
/
conversion.py
60 lines (42 loc) · 1002 Bytes
/
conversion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# coding: utf-8
"""
Other conversions
-----------------
.. autosummary::
:toctree: generated/
mgc2b
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from pysptk.sptk import mc2b, gnorm
def mgc2b(mgc, alpha=0.35, gamma=0.0):
"""Mel-generalized cepstrum to MGLSA filter coefficients
Parameters
----------
mgc : array, shape
Mel-generalized cepstrum
alpha : float
All-pass constant. Default is 0.35.
gamma : float
Parameter of generalized log function. Default is 0.0.
Returns
-------
b : array, shape(same as `mgc`)
MGLSA filter coefficients
See Also
--------
pysptk.sptk.mlsadf
pysptk.sptk.mglsadf
pysptk.sptk.mc2b
pysptk.sptk.b2mc
pysptk.sptk.mcep
pysptk.sptk.mgcep
pysptk.sptk.mgcep
"""
b = mc2b(mgc, alpha)
if gamma == 0:
return b
b = gnorm(b, gamma)
b[0] = np.log(b[0])
b[1:] *= gamma
return b