Hi all.
I'm using ALSA to configure a dmic. My dmic only support format S32_LE
but I also need support format S16_LE.

arecord -D hw:0,4 --dump-hw-params
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "hw:0,4":
--------------------
ACCESS:  RW_INTERLEAVED
FORMAT:  S32_LE
......
Available formats:
- S32_LE

If I understood correctly, If I use "plug" plugin, it create an
automatic format-conversion. To do so, I create a custom asounf.conf
using the "plug" plugin.

pcm.!default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "hw:0,0"
        }
        capture.pcm {
                type plug
                slave.pcm "hw:0,4"
}

For a quick example, I used the arecord command. First I use S32_LE
and it works.
arecord -r 16000 -f S32_LE -c 1 -d 3 rec.wav
Recording WAVE 'rec.wav' : Signed 32 bit Little Endian, Rate 16000 Hz....

But when I try rec a audio with format S16_LE, It fails.

arecord -r 16000 -f S16_LE -c 1 -d 3 rec.wav
Recording WAVE 'rec.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
arecord: set_params:1361: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 16000
PERIOD_TIME: 32000
PERIOD_SIZE: 512
PERIOD_BYTES: 1024
PERIODS: 6
BUFFER_TIME: 192000
BUFFER_SIZE: 3072
BUFFER_BYTES: 6144

Is it possible to make an automatic format conversion?
Is there any way to solve this problem?


_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to