bmc0 / dsp

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

Problem getting individual eq to each speaker #57

Closed kzuu closed 3 years ago

kzuu commented 3 years ago

I can get everything to work if I just apply same EQ settings to every speaker, but I seem to have a really hard time to understand how to get things done individually for every speaker. I have Focusrite 6i6 soundcard, connected to two active speakers. According to pacmd list-sinks channel output is front-left,front-right,lfe. So far i've tried almost everything as input_channels and output_channels. 2 and 2, 6 and 6 and everything else. This is what I have atm, can't load dsp: input_channels=6 output_channels=6

Output mapping: [front-left,front-right,lfe]

remix 0 1 0,1 :0,2 eq 100 5 15 :1,2 eq 100 5 -15

I'm trying to just get -15db at 100hz on other speaker and +15 at the other, just to clearly hear if I succeed in equalizing both speakers individually. Also apply the same eq to lfe channel and send it equal amount to both speakers. Not sure if it actually works like that, I don't have a subwoofer but since it's there at channel output I'm doing that... any help, I probably am completely misunderstanding how this should be done..

zalerion commented 3 years ago

Hi there,

if you elaborate on your setup it might help to find the mistake. E.g which OS, where does your sound come from? What are you trying to do?

Is there any additional information, other than cannot load dsp? When I had something wrong with in/out channels, this was specifically in the error messages. Cannot load dsp points more to a missing config file.

To the routing problem:

Afaik the focusrite does not have an LFE channel. LFE is the bass effect channel of movies. It contains this and only this. So I assume you want to play movies?

you are not mixing like you say. What you are doing is creating an additional mono sum, then applying your filters to left and right seperatily and both to sum, and then nothing. So you are using in=2, out=3.

Maybe use a dead simple EQ like no remix, no channels and just a gain or something to exclude this as a possibility for an error. And check for the correct config file in the path of your OS. I had to create this path and file by hand, so maybe that is the problem.

kzuu commented 3 years ago

So, I'm running Arch Linux with the said Focusrite and two KRK Rokit5 active speakers. The eq works if I drop all the input and output channels from the config, and just use basic eq without trying to eq speakers individually. pacmd load-module module-ladspa-sink sink_name=dsp master=alsa_output.usb-Focusrite_Scarlett_6i6_USB_00034623-00.analog-surround-21 plugin=ladspa_dsp label=ladspa_dsp

and

pacmd set-default-sink dsp

work when i'm not trying to remix and set input and output channels and only apply same eq to every speaker. I would like to however run different eq to both speakers, mainly room correction made with room eq wizard. The dsp sink does not get made with the above command with my config for individual eq. Pulseaudio list-sinks tells me I have left, right and lfe channel, and yes, i'm not running subwoofers and don't have channel for it in my card, it only has stereo output for speakers. that's the reason i'm trying to send lfe info to left and right speakers. I guess you could somehow just modify it to stereo output..

zalerion commented 3 years ago

As I was saying, your remix creates 3 from 2 channels.

maybe try: remix 0 1 # shouldn't do anything :0 eq 100 5 15 :1 eq 100 5 -15

or assuming your LFE actually has any signal and is the third channel remix 0,2 1,2 :0 eq 100 5 15 :1 eq 100 5 -15

Also 5 is a very large/uncommon value for q. 0.7 would be more "standard" ;)

As I only used alsa I cannot comment on anything with pulseaudio

kzuu commented 3 years ago

I just can't get it to load the dsp sink. I guess it is something to do with those input and output channels now, those remix settings didn't fix it for me. I can live with combined averaged eq, but got the best sounding results with Equalizer APO on Windows 10 with individual eq for both speakers. Still, thank you once more for your help.

bmc0 commented 3 years ago

output_channels must be set correctly. In your original example, the actual number of output channels from the effects chain is 3. Also, I'm not sure if you mistyped it, but your configuration file is invalid (see the README). This should do what you want:

input_channels=6
output_channels=6
effects_chain=remix 0,2 1,2 . . . . :0 eq 100 1 15 :1 eq 100 1 -15 :

I changed the Q to 1. You can put the effects chain in a separate file if you want to use multiple lines and comments (see the README section linked above).

bmc0 commented 3 years ago

Oh, and if you only have 2 speakers, it'd be better practice to set input_channels and output_channels to 2 and let pulseaudio deal with upmixing and/or downmixing:

input_channels=2
output_channels=2
effects_chain=:0 eq 100 1 15 :1 eq 100 1 -15 :
kzuu commented 3 years ago

Now my config at ~/.config/ladspa_dsp/config is as above. It still doesn't create that dsp sink...

I try to create it with pacmd load-module module-ladspa-sink sink_name=dsp master=alsa_output.usb-Focusrite_Scarlett_6i6_USB_00034623-00.analog-surround-21 plugin=ladspa_dsp label=ladspa_dsp which I think should be fine and works when only trying to apply one eq for every channel... I attached pacmd list sinks output if it helps anything.

sinks.txt

bmc0 commented 3 years ago

Try running pulseaudio and ladspa_dsp in verbose mode:

$ pulseaudio -k
$ LADSPA_DSP_LOGLEVEL=VERBOSE pulseaudio -v

Please attach the output.

kzuu commented 3 years ago

$ pulseaudio -k $ LADSPA_DSP_LOGLEVEL=VERBOSE pulseaudio -v I: [pulseaudio] main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted I: [pulseaudio] main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted I: [pulseaudio] core-util.c: Successfully gained nice level -11. I: [pulseaudio] main.c: This is PulseAudio 14.0 I: [pulseaudio] main.c: Page size is 4096 bytes I: [pulseaudio] main.c: Machine ID is b2644e1bef83470d918631f4bbee30c8. I: [pulseaudio] main.c: Session ID is 2. I: [pulseaudio] main.c: Using runtime directory /run/user/1000/pulse. I: [pulseaudio] main.c: Using state directory /home/tpakkila/.config/pulse. I: [pulseaudio] main.c: Using modules directory /usr/lib/pulse-14.0/modules. I: [pulseaudio] main.c: Running in system mode: no E: [pulseaudio] pid.c: Daemon already running. E: [pulseaudio] main.c: pa_pid_file_create() failed.

bmc0 commented 3 years ago

I forgot that pulseaudio restarts automatically by default. Try this:

$ systemctl --user stop pulseaudio.socket
$ systemctl --user stop pulseaudio.service
$ pulseaudio -k
$ LADSPA_DSP_LOGLEVEL=VERBOSE pulseaudio -v

If pulseaudio still autospawns, you can try adding

autospawn=no

to ~/.config/pulse/client.conf and also run

$ systemctl --user mask pulseaudio.socket

(change mask to unmask to revert).

kzuu commented 3 years ago

okay, here it is. output.txt

bmc0 commented 3 years ago

Thanks, but I also need the the output after you try to load the LADSPA plugin in order to see why it isn't loading.

kzuu commented 3 years ago

This came after starting it: W: [pulseaudio] module-ladspa-sink.c: The 'master' module argument is deprecated and may be removed in the future, please use the 'sink_master' argument instead. ladspa_dsp: info: config path: /home/tpakkila/.config/ladspa_dsp:/etc/ladspa_dsp ladspa_dsp: info: opened config dir: /home/tpakkila/.config/ladspa_dsp ladspa_dsp: info: read config file: /home/tpakkila/.config/ladspa_dsp/config ladspa_dsp: info: failed to open config dir: /etc/ladspa_dsp: No such file or directory E: [pulseaudio] module-ladspa-sink.c: Cannot handle non-integral number of plugins required for given number of channels E: [pulseaudio] module.c: Failed to load module "module-ladspa-sink" (argument: "sink_name=dsp master=alsa_output.usb-Focusrite_Scarlett_6i6_USB_00034623-00.analog-surround-21 plugin=ladspa_dsp label=ladspa_dsp"): initialization failed.

bmc0 commented 3 years ago

Do you have enable-remixing=no in ~/.config/pulse/daemon.conf? I need to update the wiki page; the recommendation to set this is misleading.

kzuu commented 3 years ago

I tried it now with bot enable-remixing=no and yes and it still doesn't work.

bmc0 commented 3 years ago

Alright, I was able to make it fail the same way. Interestingly, however, it appears to work fine if you explicitly set the number of channels in the load-module command:

pacmd load-module module-ladspa-sink sink_name=dsp sink_master=alsa_output.usb Focusrite_Scarlett_6i6_USB_00034623-00.analog-surround-21 plugin=ladspa_dsp label=ladspa_dsp channels=2
kzuu commented 3 years ago

YES! It works! Thank you!

kzuu commented 3 years ago

Okay, this is now back to not working. I absolutely did not change anything from the working settings. There is one difference though, now I can't get it load even with just simple eq to eq every speaker the same, that worked fine before. Is there something that changes in my system and does it ?

edit: Something to do with parsing after changing /etc/locale.conf. Didn't know those matter in these things. Works after switching to old settings. i guess LC_NUMERIC was what matters, verbose was complaining about failig to parse eq numbers.

bmc0 commented 3 years ago

Yeah, unfortunately locale can be problematic (especially because LADSPA plugins are loaded as shared libraries). Generally speaking, I recommend setting LC_NUMERIC=C in the ladspa_dsp configuration files to avoid locale-related surprises. This is stated in the readme and manpage, but I should probably add it to the wiki page too.