Hello,
Am currently unsing the PCM/I2S interface to communicate with a custom DSP. This custom DSP provides 4 mono channels 16bits 16Khz.
As the I2S interface of the RPI is limited to stereo, I have modified the DSP to pack 2 mono 16 bits channels into 1 channel of 32bits. Therefore , I have a stereo soundcard in alsa (with my 4 original channels packed in pair 1+2 / 3+4).
For the moment, the main application is written in python using pyaudio. Therefore, I have a function to unpack the stereo channels into 4 streams and another one to pack back the streams into the stereo channels. It is working as expected.
However as the DSP could be used by other applications in the future, I would like to have each mono channel as a soundcard in ALSA (or alternatively a soundcard with 4 channels).
As I am not an expert in linux kernel drivers or alsa drivers, I am wondering if it is possible to do such things ?
At the moment, my kernel module is based on this project : https://github.com/PaulCreaser/rpi-i2s-audio
I have seen that the bcm2835-i2s.c is using DMA, so I don't know where the unpacking/packing function should be implemented.
Another solution I am thinking of, is creating 4 virtual soundcards in Alsa (using asoundrc file) and making a userspace script making the transfert between the DSP soundcard and the 4 virtual ones.
Thank you for your help.
Am currently unsing the PCM/I2S interface to communicate with a custom DSP. This custom DSP provides 4 mono channels 16bits 16Khz.
As the I2S interface of the RPI is limited to stereo, I have modified the DSP to pack 2 mono 16 bits channels into 1 channel of 32bits. Therefore , I have a stereo soundcard in alsa (with my 4 original channels packed in pair 1+2 / 3+4).
For the moment, the main application is written in python using pyaudio. Therefore, I have a function to unpack the stereo channels into 4 streams and another one to pack back the streams into the stereo channels. It is working as expected.
However as the DSP could be used by other applications in the future, I would like to have each mono channel as a soundcard in ALSA (or alternatively a soundcard with 4 channels).
As I am not an expert in linux kernel drivers or alsa drivers, I am wondering if it is possible to do such things ?
At the moment, my kernel module is based on this project : https://github.com/PaulCreaser/rpi-i2s-audio
I have seen that the bcm2835-i2s.c is using DMA, so I don't know where the unpacking/packing function should be implemented.
Another solution I am thinking of, is creating 4 virtual soundcards in Alsa (using asoundrc file) and making a userspace script making the transfert between the DSP soundcard and the 4 virtual ones.
Thank you for your help.
Statistics: Posted by cluternam — Fri Jan 10, 2025 7:11 pm