/** @packageDocumentation Audio properties for WAV files. Parses the RIFF "fmt " chunk. */ import { ByteVector } from "../../byteVector.js"; import { AudioProperties } from "../../audioProperties.js"; import { ReadStyle } from "../../toolkit/types.js"; /** * Audio properties parsed from a WAV `"fmt "` chunk. * * `fmt ` chunk layout (little-endian): * `format(2)` + `channels(2)` + `sampleRate(4)` + `avgBytesPerSec(4)` * + `blockAlign(2)` + `bitsPerSample(2)` * * For WAVE_FORMAT_EXTENSIBLE, the sub-format GUID occupies bytes 24–39, and * bytes 24–25 contain the actual codec identifier. */ export declare class WavProperties extends AudioProperties { /** Audio format tag (e.g. `1` = PCM, `3` = IEEE float). */ private _format; /** Number of audio channels. */ private _channels; /** Sample rate in Hz. */ private _sampleRate; /** Average bytes per second (from fmt chunk; used as fallback for duration). */ private _avgBytesPerSec; /** Bits per sample (bit depth). */ private _bitsPerSample; /** Total number of PCM sample frames. */ private _sampleFrames; /** Cached duration in milliseconds (computed during construction). */ private _lengthInMilliseconds; /** Cached bitrate in kbps (computed during construction). */ private _bitrate; /** * Constructs a {@link WavProperties} instance by parsing a `"fmt "` chunk. * Matches the C++ calculation: uses exact floating-point arithmetic and * `Math.trunc(x + 0.5)` rounding (equivalent to C++ `static_cast(x + 0.5)`). * @param data - Raw bytes of the `"fmt "` chunk (must be at least 16 bytes). * @param streamLength - Byte length of the `"data"` chunk including chunk padding. * @param totalSamples - Sample frame count from the `"fact"` chunk (0 if absent). * @param readStyle - Level of detail for property parsing. Defaults to `ReadStyle.Average`. */ constructor(data: ByteVector, streamLength: number, totalSamples?: number, readStyle?: ReadStyle); /** * Playback duration in milliseconds. * @returns Duration in milliseconds, or `0` if unknown. */ get lengthInMilliseconds(): number; /** * Average bitrate of the stream in kilobits per second. * @returns Bitrate in kbps, or `0` if unknown. */ get bitrate(): number; /** * Sample rate of the audio stream in Hz. * @returns Sample rate in Hz, or `0` if unknown. */ get sampleRate(): number; /** * Number of audio channels. * @returns Channel count (e.g. `2` for stereo). */ get channels(): number; /** * Bits per sample (bit depth) of the audio stream. * @returns Bit depth (e.g. `16`, `24`, `32`). */ get bitsPerSample(): number; /** * Total number of PCM sample frames. * @returns Sample frame count, or `0` if unknown. */ get sampleFrames(): number; /** * Audio format tag from the `"fmt "` chunk. * Common values: `1` = PCM, `3` = IEEE float, `6` = A-law, `7` = μ-law. * For `WAVE_FORMAT_EXTENSIBLE` files, this is the sub-format tag. * @returns The format tag value. */ get format(): number; } //# sourceMappingURL=wavProperties.d.ts.map