docs: def sndwrite(samples:np.ndarray, sr:int, outfile:str, encoding:str='auto') -> None:
      """
      samples  --> Array-like. the actual samples, shape=(nframes, channels)
      sr       --> Sampling-rate
      outfile  --> The name of the outfile. the extension will determine
                   the file-format.
                   The formats supported depend on the available backends
                   Without additional backends, only uncompressed formats
                   are supported (wav, aif)
      encoding --> one of:
                   - 'auto' or None: the encoding is determined from the format
                                     given by the extension of outfile, and
                                     from the data
                   - 'pcm16'
                   - 'pcm24'
                   - 'pcm32'
                   - 'flt32'
  
                   NB: not all file formats support all encodings.
                       Throws a SndfileError if the format does not support
                       the given encoding
  
            If set to 'auto', an encoding will be selected based on the
            file-format and on the data. The bitdepth of the data is
            measured, and if the file-format supports it, it will be used.
            For bitdepths of 8, 16 and 24 bits, a PCM encoding will be used.
            For a bitdepth of 32 bits, a FLOAT encoding will be used,
            or the next lower supported encoding
      """
      if encoding in ('auto', None):
          encoding = _guessEncoding(samples, outfile)
      # normalize in the case where there would be clipping
      clipping = ((samples > 1).any() or (samples < -1).any())
      if encoding.startswith('pcm') and clipping:
          maxvalue = max(samples.max(), abs(samples.min()))
          samples = samples / maxvalue
      backend = _getWriteBackend(outfile, encoding)
      if not backend:
          raise SndfileError("No backend found to support the given format")
      logger.debug(f"sndwrite: using backend {backend.name}")
      return backend.write(samples, sr, outfile, encoding)