Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
|
A collection of functions for loading and storing audio files. More...
Functions | |
int | getSamples (const std::string &file, float *buf, unsigned int channel, unsigned int startFrame, unsigned int endFrame) |
int | getNumChannels (const std::string &file) |
int | getNumFrames (const std::string &file) |
int | write (const std::string &filename, float *buf, unsigned int channels, unsigned int frames, unsigned int samplerate) |
int | write (const std::string &filename, const std::vector< std::vector< float > > &dataIn, unsigned int sampleRate) |
std::vector< std::vector< float > > | load (const std::string &filename, int maxCount=-1, unsigned int start=0) |
std::vector< float > | loadMono (const std::string &file) |
A collection of functions for loading and storing audio files.
A collection of functions for loading and storing audio files.
int AudioFileUtilities::getSamples | ( | const std::string & | file, |
float * | buf, | ||
unsigned int | channel, | ||
unsigned int | startFrame, | ||
unsigned int | endFrame | ||
) |
Load audio frames between startFrame
and endFrame
from channel
of the specified file
into the preallocated memory location buf
.
int AudioFileUtilities::getNumChannels | ( | const std::string & | file | ) |
Get the number of audio channels in file
.
int AudioFileUtilities::getNumFrames | ( | const std::string & | file | ) |
Get the number of audio frames in file
.
int AudioFileUtilities::write | ( | const std::string & | filename, |
float * | buf, | ||
unsigned int | channels, | ||
unsigned int | frames, | ||
unsigned int | samplerate | ||
) |
Store samples from memory into an audio file on disk.
filename | the file to write to |
buf | a vector containing channels * frames of interlaved data |
channels | the channels in the data and output file |
frames | the frames in the data and output file |
sampleRate | the sampling rate of the data |
int AudioFileUtilities::write | ( | const std::string & | filename, |
const std::vector< std::vector< float > > & | dataIn, | ||
unsigned int | sampleRate | ||
) |
Write non-interlaved samples from memory into an audio file on disk.
filename | the file to write to |
dataIn | a vector containing one vector of data per channel |
sampleRate | the sampling rate of the data |
std::vector< std::vector< float > > AudioFileUtilities::load | ( | const std::string & | filename, |
int | maxCount = -1 , |
||
unsigned int | start = 0 |
||
) |
Load audio samples from a file into memory.
Loads at most count
samples from each channel of filename
, starting from frame start
.
filename | the file to load |
maxCount | the maximum number of samples to load from each channel. Pass a negative value for no limit. |
start | the first sample to load. |
std::vector< float > AudioFileUtilities::loadMono | ( | const std::string & | file | ) |
Load audio samples from a file into memory.
Simplified version of load(), which only loads the first channel of the file.