c - How to access to L and R channel samples of stereo audio file separately? -
suppose have 8-bits (mono , stereo) .wav files. when processing of file have declare pointer array of samples.
suppose create array samples. if mono, read each sample using for(i = 0; < n; i++ ).
q: how can access right , left channels separately (stereo)?
ps
i've read lot "mono, stereo , *.wave" still can't understand how can realise access each channell separately...
you still have array of samples, question how address individual values. how it:
const uchar* pnsamples = ... if(bmono) { for(int nindex = 0; ...) { const uchar nsample = pnsamples[nindex]; // ... } } else if(bstereo) { for(int nindex = 0; ...) { const uchar nleftsample = pnsamples[2 * nindex + 0]; const uchar nrightsample = pnsamples[2 * nindex + 1]; // ... } }
Comments
Post a Comment