wwmm / easyeffects

Limiter, compressor, convolver, equalizer and auto volume and many other plugins for PipeWire applications
GNU General Public License v3.0
6.41k stars 268 forks source link

Samplerate of soundcard against USB amplifier #2877

Closed servimo closed 7 months ago

servimo commented 7 months ago

My soundcard suports this samplerates:

$ grep -rH rates /proc/asound | cut -d : -f 2- | sort -u
    rates [0x0]:
    rates [0x160]: 44100 48000 96000
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000

My Amplifier supports more (+)256000, 352800 and 384000, when I use these samplerates, EasyEffects close. The sound continues without EasyEffects.
Is it a problem with EasyEffects? How can I debug this?

servimo commented 7 months ago

Ok I found, it is the latest lines of G_MESSAGES_DEBUG=easyeffects easyeffects:

(easyeffects:152245): easyeffects-DEBUG: 21:45:06.119:  limiter.cpp:139 soe: limiter latency: 0.005 s
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.119:  output_level.cpp:37 soe: output_level: PipeWire blocksize: 2048
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.120:  output_level.cpp:38 soe: output_level: PipeWire sampling rate: 352800
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.138:  convolver.cpp:282   soe: convolver: irs file: /home/sergio/.config/easyeffects/irs/Tin HiFi T2 minimum phase 48000Hz.irs
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.138:  convolver.cpp:283   soe: convolver: irs rate: 48000 Hz
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.138:  convolver.cpp:284   soe: convolver: irs channels: 2
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.138:  convolver.cpp:285   soe: convolver: irs frames: 4800
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.138:  convolver.cpp:308   soe: convolver resampling the kernel to 352800
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.150:  convolver.cpp:324   soe: convolver: kernel initialized
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.159:  convolver.cpp:442   soe: convolver: zita is ready
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.159:  effects_base.cpp:265    soe: pipeline latency: 5 ms
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.166:  convolver.cpp:242   soe: convolver latency: 0 s
(easyeffects:152245): easyeffects-DEBUG: 21:45:06.169:  effects_b
```ase.cpp:265  soe: pipeline latency: 5 ms
Morto

I already add these line to environment: PULSE_LATENCY_MSEC=120, is it the latency?

$ cat /proc/asound/Pro/pcm0p/sub0/hw_params access: MMAP_INTERLEAVED format: S32_LE subformat: STD channels: 2 rate: 352800 (352800/1) period_size: 1024 buffer_size: 32768

violetmage commented 7 months ago

@servimo can you post a full debug log of the crash(?), using G_MESSAGES_DEBUG=easyeffects ?

Also, what do you mean by amplifier? Is it an all-in-one unit, combining a DAC and an amp? Or something else?

wwmm commented 7 months ago

Morto

That sounds like the system killing EasyEffects because the audio processing became too heavy in the realtime thread. Which plugin were enabled? Just the convolver?

In any case not all plugins support such high sampling rate values. Look at https://github.com/wwmm/easyeffects/issues/2069#issuecomment-1664800368 for example. So even if we find a way to avoid your system killing EasyEffects most plugins won't work properly at the rate you are trying to use.

wwmm commented 7 months ago

In any case not all plugins support such high sampling rate values. Look at https://github.com/wwmm/easyeffects/issues/2069#issuecomment-1664800368 for example. So even if we find a way to avoid your system killing EasyEffects most plugins won't work properly at the rate you are trying to use.

Forget it. I did not pay attention to the fact the rate you are trying to use matches the maximum supported by LSP. So the audio processing being too heavy for the system to handle seems like the more plausible explanation. Either that or some limitation in the zita-convolver library.

servimo commented 7 months ago

It's a DAC (Digital-to-Analog Converter), "Moondrop Dawn Pro", I was just doing some tests on it, I always use rate 192000 and plays nice, I will stay with this. The plugin chain is convolver > limiter > level meter, but happen the same if I change convolver to equalizer.

servimo commented 7 months ago

Here is the full log:

$ G_MESSAGES_DEBUG=easyeffects easyeffects
(process:85590): easyeffects-DEBUG: 03:24:24.204:   easyeffects.cpp:35  easyeffects version: 7.1.3
(process:85590): easyeffects-DEBUG: 03:24:24.205:   easyeffects.cpp:45  locale directory: /usr/share/locale
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.210:   presets_manager.cpp:162 user presets directory already exists: /home/sergio/.config/easyeffects/
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.210:   presets_manager.cpp:162 user presets directory already exists: /home/sergio/.config/easyeffects/input
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.210:   presets_manager.cpp:162 user presets directory already exists: /home/sergio/.config/easyeffects/output
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.210:   presets_manager.cpp:162 user presets directory already exists: /home/sergio/.config/easyeffects/autoload/input
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.210:   presets_manager.cpp:162 user presets directory already exists: /home/sergio/.config/easyeffects/autoload/output
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.737:   pipe_manager.cpp:1481   compiled with PipeWire: 1.0.1
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.737:   pipe_manager.cpp:1482   linked to PipeWire: 1.0.1
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1452   core version: 1.0.1
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1453   core name: pipewire-0
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1364   found metadata: settings
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1219   Audio/Sink 35 roc-sink with serial 35 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1364   found metadata: default
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1364   found metadata: route-settings
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1364   found metadata: sm-objects
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1219   Audio/Sink 49 alsa_output.pci-0000_00_1b.0.analog-stereo with serial 50 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1219   Audio/Source 50 alsa_input.pci-0000_00_1b.0.analog-stereo with serial 51 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1219   Audio/Sink 125 alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.pro-output-0 with serial 253 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.744:   pipe_manager.cpp:1219   Stream/Output/Audio 116 foobar2000 Application with serial 287 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.745:   pipe_manager.cpp:1259   foobar2000 Application port 106 is connected to alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.pro-output-0 port 114
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.745:   pipe_manager.cpp:1259   foobar2000 Application port 115 is connected to alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.pro-output-0 port 137
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.745:   pipe_manager.cpp:1219   Audio/Sink 77 easyeffects_sink with serial 1065 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.745:   pipe_manager.cpp:1219   Audio/Source/Virtual 79 easyeffects_source with serial 1066 has been added
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.746:   pipe_manager.cpp:1578   easyeffects_sink node successfully retrieved with id 77 and serial 1065
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.746:   pipe_manager.cpp:1583   easyeffects_source node successfully retrieved with id 79 and serial 1066
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 0, default.configured.audio.sink, Spa:String:JSON, {"name":"alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.iec958-stereo"}
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 0, default.configured.audio.source, Spa:String:JSON, {"name":"alsa_input.pci-0000_00_1b.0.analog-stereo"}
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 0, default.audio.sink, Spa:String:JSON, {"name":"alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.pro-output-0"}
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 0, default.audio.source, Spa:String:JSON, {"name":"alsa_input.pci-0000_00_1b.0.analog-stereo"}
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 116, target.node, Spa:Id, 145
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.747:   pipe_manager.cpp:955    new metadata property: 116, target.object, Spa:Id, 911
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.753:   plugin_base.cpp:370 soe: output_level successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.755:   plugin_base.cpp:370 soe: spectrum successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.820:   lv2_wrapper.cpp:100 http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr requires feature: http://lv2plug.in/ns/ext/urid#map
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.860:   lv2_wrapper.cpp:100 http://lsp-plug.in/plugins/lv2/sc_limiter_stereo requires feature: http://lv2plug.in/ns/ext/urid#map
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.862:   plugin_base.cpp:370 soe: equalizer successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.862:   pipe_manager.cpp:1259   easyeffects_sink port 91 is connected to ee_soe_equalizer port 74
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.863:   pipe_manager.cpp:1259   easyeffects_sink port 73 is connected to ee_soe_equalizer port 111
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.865:   plugin_base.cpp:370 soe: limiter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.865:   pipe_manager.cpp:1259   ee_soe_equalizer port 133 is connected to ee_soe_limiter port 82
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.865:   pipe_manager.cpp:1259   ee_soe_equalizer port 136 is connected to ee_soe_limiter port 134
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.867:   plugin_base.cpp:370 soe: level_meter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.867:   pipe_manager.cpp:1259   ee_soe_limiter port 128 is connected to ee_soe_level_meter port 130
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.867:   pipe_manager.cpp:1259   ee_soe_limiter port 98 is connected to ee_soe_level_meter port 86
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.872:   plugin_base.cpp:370 sie: output_level successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.874:   plugin_base.cpp:370 sie: spectrum successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.876:   stream_output_effects.cpp:328   disconnecting the equalizer filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.878:   pipe_manager.cpp:213     113 ee_soe_equalizer has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.878:   stream_output_effects.cpp:328   disconnecting the level_meter filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.879:   pipe_manager.cpp:213     118 ee_soe_level_meter has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.879:   stream_output_effects.cpp:328   disconnecting the limiter filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.880:   pipe_manager.cpp:213     97 ee_soe_limiter has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.883:   plugin_base.cpp:370 soe: equalizer successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.884:   pipe_manager.cpp:1259   easyeffects_sink port 91 is connected to ee_soe_equalizer port 112
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.884:   pipe_manager.cpp:1259   easyeffects_sink port 73 is connected to ee_soe_equalizer port 70
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.886:   plugin_base.cpp:370 soe: limiter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.887:   pipe_manager.cpp:1259   ee_soe_equalizer port 68 is connected to ee_soe_limiter port 107
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.887:   pipe_manager.cpp:1259   ee_soe_equalizer port 97 is connected to ee_soe_limiter port 134
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.889:   plugin_base.cpp:370 soe: level_meter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.889:   pipe_manager.cpp:1259   ee_soe_limiter port 105 is connected to ee_soe_level_meter port 87
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.890:   pipe_manager.cpp:1259   ee_soe_limiter port 80 is connected to ee_soe_level_meter port 130
easyeffects-INFO: 03:24:24.898:     application.cpp:52  disabling global bypass
(easyeffects:85590): easyeffects-DEBUG: 03:24:24.936:   application_ui.cpp:91   Icon Theme Papirus detected
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.988:   stream_output_effects.cpp:328   disconnecting the equalizer filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.989:   pipe_manager.cpp:213     117 ee_soe_equalizer has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.989:   stream_output_effects.cpp:328   disconnecting the level_meter filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.990:   pipe_manager.cpp:213     86 ee_soe_level_meter has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.990:   stream_output_effects.cpp:328   disconnecting the limiter filter from PipeWire
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.991:   pipe_manager.cpp:213     123 ee_soe_limiter has been removed
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.994:   plugin_base.cpp:370 soe: equalizer successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.995:   pipe_manager.cpp:1259   easyeffects_sink port 91 is connected to ee_soe_equalizer port 111
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.995:   pipe_manager.cpp:1259   easyeffects_sink port 73 is connected to ee_soe_equalizer port 96
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.997:   plugin_base.cpp:370 soe: limiter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.998:   pipe_manager.cpp:1259   ee_soe_equalizer port 74 is connected to ee_soe_limiter port 82
(easyeffects:85590): easyeffects-DEBUG: 03:24:25.999:   pipe_manager.cpp:1259   ee_soe_equalizer port 123 is connected to ee_soe_limiter port 134
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.001:   plugin_base.cpp:370 soe: level_meter successfully connected to PipeWire graph
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.001:   pipe_manager.cpp:1259   ee_soe_limiter port 113 is connected to ee_soe_level_meter port 88
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.002:   pipe_manager.cpp:1259   ee_soe_limiter port 83 is connected to ee_soe_level_meter port 87
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.006:   application.cpp:80  new default output device: alsa_output.usb-MOONDROP_MOONDROP_Dawn_Pro_MOONDROP_Dawn_Pro-00.pro-output-0
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.006:   application.cpp:88  new default input device: alsa_input.pci-0000_00_1b.0.analog-stereo
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.007:   application.cpp:100 device alsa_card.pci-0000_00_1b.0 has changed its input route to: analog-input-front-mic
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.007:   application.cpp:132 device alsa_card.pci-0000_00_1b.0 has changed its output route to: analog-output-headphones
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.007:   application.cpp:152 output autoloading: the target node name does not match the output device name
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.009:   pipe_manager.cpp:955    new metadata property: 116, target.node, Spa:Id, 77
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.009:   pipe_manager.cpp:955    new metadata property: 116, target.object, Spa:Id, 1065
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.009:   pipe_manager.cpp:1259   foobar2000 Application port 106 is connected to easyeffects_sink port 92
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.009:   pipe_manager.cpp:1259   foobar2000 Application port 115 is connected to easyeffects_sink port 66
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.040:   limiter.cpp:139 soe: limiter latency: 0.005 s
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.040:   effects_base.cpp:265    soe: pipeline latency: 5 ms
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.042:   output_level.cpp:37 soe: output_level: PipeWire blocksize: 4096
(easyeffects:85590): easyeffects-DEBUG: 03:24:26.042:   output_level.cpp:38 soe: output_level: PipeWire sampling rate: 384000
(easyeffects:85590): easyeffects-DEBUG: 03:24:36.103:   stream_input_effects.cpp:168    No app linked to our device wants to play. Unlinking our filters.
Dead
servimo commented 7 months ago

I discovered something, if I disable the "Level Meter" filter, EasyEffects plays at rate of 384000. The one which is using more system resources is "Level Meter" with "Convolver" or "Equalizer" filter enabled. I see this in others predefinitions without using big rates (256000, 352800, 384000). When I use "pw-metadata -n settings 0 clock.force-rate 192000" to force use of 192000 I can enable "Level Meter", but as soon as I force the use of 384000 EasyEffects close.

*I am using this big rates to get the most of my DAC.

wwmm commented 7 months ago

When I use "pw-metadata -n settings 0 clock.force-rate 192000" to force use of 192000 I can enable "Level Meter", but as soon as I force the use of 384000 EasyEffects close.

Are you using oversampling in its configuration or just the default options? Oversampling will probably make it use more cpu.

servimo commented 7 months ago

When I use "pw-metadata -n settings 0 clock.force-rate 192000" to force use of 192000 I can enable "Level Meter", but as soon as I force the use of 384000 EasyEffects close.

Are you using oversampling in its configuration or just the default options? Oversampling will probably make it use more cpu.

I can't see any oversampling in the configuration of "Level Meter". I am just using "Convolver" or "Equalizer" and "Limiter". Maybe oversampling in the pipewire or alsa configs? Is in the Limiter? Sobreamostragem: nenhuma.

wwmm commented 7 months ago

I can't see any oversampling in the configuration of "Level Meter". I am just using "Convolver" or "Equalizer" and "Limiter".

Oops... For some bizarre reason I was thinking about the limiter plugin. That is what happens when we are answering multiple people at the same time :smile:

Just like the autogain the level meter can be quite heavy on resources because it is based on the libebur128 library.

servimo commented 7 months ago

It's ok to close this thread? Thanks for helping me out to find some explanation and possible solutions.

wwmm commented 7 months ago

It's ok to close this thread? Thanks for helping me out to find some explanation and possible solutions.

I think it is. There isn't much room to improve this plugin performance.

servimo commented 6 months ago

I reopen this issue just to clarify that the plugins using libebur128 are working nicely with changing in pipewire.conf "default.clock.max-quantum = 8192", witch is the " default.clock.quantum-limit=8192"