pyACA: Documentation 0.3.1
Source Code for Audio Content Analysis
Loading...
Searching...
No Matches
Functions
pyACA.ToolMel2Freq Namespace Reference

Functions

 ToolMel2Freq (fMel, cModel='fant')
 helper function: convert Mel to Hz
 

Function Documentation

◆ ToolMel2Freq()

ToolMel2Freq ( fMel,
cModel = 'fant' )

helper function: convert Mel to Hz

Parameters
fMelMel frequency
cModelname of the model ('Fant' [default], 'Shaughnessy', 'Umesh')
Returns
f: frequency in Hz

Definition at line 10 of file ToolMel2Freq.py.

10def ToolMel2Freq(fMel, cModel='fant'):
11 def acaFant_I(m):
12 # mel = 1000 * log2(1 + f / 1000);
13 return 1000 * (2 ** (m / 1000) - 1)
14
15 def acaShaughnessy_I(m):
16 # mel = 2595 * log10(1 + f / 700);
17 return 700 * (10 ** (m / 2595) - 1)
18
19 def acaUmesh_I(m):
20 # mel = f / (2.4e-4 * f + 0.741);
21 return m * 0.741 / (1 - m * 2.4e-4)
22
23
24 cModel = cModel.lower()
25 if cModel == 'fant':
26 return acaFant_I(fMel)
27 elif cModel == 'shaughnessy':
28 return acaShaughnessy_I(fMel)
29 elif cModel == 'umesh':
30 return acaUmesh_I(fMel)
31 else:
32 print('Invalid model type')