class_docstr: `tfds.features.FeatureConnector` for audio.
  
  In `_generate_examples`, Audio accept:
  
  * A `np.ndarray` of shape `(length,)` or `(length, channels)`
  * A path to a `.mp3`, `.wav`,... file.
  * A file-object (e.g. `with path.open('rb') as fobj:`)
  
  By default, Audio features are decoded as the raw integer wave form
  `tf.Tensor(shape=(None,), dtype=tf.int64)`.
  
  When encoding an audio with a different number of channels than expected by
  the feature, TFDS automatically tries to correct the number of channels.
class_docstr_tok: ["`","tfds.features.FeatureConnector","`","for","audio",".","In","`","_generate_examples","`",",","Audio","accept",":","*","A","`","np.ndarray","`","of","shape","`","(","length",",",")","`","or","`","(","length",",","channels",")","`","*","A","path","to","a","`",".mp3","`",",","`",".wav","`",",","...","file",".","*","A","file-object","(","e.g",".","`","with","path.open","(","'rb","'",")","as","fobj",":","`",")","By","default",",","Audio","features","are","decoded","as","the","raw","integer","wave","form","`","tf.Tensor","(","shape=","(","None",",",")",",","dtype=tf.int64",")","`",".","When","encoding","an","audio","with","a","different","number","of","channels","than","expected","by","the","feature",",","TFDS","automatically","tries","to","correct","the","number","of","channels","."]
docstr: Audio are displayed in the player.
docstr_tok: ["Audio","are","displayed","in","the","player","."]
code: def repr_html(self, ex: np.ndarray) -> str:
      """Audio are displayed in the player."""
      if self.sample_rate:
          rate = self.sample_rate
      else:
          # We should display an error message once to warn the user the sample
          # rate was auto-infered. Requirements:
          # * Should appear only once (even though repr_html is called once per
          #   examples)
          # * Ideally should appear on Colab (while `logging.warning` is hidden
          #   by default)
          rate = 16000
  
      audio_str = utils.get_base64(
          lambda buff: _save_wav(buff, ex, rate)
      )
      return (
          f'<audio controls src="data:audio/ogg;base64,{audio_str}" '
          ' controlsList="nodownload" />'
      )
  
imports: from __future__ import annotations
  import abc
  import enum
  import functools
  import io
  import os
  from typing import BinaryIO, Optional, Union
  import wave
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.features import tensor_feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 5 for calling the Audio obj's underlying member method code with example usage: obj.repr_html(ex) and returns: str, audio_str, str