code: def _hz_to_mel(freq: float, mel_scale: str = "htk") -> float:
      r"""Convert Hz to Mels.
  
      Args:
          freqs (float): Frequencies in Hz
          mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
  
      Returns:
          mels (float): Frequency in Mels
      """
  
      if mel_scale not in ["slaney", "htk"]:
          raise ValueError(
              'mel_scale should be one of "htk" or "slaney".'
          )
  
      if mel_scale == "htk":
          return 2595.0 * math.log10(1.0 + (freq / 700.0))
  
      # Fill in the linear part
      f_min = 0.0
      f_sp = 200.0 / 3
  
      mels = (freq - f_min) / f_sp
  
      # Fill in the log-scale part
      min_log_hz = 1000.0
      min_log_mel = (min_log_hz - f_min) / f_sp
      logstep = math.log(6.4) / 27.0
  
      if freq >= min_log_hz:
          mels = min_log_mel + math.log(freq / min_log_hz) / logstep
  
      return mels
  
imports: import math
  import tempfile
  import warnings
  from collections.abc import Sequence
  from typing import List, Optional, Tuple, Union
  import torch
  import torchaudio
  from torch import Tensor
  from torchaudio._internal.module_utils import deprecated
  from .filtering import highpass_biquad, treble_biquad
label_desc: Use image node_id 8 for calling a global function with example usage: _hz_to_mel(freq, mel_scale) and returns: mels, unknown