Qu

codec.flac_info

Builtin index · File I/O

result = codec.flac_info(src)

Input: src · Output: result

What it is

Reads a FLAC file's header without decoding any audio, which is how to check a file is what you expect before paying for the samples. src (string path, or Vec of bytes) is the stream.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = codec.flac_info(src)
src string or Vecnot documented yet
fs Numthe sample rate in Hz
channels Numhow many channels the stream carries
bits Numbits per sample
frames Numor none — a FLAC stream is allowed not to declare its length, and none says so where 0 would read as an empty file
Returns a Record with fields: fs (Num, the sample rate in Hz), channels (Num, how many channels the stream carries), bits (Num, bits per sample), frames (Num, or none — a FLAC stream is allowed not to declare its length, and none says so where 0 would read as an empty file).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

import codec
info = flac_info(bytes)          # opened by the import

info = codec.flac_info(bytes)    # or qualified

not run by the build — this one needs something the repository cannot supply · from fundamentals

import codec

info = codec.flac_info("take.flac")
print("{info.fs} Hz, {info.channels} ch, {info.bits} bit")

not run by the build — this one needs something the repository cannot supply · from file-io