-
Notifications
You must be signed in to change notification settings - Fork 349
Description
Premise
I think that the loopback feature could be very useful in SOF. With loopback I basically mean a capture PCM from which we can read the samples that are written in playback. You can find this functionality in ALSA, known as ALSA Loopback. I think that performing the loopback job inside the DSP would be very useful. Developers who want to integrate its own echo canceller block can really take advantage of this feature.
I think that I have found a good example of that in sof-apl-demux-pcm512x.m4 topology.
I tried to port that topology into imx8 cs42888. You can find the m4 file here https://github.com/giuzan/sof/blob/c5f4111078e052597e233d3770d773f02f18f1e2/tools/topology/sof-imx8-cs42888-demux.m4.
The topology I build is shown in the following picture:
Unfortunately, I experienced an issue (see description below). It is the reason why I opened this [BUG]. If you think that the loopback topic is beyond this issue, please let me know if it should be treated as a proposed [FEATURE].
Describe the bug
If you run the command
arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav
the following error is printed
arecord: pcm_read:2149: read error: Input/output error
Moreover, if you arecord during an aplay, the playback stream stops until the arecord does not exit after the error.
To reproduce
arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav
or
aplay -D hw:1,0 file.wav & arecord -D hw:1,1 -c 2 -r 48000 -f S16_LE record.wav
Reproduction rate
100%
Expected behavior
The file record.wav recorded through the capture pipeline should contain the samples processed by the playback pipeline.
Impact
I cannot implement loopback for echo cancellation.
Environment
- Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
- Kernel: https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_5.4.47_2.2.0
- SOF: giuzan@c5f4111 (it basically is the imx-stable-v1.5 branch with the topology above applied)
- Name of the topology file
- Topology: sof-imx8-cs42888-demux.m4
- Name of the platform(s) on which the bug is observed.
- Platform: i.MX8QM
