MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / mel2hz

Function mel2hz

numpy_ml/preprocessing/dsp.py:719–742  ·  view source on GitHub ↗

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")

Source from the content-addressed store, hash-verified

717
718
719def 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&#x27;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
745def hz2mel(hz, formula="htk"):

Callers 1

mel_filterbankFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected