First second of sound playback is silent
Describe the bug First second of sound playback is silent on__some__ sound devices, appears only after a delay of over ~1 second
To Reproduce Steps to reproduce the behavior:
dd if=/dev/random of=/dev/dsp
Expected behavior Sound appears immediately without delay
Version (please complete the following information):
- All helloSystem versions
Computer (please complete the following information):
- Device: Dell Inc. OptiPlex 780
Additional context
./sysctl:dev.pcm.2.%desc: NVIDIA (0x0060) (HDMI/DP 8ch)
./sysctl:dev.pcm.1.%desc: NVIDIA (0x0060) (HDMI/DP 8ch)
./sysctl:dev.pcm.0.%desc: NVIDIA (0x0060) (HDMI/DP 8ch)
./sysctl: Pin cap: 0x09000094 PDC OUT HDMI DP HBR
./sysctl: Pin cap: 0x09000094 PDC OUT HDMI DP HBR
./sysctl: Pin cap: 0x09000094 PDC OUT HDMI DP HBR
./sysctl: Pin cap: 0x09000094 PDC OUT HDMI DP HBR
./dmesg:pcm0: <NVIDIA (0x0060) (HDMI/DP 8ch)> at nid 4 on hdaa0
./dmesg:pcm1: <NVIDIA (0x0060) (HDMI/DP 8ch)> at nid 5 on hdaa0
./dmesg:pcm2: <NVIDIA (0x0060) (HDMI/DP 8ch)> at nid 7 on hdaa0
cc @mekanix
Possibly related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242139
FreeBSD% sysctl dev.pcm | grep "buffersize"
dev.pcm.3.buffersize: 0
dev.pcm.2.buffersize: 65536
dev.pcm.1.buffersize: 65536
dev.pcm.0.buffersize: 65536
pcm3 is a (good) USB audio device, and on that the sound playback is instant. On the others, it takes over a second. Which means that short sounds like our new alert sounds are not audible at all because they are shorter than that.
Maybe devices with buffersize: 65536 have the issue.
But how to change it?
% sudo sysctl dev.pcm.0.buffersize=0
sysctl: oid 'dev.pcm.0.buffersize' is read only
% sudo sysctl hw.snd.latency=0
% sudo sysctl hw.snd.latency_profile=0
does not fix this.
Setting hint.pcm.0.buffersize=0 in /boot/loader.conf results in:
sysctl dev.pcm.0.buffersize
dev.pcm.0.buffersize: 256
but does not fix the issue. But the sound is very stuttery now.
When other sound is already playing, then playing additional sounds is instant. So do I have to play some "silent sound" all the time in the background as a workaround?