View Source NxAudio.IO.BackendReadConfig (nx_audio v0.2.0)
Defines how the backend should read the audio file.
Summary
Types
:frame_offset
(non_neg_integer/0
) - Number of frames to skip before start reading data The default value is0
.
Functions
Parses and validate a keyword list into a valid audio backend config
Types
@type t() :: [ frame_offset: non_neg_integer(), num_frames: integer(), normalize: boolean(), channels_first: boolean(), buffer_size: integer(), backend: term() ]
:frame_offset
(non_neg_integer/0
) - Number of frames to skip before start reading data The default value is0
.:num_frames
(integer/0
) - Maximum number of frames to read. -1 reads all the remaining samples, starting from frame_offset. This function may return the less number of frames if there is not enough frames in the given file The default value is-1
.:normalize
(boolean/0
) - When true, this function converts the native sample type to float32. Default: true.If input file is integer WAV, giving False will change the resulting Tensor type to integer type. This argument has no effect for formats other than integer WAV type.
The default value is
true
.:channels_first
(boolean/0
) - When True, the returned Tensor has dimension [channel, time]. Otherwise, the returned Tensor’s dimension is [time, channel]. The default value istrue
.:buffer_size
(integer/0
) - Size of buffer to use when processing file-like objects, in bytes. The default value is4096
.:backend
- Backend to use for reading audio files The default value is:ffmpeg
.
Functions
@spec validate(backend_options :: Keyword.t()) :: {:ok, t()} | {:error, NxAudio.IO.Errors.InvalidBackendConfigurations.t()}
Parses and validate a keyword list into a valid audio backend config