Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

usb_audio.USBSpeaker: Speaker audio does not adjust based on Windows volume slider/mute.

未关闭
#11,302 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@peterbay 已经在做这个了。

开始于 2026年9月14日。

  • #11386 来自 @peterbay —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
c
领域
embedded-iot

调研方向

Start by reading the Feature Unit descriptor in shared-module/usb_audio/init.c and tracing how volume and mute are handled in tud_audio_set_req_entity_cb, usb_audio_usbspeaker_background_drain(), and usb_audio_usbspeaker_get_buffer(). Determine which behavior the project should adopt: apply the controls to samples, stop advertising them, or expose them to Python. Done means Windows volume and mute work as expected under the chosen approach, with relevant tests or verification documented.

由索引模型根据 Issue 内容生成。

描述

audio bug enhancement usb
CircuitPython version and board name
Adafruit CircuitPython 10.3.0-alpha.4; Adafruit QT Py RP2040 with rp2040
Code/REPL
# in boot.py
import usb_audio
usb_audio.enable(speaker=True, microphone=False)
Behavior

The device correctly registers to Windows 11 Pro 25H2 as a CircuitPython Speaker but adjusting the master volume slider or muting it at the Windows level has no effect on the audio.

Description

No response

Additional information

AI Analysis (Cursor Grok 4.6)

Windows volume does nothing because USBSpeaker claims hardware volume, then never applies it.

The taskbar slider and keyboard volume keys are endpoint volume. On a USB Audio Class 2 speaker, Windows treats that as a hardware Feature Unit control: it sends full-scale PCM and a SET_CUR volume/mute request, and it does not insert a software volume APO.

CircuitPython does the first half of that contract and skips the second.

  1. The descriptor advertises a real volume control. The speaker Feature Unit marks mute and volume as read/write on master and both channels:

shared-module/usb_audio/init.c
Ln 173–174
/* Feature Unit Descriptor(4.7.2.8) */
TUD_AUDIO20_DESC_FEATURE_UNIT(..., AUDIO20_CTRL_RW << MUTE | AUDIO20_CTRL_RW << VOLUME, ...)
Windows therefore binds the system slider to hardware and will not attenuate the stream itself.

  1. Firmware stores the host’s volume, then ignores it. tud_audio_set_req_entity_cb writes usb_audio_mute[] / usb_audio_volume[]. Those arrays are only read back for GET_CUR / GET_RANGE. They are never used when samples are copied.

usb_audio_usbspeaker_background_drain() and usb_audio_usbspeaker_get_buffer() memcpy the USB PCM unchanged. There is no scale, no mute-to-zero, and USBSpeaker exposes no volume/mute property you could apply in Python.

So the slider moves (the SET_CUR succeeded) and the speaker stays at unity gain.

  1. That is why this is a Windows-specific complaint. macOS and Linux often still apply software volume in the host mixer. Windows does not, once a Feature Unit Volume control exists. Per-app sliders in Volume Mixer can still work, because those are session volumes applied before USB. System / keyboard volume cannot.

A firmware fix has to do one of these:

Apply it: scale (and mute) each sample from the per-channel Feature Unit values. Windows prefers channel 1/2 over master when both are advertised.

Stop claiming it: clear Volume/Mute from the Feature Unit so Windows inserts its software volume APO instead.
Until one of those lands, the host-side workaround is the same as for DACs that advertise volume and ignore it: force software attenuation (WinSoftVol, Equalizer APO, or the per-app mixer).

Delegate it: expose the audio channel mute and audio channel volume parameters from Windows and let other code decide what to do with it.

主要语言
C
星标
4.6k
派生
1.4k
平均合并
1 天 8 小时
30 天内合并 PR
153

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

adafruit/circuitpython 的其他 Issue

查看 adafruit/circuitpython 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。