Reference

WavFile

WavFile(file)

Representation of a wave file

Parameters:
  • file (Union[str, PathLike, BinaryIO, bytes]) –

    A path to a file to read in, the file itself, or the raw bytes of the file.

Raises:
Attributes:
  • detail (WavDetail) –

    Details about the wave file

  • info (dict[str, str]) –

    Optional metadata embedded in the file

  • raw_details (RawDetail) –

    Details about the file directly extracted from it

WavDetail

WavDetail(file)

Details about the wav file audio

Parameters:
  • file (Union[str, PathLike, BinaryIO, bytes]) –

    A path to a file to read in, the file itself, or the raw bytes of the file.

Attributes:
  • format (Format) –

    The format/codec of the audio

  • duration (float) –

    Duration of the audio

  • channels (int) –

    Number of audio channels

  • bit_depth (int) –

    The bit depth (amplitude resolution) of the audio

  • sample_rate (int) –

    The audio sample rate in Hz

  • channel_positions (list[SpeakerPosition]) –

    Ordered list of the speaker positions of each channel

RawDetail

RawDetail(file)

Raw details about a wave file.

Parameters:
  • file (Union[str, PathLike, BinaryIO, bytes]) –

    A path to a file to read in, the file itself, or the raw bytes of the file.

Attributes:
  • format_tag (int) –

    Format tag code

  • channels (int) –

    Number of channels

  • sample_rate (int) –

    Sample rate in Hz

  • data_rate (int) –

    Average bit rate

  • block_size (int) –

    Internal data alignment of audio

  • sample_depth (int) –

    Valid bits per sample

  • channel_mask (Optional[int]) –

    Channel speaker poisition mask

  • subformat (Optional[str]) –

    Subformat GUID

  • total_samples (int) –

    Total number of samples (per channel) in file. From fact chunk if present, otherwise calculated from data chunk length

WavLoadError

Bases: Exception

Exception raised if a file is not able to be read as a valid wav file