mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
3.96k stars 348 forks source link

recording multi channel #860

Closed koen1711 closed 3 months ago

koen1711 commented 3 months ago

I want to record 32 channels to all different files but I can't find how to do so?

koen1711 commented 3 months ago

I'll add some more, for some reason channels 4,5,6 keep not working and not showing any sound input while I know they are getting input

mackron commented 3 months ago

So if you initialize the device with a channel count of zero in the device config, miniaudio will use the device's native channel count and should pass it through to your callback unmodified except for sample format conversion and resampling, if necessary. This is assuming your device natively supports 32 channels or course.

deviceConfig.capture.channels = 0; // <-- This will tell miniaudio to use the "native" channel count as reported by the backend.

To output each channel to a separate file, you'll need to deinterleave the samples and make sure you're outputting to the correct format (easiest way is to specify the format in the device config). Then it's just a matter doing standard file I/O.