docs: def chunk_size_samples(sf, buf):
      """
      Black magic to account for the fact that libsndfile's behavior varies
      depending on file format when using the virtual io api.
  
      If you ask for more samples from an ogg or flac file than are available
      at that moment, libsndfile will give you no more samples ever, even if
      more bytes arrive in the buffer later.
      """
      byte_depth = _lookup[sf.subtype]
      channels = sf.channels
      bytes_per_second = byte_depth * sf.samplerate * channels
      secs = len(buf) / bytes_per_second
      secs = max(1, secs - 6)
      return int(secs * sf.samplerate)