Open kanglue opened 3 months ago
It is what it says "SNDRV_PCM_IOCTL_HW_PARAMS" invalid hardware parameters - when you interact with the hardware directly, with "device=plughw=2,0", only a few specific bit rates etc are supported. You need to either re-sample the audio before putting the data through, or use one of the "transcoding" virtual devices created by the driver.
Or you might be missing the alsa transcoding plug in?
Something to do with https://github.com/respeaker/seeed-voicecard/tree/master/ac108_plugin , I think. Anyway, it is rather a generic alsa question - let alsa do the re-sampling for you (choose one of the re-sampling "devices"), or you do the re-sampling yourself.
Have you tried just doing -ao alsa
? It probably will goes to the right place.
Btw, the two-mics device hasn't got any playback ability, so you are just using the pi's own on-board sound chip, which isn't a seeedstudio device!
A 3rd option: mplayer itself has audio re-sampling functionality, I think under -af
or something. Look at "audio filtering" in the mplayer documentation.
Describe the bug
mplayer -ao alsa:noblock:device=plughw=2,0 xxx.mp3
Expected behavior
mp3 file can be played.
Platform
Raspberry Pi 4b Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Raspberrypi 4b, Installed card success.
aplay -l 2: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0
use mplay can play wav file normally, like this
mplayer -ao alsa:noblock:device=plughw=2,0 /home/ianglei/music/test.wav MPlayer 1.4 (Debian), built with gcc-10 (C) 2000-2019 MPlayer Team do_connect: could not connect to socket connect: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing /home/ianglei/music/test.wav. libavformat version 58.45.100 (external) Audio only file format detected. Load subtitles in /home/ianglei/music/
Opening audio decoder: [pcm] Uncompressed PCM audio decoder AUDIO: 16000 Hz, 1 ch, s16le, 256.0 kbit/100.00% (ratio: 32000->32000) Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
AO: [alsa] 16000Hz 1ch s16le (2 bytes per sample) Video: no video Starting playback… A: 4.5 (04.5) of 5.0 (05.0) 0.1%
Exiting… (End of file)
but play m4a or mp3 failed, I want to know why?
mplayer -ao alsa:noblock:device=plughw=2,0 /home/ianglei/music/horse.mp3 MPlayer 1.4 (Debian), built with gcc-10 (C) 2000-2019 MPlayer Team do_connect: could not connect to socket connect: No such file or directory Failed to open LIRC support. You will not be able to use your remote control.
Playing /home/ianglei/music/horse.mp3. libavformat version 58.45.100 (external) Audio only file format detected. Load subtitles in /home/ianglei/music/
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III AUDIO: 44100 Hz, 2 ch, s16le, 32.0 kbit/2.27% (ratio: 4000->176400) Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
[AO_ALSA] alsa-lib: pcm_hw.c:386:(snd_pcm_hw_hw_params) SNDRV_PCM_IOCTL_HW_PARAMS failed (-22): Invalid argument [AO_ALSA] Unable to set hw-parameters: Invalid argument Failed to initialize audio driver ‘alsa:noblock:device=plughw=2’ No such audio driver ‘0’ Could not open/initialize audio device → no sound. Audio: no sound Video: no video
Relevant log output
No response