[LAD] using libsndfile to write signed short

Joël Krähemann weedlight at gmail.com
Sat Sep 27 10:34:38 UTC 2014


On sab, 2014-09-27 at 09:36 +0100, Harry van Haaren wrote:
> 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
> space calculations:
> http://www.sounddevices.com/calculator/
> 
> I've written a tutorial on using SndFile to write to disk: perhaps a
> useful resource to check / play with:
> https://github.com/harryhaaren/openAudioProgrammingTutorials/blob/master/writingSoundfileToDisk/writingSoundfileToDisk.cpp
> 
> HTH, -Harry
> 
Do you know that WAV is interleaved? Currently I'm looking for something
like encoding multi-channel sources.





More information about the Linux-audio-dev mailing list