Separate audio streams from ALSA driver

  alsa, audio, c++, libasound

I am using a USB sound card with 16 microphones on my Raspberry Pi (the device is the UMA 16).
Currently, I am collecting all 16 channels data and using up to 8 of them by separating their contents programmatically for an application that needs real time audio input, according to a configuration file which specifies which channels to use.
Is there any way to use the alsa driver API to provide data from up to 8 microphones specified by the user at runtime so I can avoid the extra 8 mic input?

I’m attaching the .asoundrc file that I wrote for the UMA 16:

pcm_slave.ins {
        pcm "hw:1,0"
        rate 16000
        channels 16
}
pcm.mic0 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 0
        }
}
pcm.mic1 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 1
        }
}
pcm.mic2 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 2
        }
}
pcm.mic3 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 3
        }
}
pcm.mic4 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 4
        }
}
pcm.mic5 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 5
        }
}
pcm.mic6 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 6
        }
}
pcm.mic7 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 7
        }
}
pcm.mic8 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 8
        }
}
pcm.mic9 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 9
        }
}
pcm.mic10 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 10
        }
}
pcm.mic11 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 11
        }
}
pcm.mic12 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 12
        }
}
pcm.mic13 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 13
        }
}
pcm.mic14 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 14
        }
}
pcm.mic15 {
        type plug
        slave.pcm {
                type dsnoop
                ipc_key 12342
                slave ins
                bindings.0 15
        }
}

Source: Windows Questions C++

LEAVE A COMMENT