Convert the mel-scale representation of a signal into Hz Parameters ---------- mel : :py:class:`ndarray ` of shape `(N, \*)` An array of mel frequencies to convert formula : {"htk", "slaney"} The Mel formula to use. "htk" uses the formula used by
(mel, formula="htk")
| 717 | |
| 718 | |
| 719 | def mel2hz(mel, formula="htk"): |
| 720 | """ |
| 721 | Convert the mel-scale representation of a signal into Hz |
| 722 | |
| 723 | Parameters |
| 724 | ---------- |
| 725 | mel : :py:class:`ndarray <numpy.ndarray>` of shape `(N, \*)` |
| 726 | An array of mel frequencies to convert |
| 727 | formula : {"htk", "slaney"} |
| 728 | The Mel formula to use. "htk" uses the formula used by the Hidden |
| 729 | Markov Model Toolkit, and described in O'Shaughnessy (1987). "slaney" |
| 730 | uses the formula used in the MATLAB auditory toolbox (Slaney, 1998). |
| 731 | Default is 'htk' |
| 732 | |
| 733 | Returns |
| 734 | ------- |
| 735 | hz : :py:class:`ndarray <numpy.ndarray>` of shape `(N, \*)` |
| 736 | The frequencies of the items in `mel`, in Hz |
| 737 | """ |
| 738 | fstr = "formula must be either 'htk' or 'slaney' but got '{}'" |
| 739 | assert formula in ["htk", "slaney"], fstr.format(formula) |
| 740 | if formula == "htk": |
| 741 | return 700 * (10 ** (mel / 2595) - 1) |
| 742 | raise NotImplementedError("slaney") |
| 743 | |
| 744 | |
| 745 | def hz2mel(hz, formula="htk"): |