ITADN

Cannot use ALSA's `dmix` output

#235Openjessicah 创建于 2025-12-05
J
jessicahcommented
Trying to run `scream` with the `dmix` output, it fails due to an unsupported sample format: ``` $ ./scream -o alsa -d dmix:CARD=sndrpihifiberry,DEV=0 -v Using ASLA output ALSA lib pcm.c:8847:(snd_pcm_set_params) Sample format not available for PLAYBACK: Invalid argument snd_pcm_set_params: Invalid argument ``` It seems to be an issue with `scream` setting a "default" sample rate that doesn't match the available format(s), as indicated by using the raw output and piping into `aplay`: ``` $ ./scream -o raw | aplay -D dmix:CARD=sndrpihifiberry,DEV=0 Playing raw data 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono aplay: set_params:1387: Sample format non available Available formats: - S32_LE ``` And indeed, when running `scream` with `plughw` instead of `dmix`, you can see it starting with S16_LE/44kHz, then switching to S32_LE/48kHz: ``` $ ./scream -o alsa -d plughw:CARD=sndrpihifiberry,DEV=0 -v -u Using ALSA output Plug PCM: Hardware PCM card 3 'snd_rpi_hifiberry_dacplus' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 2205 period_size : 735 period_time : 16666 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 735 period_event : 0 start_threshold : 2205 stop_threshold : 2205 silence_threshold: 0 silence_size : 0 boundary : 1156055040 appl_ptr : 0 hw_ptr : 0 Starting unicast receiver Channel 0 mapped to Front Left Channel 1 mapped to Front Right Plug PCM: Hardware PCM card 3 'snd_rpi_hifiberry_dacplus' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S32_LE subformat : STD channels : 2 rate : 48000 exact rate : 48000 (48000/1) msbits : 32 buffer_size : 2400 period_size : 600 period_time : 12500 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 600 period_event : 0 start_threshold : 2400 stop_threshold : 2400 silence_threshold: 0 silence_size : 0 boundary : 1258291200 appl_ptr : 0 hw_ptr : 0 Switched format to sample rate 48000, sample size 32 and 2 channels. ``` My goal is to be able to run both `scream` and `squeezelite` side-by-side on the same system, which would require using the `dmix` endpoint, otherwise I cannot run both.
1 条评论