1 from gmisclib import Num
2
3 """Perceptual frequency scales."""
4 __version__ = "$Revision: 1.3 $"
5
6 if hasattr(Num, 'asinh'):
7 asinh = Num.asinh
8 else:
14
18
20 """frequency to critical band number.
21 See Schroeder et al. (1979).
22 """
23 return 7*asinh(Num.asarray(f)/650.0)
24
26 """critical band number -> frequency
27 M. R. Schroeder, B.S. Atal, J.L. Hall (1979), J.Acous.Soc.Am. 66(6) 1647-1652.
28 Title: "Optimizing Digital Speech Coders by exploiting masking
29 properties of the Human Ear."
30 """
31 return 650*Num.sinh(Num.asarray(b)/7.0)
32
33
35 """Critical bandwidth (in Hz) at frequency b (barks)."""
36 return (650.0/7.0)*Num.cosh(b/7.0)
37
38
39 if __name__ == "__main__":
40 print f_to_bark(51)
41 print f_to_bark(149)
42