bmc0 / dsp

An audio processing program with an interactive mode.
ISC License
219 stars 31 forks source link

Brief Sounds Sometimes Repeat #25

Closed alraban closed 6 years ago

alraban commented 6 years ago

I'm using dsp for system-wide audio processing for a pair of active bi-amped speakers. This is running on 64-bit Arch Linux using the pulseaudio configuration instructions from the wiki article: https://github.com/bmc0/dsp/wiki/System-Wide-DSP-Guide. The dsp package was installed via the arch AUR package, but I see the same results when installing it manually from source. The package works very well with music (thanks so much!), but sometimes with system sounds I get strange behavior.

The easiest way to reproduce it is to do something in the terminal or emacs that cause a terminal bell. The bell noise (especially if it repeats two or three times because you're holding a key down) will continue to recur every second or so after the terminal has stopped actually making the bell noise. This continues indefinitely as long as there's no new audio input. This sounded like "sound followed by silence" so perhaps another version of the denormal issue identified as a known issue, but adding very low-level noise (-190) did not affect the issue.

My ladspa-dsp config:

input_channels=2 output_channels=8 effects_chain=noise -192 remix 0 1 0 1 0 1 0 1 :0,1 highpass 350 0.707 highpass 350 0.707 gain -5.5 delay 0.00041 eq 106 5.27 -5.7 eq 142 3.71 6 eq 201 2.96 -5.5 eq 298 2.86 -4.5 eq 353 14.6 3.1 eq 404 14.5 6 eq 472 5.34 -4 eq 598 4.65 -6 eq 808 5.27 -2.5 eq 1261 1.18 1 eq 1593 8.55 -1.4 eq 2228 2.86 2 eq 2525 9.3 -3.4 eq 4034 2.66 2 eq 9987 2.34 -5 eq 12k 2 -16 eq 14k 6 -6 eq 16k 1.95 -16 eq 19k 1 -16 :2,3 lowpass 350 .707 lowpass 350 .707 eq 35 14.8 -2.6 eq 59 3.7 -3 eq 112 2.29 -6.4 eq 119 4.2 6 eq 191 2 -2.9 eq 241 7.94 -1.8 eq 315 2.1 -5.1 eq 430 20.6 1.3 eq 597 4.1 -7 eq 923 2.26 6 :4,5 lowpass 350 .707 lowpass 350 .707 eq 35 14.8 -2.6 eq 59 3.7 -3 eq 112 2.29 -6.4 eq 119 4.2 6 eq 191 2 -2.9 eq 241 7.94 -1.8 eq 315 2.1 -5.1 eq 430 20.6 1.3 eq 597 4.1 -7 eq 923 2.26 6 :6,7 lowpass 350 .707 lowpass 350 .707 eq 35 14.8 -2.6 eq 59 3.7 -3 eq 112 2.29 -6.4 eq 119 4.2 6 eq 191 2 -2.9 eq 241 7.94 -1.8 eq 315 2.1 -5.1 eq 430 20.6 1.3 eq 597 4.1 -7 eq 923 2.26 6

Let me know if I can provide any additional info.

bmc0 commented 6 years ago

I haven't been able to reproduce this exactly, but I did get PulseAudio to do some strange things (pops, crackles, even skipping part of the sound). PulseAudio sends the LADSPA plugin a continuous audio stream the whole time and never changes the buffer size, so if the problem was the LADSPA plugin itself, I would expect it to occur with any kind of sound. So, in short, this is probably a PulseAudio bug.

Am I correct in assuming that this problem does not occur when you do not have the LADSPA plugin loaded? If so, try loading a different LADSPA plugin, such as amp.so from the ladspa package:

load-module module-ladspa-sink sink_name=amp master=<sinkname> plugin=amp label=amp_mono channels=8 control=1

This sounded like "sound followed by silence" so perhaps another version of the denormal issue identified as a known issue

Denormal values do not cause this kind of problem; they just cause a large increase in CPU usage (see this section of the Wikipedia page for more info). Note that this isn't a "bug" per se, I just decided that it would be better to let the user decide how they wish to deal with it.

An unrelated note: You seem to have the same effects repeated multiple times (for channels 2&3, 4&5, and 6&7). Unless there's a specific reason for doing this, you can replace :2,3 with :2-7 and then delete :4,5 and everything after it:

noise -192 remix 0 1 0 1 0 1 0 1 :0,1 highpass 350 0.707 highpass 350 0.707 gain -5.5 delay 0.00041 eq 106 5.27 -5.7 eq 142 3.71 6 eq 201 2.96 -5.5 eq 298 2.86 -4.5 eq 353 14.6 3.1 eq 404 14.5 6 eq 472 5.34 -4 eq 598 4.65 -6 eq 808 5.27 -2.5 eq 1261 1.18 1 eq 1593 8.55 -1.4 eq 2228 2.86 2 eq 2525 9.3 -3.4 eq 4034 2.66 2 eq 9987 2.34 -5 eq 12k 2 -16 eq 14k 6 -6 eq 16k 1.95 -16 eq 19k 1 -16 :2-7 lowpass 350 .707 lowpass 350 .707 eq 35 14.8 -2.6 eq 59 3.7 -3 eq 112 2.29 -6.4 eq 119 4.2 6 eq 191 2 -2.9 eq 241 7.94 -1.8 eq 315 2.1 -5.1 eq 430 20.6 1.3 eq 597 4.1 -7 eq 923 2.26 6
alraban commented 6 years ago

You're correct it does not occur without Ladspa plugins loaded. I tried your test, and I see similar results with other ladpsa plugins, so it's definitely pulse being odd and not a bug with ladspa-dsp.

FWIW I've gotten pops and crackles with pulse and ladspa plugins as well (especially on volume changes), so I can confirm those as well. Those also seem to occur with all ladspa plugins, so it sounds like its definitely pulse's problem. that's unfortunate, because its getting increasingly hard to run a pulse-less system (some browsers and audio programs are dropping direct alsa output support entirely, etc.) so I was hoping to get things working well with pulse.

I'll try setting things up as an ALSA sink and see if that improves things.

Thanks very much for the tip on channel consolidation, I must have missed that in the config examples.