psychos.sound.load_sound#

psychos.sound.load_sound(filename: str, file: BinaryIO | None = None, streaming: bool = True, decoder: MediaDecoder | None = None) Source | StreamingSource#

Load a Source from disk, or an opened file.

All decoders that are registered for the filename extension are tried. If none succeed, the exception from the first decoder is raised. You can also specifically pass a decoder instance to use.

Parameters:
  • filename – Used to guess the media format, and to load the file if file is unspecified.

  • file – An optional file-like object containing the source data.

  • streaming – If False, a StaticSource will be returned; otherwise (default) a StreamingSource is created.

  • decoder – A specific decoder you wish to use, rather than relying on automatic detection. If specified, no other decoders are tried.