[LAD] using libsndfile to write signed short
Harry van Haaren
harryhaaren at gmail.com
Sat Sep 27 08:36:38 UTC 2014
On Sat, Sep 27, 2014 at 6:11 AM, Joël Krähemann <weedlight at gmail.com> wrote:
> Am I correct assuming 1 sample of stereo frames will be written 44100
> times by a rate of 44100 Hz audio sampled data?
Yes. Just to be 100% clear, a "sample" is a *single* point of data.
In a mono situation: a "frame" refers to the single sample for that channel.
In stereo: a "frame" refers to 2 samples, one for *each* channel.
So the difference between a frame and a sample is that a sample is
literally a single data point, while a frame is a single "data point"
for each channel.
> Whereby one sample contains 2 frames.
See above :)
> CHANNELS = 2
> buffer_size_per_second = CHANNELS * 44100 * sizeof(signed short);
Yep. The link below is useful for double checking, and for quick disk
I've written a tutorial on using SndFile to write to disk: perhaps a
useful resource to check / play with:
More information about the Linux-audio-dev