class_docstr: Calculate `Speech-to-Reverberation Modulation Energy Ratio`_ (SRMR).
  
  SRMR is a non-intrusive metric for speech quality and intelligibility based on
  a modulation spectral representation of the speech signal.
  This code is translated from `SRMRToolbox`_ and `SRMRpy`_.
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``preds`` (:class:`~torch.Tensor`): float tensor with shape ``(...,time)``
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``srmr`` (:class:`~torch.Tensor`): float scaler tensor
  
  .. note:: using this metrics requires you to have ``gammatone`` and ``torchaudio`` installed.
      Either install as ``pip install torchmetrics[audio]`` or ``pip install torchaudio``
      and ``pip install git+https://github.com/detly/gammatone``.
  
  .. note::
      This implementation is experimental, and might not be consistent with the matlab
      implementation `SRMRToolbox`_, especially the fast implementation.
      The slow versions, a) fast=False, norm=False, max_cf=128, b) fast=False, norm=True, max_cf=30, have
      a relatively small inconsistence.
  
  Args:
      fs: the sampling rate
      n_cochlear_filters: Number of filters in the acoustic filterbank
      low_freq: determines the frequency cutoff for the corresponding gammatone filterbank.
      min_cf: Center frequency in Hz of the first modulation filter.
      max_cf: Center frequency in Hz of the last modulation filter. If None is given,
          then 30 Hz will be used for `norm==False`, otherwise 128 Hz will be used.
      norm: Use modulation spectrum energy normalization
      fast: Use the faster version based on the gammatonegram.
          Note: this argument is inherited from `SRMRpy`_. As the translated code is based to pytorch,
          setting `fast=True` may slow down the speed for calculating this metric on GPU.
  
  Raises:
      ModuleNotFoundError:
          If ``gammatone`` or ``torchaudio`` package is not installed
  
  Example:
      >>> import torch
      >>> from torchmetrics.audio import SpeechReverberationModulationEnergyRatio
      >>> g = torch.manual_seed(1)
      >>> preds = torch.randn(8000)
      >>> srmr = SpeechReverberationModulationEnergyRatio(8000)
      >>> srmr(preds)
      tensor(0.3354)
class_docstr_tok: ["Calculate","`","Speech-to-Reverberation","Modulation","Energy","Ratio","`","_","(","SRMR",")",".","SRMR","is","a","non-intrusive","metric","for","speech","quality","and","intelligibility","based","on","a","modulation","spectral","representation","of","the","speech","signal",".","This","code","is","translated","from","`","SRMRToolbox","`","_","and","`","SRMRpy","`","_",".","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input","-","``","preds","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","tensor","with","shape","``","(","...",",","time",")","``","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","srmr","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","scaler","tensor","..","note",":",":","using","this","metrics","requires","you","to","have","``","gammatone","``","and","``","torchaudio","``","installed",".","Either","install","as","``","pip","install","torchmetrics","[","audio","]","``","or","``","pip","install","torchaudio","``","and","``","pip","install","git+https",":","\/\/github.com\/detly\/gammatone","``",".","..","note",":",":","This","implementation","is","experimental",",","and","might","not","be","consistent","with","the","matlab","implementation","`","SRMRToolbox","`","_",",","especially","the","fast","implementation",".","The","slow","versions",",","a",")","fast=False",",","norm=False",",","max_cf=128",",","b",")","fast=False",",","norm=True",",","max_cf=30",",","have","a","relatively","small","inconsistence",".","Args",":","fs",":","the","sampling","rate","n_cochlear_filters",":","Number","of","filters","in","the","acoustic","filterbank","low_freq",":","determines","the","frequency","cutoff","for","the","corresponding","gammatone","filterbank",".","min_cf",":","Center","frequency","in","Hz","of","the","first","modulation","filter",".","max_cf",":","Center","frequency","in","Hz","of","the","last","modulation","filter",".","If","None","is","given",",","then","30","Hz","will","be","used","for","`","norm==False","`",",","otherwise","128","Hz","will","be","used",".","norm",":","Use","modulation","spectrum","energy","normalization","fast",":","Use","the","faster","version","based","on","the","gammatonegram",".","Note",":","this","argument","is","inherited","from","`","SRMRpy","`","_",".","As","the","translated","code","is","based","to","pytorch",",","setting","`","fast=True","`","may","slow","down","the","speed","for","calculating","this","metric","on","GPU",".","Raises",":","ModuleNotFoundError",":","If","``","gammatone","``","or","``","torchaudio","``","package","is","not","installed","Example",":",">",">",">","import","torch",">",">",">","from","torchmetrics.audio","import","SpeechReverberationModulationEnergyRatio",">",">",">","g","=","torch.manual_seed","(","1",")",">",">",">","preds","=","torch.randn","(","8000",")",">",">",">","srmr","=","SpeechReverberationModulationEnergyRatio","(","8000",")",">",">",">","srmr","(","preds",")","tensor","(","0.3354",")"]
docstr: Plot a single or multiple values from the metric.
  
  Args:
      val: Either a single result from calling `metric.forward` or `metric.compute` or a list of these results.
          If no value is provided, will automatically call `metric.compute` and plot that result.
      ax: An matplotlib axis object. If provided will add plot to that axis
  
  Returns:
      Figure and Axes object
  
  Raises:
      ModuleNotFoundError:
          If `matplotlib` is not installed
  
  .. plot::
      :scale: 75
  
      >>> # Example plotting a single value
      >>> import torch
      >>> from torchmetrics.audio import SpeechReverberationModulationEnergyRatio
      >>> metric = SpeechReverberationModulationEnergyRatio(8000)
      >>> metric.update(torch.rand(8000))
      >>> fig_, ax_ = metric.plot()
  
  .. plot::
      :scale: 75
  
      >>> # Example plotting multiple values
      >>> import torch
      >>> from torchmetrics.audio import SpeechReverberationModulationEnergyRatio
      >>> metric = SpeechReverberationModulationEnergyRatio(8000)
      >>> values = [ ]
      >>> for _ in range(10):
      ...     values.append(metric(torch.rand(8000)))
      >>> fig_, ax_ = metric.plot(values)
docstr_tok: ["Plot","a","single","or","multiple","values","from","the","metric",".","Args",":","val",":","Either","a","single","result","from","calling","`","metric.forward","`","or","`","metric.compute","`","or","a","list","of","these","results",".","If","no","value","is","provided",",","will","automatically","call","`","metric.compute","`","and","plot","that","result",".","ax",":","An","matplotlib","axis","object",".","If","provided","will","add","plot","to","that","axis","Returns",":","Figure","and","Axes","object","Raises",":","ModuleNotFoundError",":","If","`","matplotlib","`","is","not","installed","..","plot",":",":",":","scale",":","75",">",">",">","#","Example","plotting","a","single","value",">",">",">","import","torch",">",">",">","from","torchmetrics.audio","import","SpeechReverberationModulationEnergyRatio",">",">",">","metric","=","SpeechReverberationModulationEnergyRatio","(","8000",")",">",">",">","metric.update","(","torch.rand","(","8000",")",")",">",">",">","fig_",",","ax_","=","metric.plot","(",")","..","plot",":",":",":","scale",":","75",">",">",">","#","Example","plotting","multiple","values",">",">",">","import","torch",">",">",">","from","torchmetrics.audio","import","SpeechReverberationModulationEnergyRatio",">",">",">","metric","=","SpeechReverberationModulationEnergyRatio","(","8000",")",">",">",">","values","=","[","]",">",">",">","for","_","in","range","(","10",")",":","...","values.append","(","metric","(","torch.rand","(","8000",")",")",")",">",">",">","fig_",",","ax_","=","metric.plot","(","values",")"]
code: def plot(
      self,
      val: Union[Tensor, Sequence[Tensor], None] = None,
      ax: Optional[_AX_TYPE] = None,
  ) -> _PLOT_OUT_TYPE:
      """Plot a single or multiple values from the metric.
  
      Args:
          val: Either a single result from calling `metric.forward` or `metric.compute` or a list of these results.
              If no value is provided, will automatically call `metric.compute` and plot that result.
          ax: An matplotlib axis object. If provided will add plot to that axis
  
      Returns:
          Figure and Axes object
  
      Raises:
          ModuleNotFoundError:
              If `matplotlib` is not installed
  
      .. plot::
          :scale: 75
  
          >>> # Example plotting a single value
          >>> import torch
          >>> from torchmetrics.audio import SpeechReverberationModulationEnergyRatio
          >>> metric = SpeechReverberationModulationEnergyRatio(8000)
          >>> metric.update(torch.rand(8000))
          >>> fig_, ax_ = metric.plot()
  
      .. plot::
          :scale: 75
  
          >>> # Example plotting multiple values
          >>> import torch
          >>> from torchmetrics.audio import SpeechReverberationModulationEnergyRatio
          >>> metric = SpeechReverberationModulationEnergyRatio(8000)
          >>> values = [ ]
          >>> for _ in range(10):
          ...     values.append(metric(torch.rand(8000)))
          >>> fig_, ax_ = metric.plot(values)
  
      """
      return self._plot(val, ax)
  
file_path: torchmetrics/src/torchmetrics/audio/srmr.py
imports: from typing import Any, Optional, Sequence, Union
  from torch import Tensor, tensor
  from torchmetrics.functional.audio.srmr import _srmr_arg_validate, speech_reverberation_modulation_energy_ratio
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _GAMMATONE_AVAILABLE, _MATPLOTLIB_AVAILABLE, _TORCHAUDIO_AVAILABLE, _TORCHAUDIO_GREATER_EQUAL_0_10
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 4 for calling the SpeechReverberationModulationEnergyRatio obj's underlying member method code with example usage: obj.plot(val, ax) and returns: self