11#include <memory_resource>
12#include <nk/value/value.hpp>
60 int64_t startSample = 1, int64_t endSample = -1,
61 bool nativeType =
false,
62 std::pmr::memory_resource *mr =
nullptr);
72 int64_t startSample = 1, int64_t endSample = -1,
73 bool nativeType =
false,
74 std::pmr::memory_resource *mr =
nullptr);
97 const std::string &format =
"wav",
98 uint16_t bitsPerSample = 16,
99 const std::string &title =
"",
100 const std::string &artist =
"",
101 const std::string &comment =
"");
114 int64_t startSample = 1, int64_t endSample = -1,
115 bool nativeType =
false,
116 std::pmr::memory_resource *mr =
nullptr);
134 uint16_t bitsPerSample = 16,
135 const std::string &title =
"",
136 const std::string &artist =
"",
137 const std::string &comment =
"");
Core MATLAB-compatible multidimensional array and scalar value type.
AudioData audioread(const std::string &path, int64_t startSample=1, int64_t endSample=-1, bool nativeType=false, std::pmr::memory_resource *mr=nullptr)
Reads audio file from filesystem ([y, Fs] = audioread(filename)).
AudioInfo audioinfoFromBytes(const std::uint8_t *data, std::size_t len)
Reads audio metadata from memory buffer without decoding audio samples (info = audioinfo(bytes)).
AudioData audioreadFromBytes(const std::uint8_t *data, std::size_t len, int64_t startSample=1, int64_t endSample=-1, bool nativeType=false, std::pmr::memory_resource *mr=nullptr)
Decodes audio from raw memory buffer, sniffing format automatically ([y, Fs] = audioread(bytes)).
void audiowrite(const std::string &path, const Value &y, double sampleRate, uint16_t bitsPerSample=16, const std::string &title="", const std::string &artist="", const std::string &comment="")
Writes audio data matrix y to file on disk (audiowrite(filename, y, Fs)).
AudioInfo audioinfo(const std::string &path)
Returns audio file metadata (info = audioinfo(filename)).
std::vector< std::uint8_t > audiowriteToBytes(const Value &y, double sampleRate, const std::string &format="wav", uint16_t bitsPerSample=16, const std::string &title="", const std::string &artist="", const std::string &comment="")
Encodes audio matrix y into memory byte buffer (bytes = audiowrite(y, Fs, ...)).
Decoded audio waveform data and basic metadata.
uint64_t totalSamples
Total number of sample frames per channel.
Value y
Audio data matrix N x C (samples along rows, channels along columns).
double sampleRate
Sampling frequency Fs in Hz.
std::string comment
Embedded comment or description metadata.
std::string artist
Embedded artist metadata.
uint16_t bitsPerSample
Quantization bit depth per sample.
std::string title
Embedded track title metadata.
uint16_t numChannels
Number of interleaved audio channels.
Audio file metadata container (info = audioinfo(filename)).
uint32_t bitRate
Bitrate in kbps.
std::string title
Track title.
uint16_t bitsPerSample
Bits per sample.
std::string compressionMethod
Audio compression codec name.
std::string artist
Track artist.
uint64_t totalSamples
Total sample frames in file.
double sampleRate
Sampling rate in Hz.
uint32_t numChannels
Number of audio channels.
std::string comment
Comment or genre.
std::string format
Container format (e.g. "WAV", "FLAC", "MP3", "AIFF").
double duration
Total duration in seconds.