Since I\'ve posted this question, I\'ve been trying to write a valid WAV file myself from raw PCM data. I\'ve managed to write the FLAC converter (tested and works), but it
Error codes returned by snd_
* functions are negative.
There are functions that can return a positive value to indicate success (e.g., snd_pcm_readi
returns the number of frames).
TRY THIS:
printf("Channels: %d\n", hdr->number_of_channels);
for (i = 0; i < 2*16000/128; i++)
{
printf("\n Recording %d",i);
err = snd_pcm_readi(handle, buffer, frames);
write(filedesc, buffer, size);
}