bit_depth()

audiofile.bit_depth(file)[source]

Bit depth of audio file.

For lossy audio files, None is returned as they have a varying bit depth.

Parameters:

file (str | IOBase) – file name of input audio file or file-like object

Return type:

int | None

Returns:

bit depth of audio file

Raises:

RuntimeError – if file is missing, broken or format is not supported

Examples

>>> audiofile.bit_depth("stereo.wav")
16