code: def _save_wav(buff, data, rate) -> None:
      """Transform a numpy array to a PCM bytestring."""
      # Code inspired from `IPython.display.Audio`
      data = np.array(data, dtype=float)
  
      bit_depth = 16
      max_sample_value = int(2 ** (bit_depth - 1)) - 1
  
      num_channels = data.shape[1] if len(data.shape) > 1 else 1
      scaled = np.int16(data / np.max(np.abs(data)) * max_sample_value)
      # The WAVE spec expects little-endian integers of "sampwidth" bytes each.
      # Numpy's `astype` accepts array-protocol type strings, so we specify:
      #  - '<' to indicate little endian
      #  - 'i' to specify signed integer
      #  - the number of bytes used to represent each integer
      # See: https://numpy.org/doc/stable/reference/arrays.dtypes.html
      encoded_wav = scaled.astype(
          f"<i{bit_depth // 8}", copy=False
      ).tobytes()
  
      with wave.open(buff, mode="wb") as waveobj:
          waveobj.setnchannels(num_channels)
          waveobj.setframerate(rate)
          waveobj.setsampwidth(bit_depth // 8)
          waveobj.setcomptype("NONE", "NONE")
          waveobj.writeframes(encoded_wav)
  
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 a global function with example usage: _save_wav(buff, data, rate) without return types