class_docstr: Convert waveform to mel spectrogram.
class_docstr_tok: ["Convert","waveform","to","mel","spectrogram","."]
code: def __call__(self, y: ndarray) -> ndarray:
      hop_length = self.n_fft // 4
      window_length = self.n_fft
      assert len(y.shape) == 2
      y = rearrange(y, "n s -> s n")
      p = (self.n_fft - hop_length) // 2
      y = jnp.pad(y, ((p, p), (0, 0)), mode="reflect")
      spec = batched_stft(
          y,
          self.n_fft,
          hop_length,
          window_length,
          "hann",
          False,
          "reflect",
      )
      mag = jnp.sqrt(
          jnp.square(spec.real) + jnp.square(spec.imag) + 1e-9
      )
      mel = jnp.einsum("ms,sfn->nfm", self.melfb, mag)
      cond = jnp.log(jnp.clip(mel, a_min=1e-5, a_max=None))
      return cond
  
file_path: underthesea/underthesea/pipeline/say/viettts_/nat/dsp.py
imports: from functools import partial
  from typing import Optional
  import jax
  import jax.numpy
  import librosa
  from einops import rearrange
  from jax.numpy import ndarray
label_desc: Use image node_id 2 for calling the MelFilter obj's underlying member method code with example usage: obj.__call__(y) and returns: cond