[Libav-user] Converting audio sample buffer format
"René J.V. Bertin"
rjvbertin at gmail.com
Tue Feb 26 12:39:12 CET 2013
On Feb 26, 2013, at 02:54, Brad O'Hearne wrote:
expound a little bit on what your best guess is on how a buffer would be laid out to accommodate a sample format as the one I am being handed from capture:
> - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz
You realise that your earlier message mentioned 32 bit float capture data?
> I understand this is the QTSampleBuffer byte buffer, which is QTKit (and FWIW I have a question out on the QuickTime API mailing list about this too), but perhaps with the audio knowledge on this list you can speculate on a structure for that data, which I can verify in code. From there, perhaps with a little more guidance on how AV_SAMPLE_FMT_S16 samples are laid out, I can just write my own resampling algorithm.
If I understand correctly, you want to know how audio samples are stored in your buffer. This shouldn't be too difficult to figure out as you have only 2 channels of 1 dimensional, temporal data. That is, you know that each channel contains a sequential series of integers with 24 bit resolution (possibly size), and from what I read you know that those 2 channels are contained in a single array that you obtain from the QTKit API. All you have to do is put a short, known input signal into your capture procedure, and plot the data in your array. Use block wave at first, in counter phase between the channels.
You can also save the array to file and see if a programme like Audacity can import it correctly, and with what settings. I've already gone that road to identify audio data extracted from a proprietary AV container format.
More information about the Libav-user