Record into WAV file

前端 未结 2 356
心在旅途
心在旅途 2021-01-03 05:15

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

相关标签:
2条回答
  • 2021-01-03 05:34

    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).

    0 讨论(0)
  • 2021-01-03 05:47

    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);
     }
    
    0 讨论(0)
提交回复
热议问题