Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

native: prefer plughw: for speaker PCM + log negotiated format/channels

Speakers produced crunchy quiet audio on G7 — likely format/channel
mismatch between our S16_LE stereo config and what the SSP1 BE DAI
expects. Switch to plughw: wrapper as first-choice device, which adds
automatic format/rate/channel conversion. Also log actual negotiated
format + channels for diagnostics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+19 -5
+19 -5
fedac/native/src/audio.c
··· 1897 1897 char ucm_speaker_plug[80] = ""; 1898 1898 if (ucm_speaker_pcm[0]) { 1899 1899 snprintf(ucm_speaker_plug, sizeof(ucm_speaker_plug), 1900 - "plug%s", ucm_speaker_pcm); 1900 + "plughw%s", ucm_speaker_pcm + 2); /* hw:0,0 → plughw:0,0 */ 1901 1901 int n = 0; 1902 - devices_with_spk[n++] = ucm_speaker_pcm; 1902 + /* Prefer plug-wrapped device FIRST — the plug layer handles 1903 + * format/rate/channel conversion, which fixes the "crunchy 1904 + * quiet" audio on SOF boards where the SSP1 BE DAI runs at 1905 + * a different format than our S16_LE 48kHz stereo request. */ 1903 1906 devices_with_spk[n++] = ucm_speaker_plug; 1907 + devices_with_spk[n++] = ucm_speaker_pcm; 1904 1908 for (int i = 0; devices_default[i] && n < 15; i++) 1905 1909 devices_with_spk[n++] = devices_default[i]; 1906 1910 devices_with_spk[n] = NULL; ··· 2164 2168 audio->room_pos = 0; 2165 2169 } 2166 2170 2167 - fprintf(stderr, "[audio] ALSA: requested %dHz, got %uHz, period=%lu, buffer=%lu (%.1fms latency)\n", 2168 - AUDIO_SAMPLE_RATE, rate, (unsigned long)period, (unsigned long)buffer_size, 2169 - (double)period / rate * 1000.0); 2171 + /* Log the actual negotiated params — channels and format are 2172 + * particularly important for diagnosing the "crunchy quiet" bug 2173 + * on SOF boards where SSP1 may expect different bit depth. */ 2174 + { 2175 + snd_pcm_format_t fmt; 2176 + unsigned int ch = 0; 2177 + snd_pcm_hw_params_get_format(params, &fmt); 2178 + snd_pcm_hw_params_get_channels(params, &ch); 2179 + fprintf(stderr, "[audio] ALSA: %uHz %uch fmt=%s period=%lu buf=%lu (%.1fms)\n", 2180 + rate, ch, snd_pcm_format_name(fmt), 2181 + (unsigned long)period, (unsigned long)buffer_size, 2182 + (double)period / rate * 1000.0); 2183 + } 2170 2184 snprintf(audio->audio_status, sizeof(audio->audio_status), 2171 2185 "ok %uHz %lufrm", rate, (unsigned long)period); 2172 2186 if (rate != AUDIO_SAMPLE_RATE)