Equalizer

Configuring and tweaking your GhostBSD System.

Equalizer

Postby Jes » Mon Sep 11, 2017 11:36 am

I don't know if the equalizer can be enabled with all sound cards. My laptop is a Thinkpad T420s and the sound module (I guess it's integrated into the kernel) is SND_HDA.

To enable the equalizer I put in /boot/loader.conf:

Code: Select all
dev.pcm.0.play.vchans=4
hint.pcm.0.eq=1
hint.pcm.0.vpc=1


Then you can control it with:

Code: Select all
mixer bass +/-value
mixer treble +/- value


Another trick to increase the volume:

Code: Select all
sysctl hw.snd.vpc_0db=10


You should be cautious with this value, if too low it can generate distortion.

If you want to go further, an small script can be used to modify the equalizer with keys. For example, with xbindkeys.

The script could be like:

Code: Select all
#!/bin/sh

WHICH=$1 # bass or treble
VALUE=$2 # +x -x

m=`/usr/sbin/mixer $WHICH $VALUE`
exec /usr/local/bin/notify-send -i "audio-volume-high-symbolic.svg" "${m}" -t 1 &


and in your ~/.xbindkeysrc:

Code: Select all
"/home/jjess/sbin/basstreble bass +5"
   Mod4 + q

"/home/jjess/sbin/basstreble bass -5"
   Mod4 + a

"/home/jjess/sbin/basstreble treble +5"
   Mod4 + w

"/home/jjess/sbin/basstreble treble -5"
   Mod4 + s


replacing 'jjess'' with your user, and 'basstreble' with the name of your script. Then you can increase/decrease equalizer values with WindowsKeys + q/a/w/s

BR

Jes
Jes
 
Posts: 38
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Has thanked: 13 times
Been thanked: 11 times

Equalizer


Re: Equalizer

Postby Jes » Wed Nov 01, 2017 3:56 pm

Besides the previous configuration with the freebsd native equalizer a more brilliant sound can be obtained using LADSPA plugins. By default GhostBSD (please, let me know if I'm wrong) uses pulseaudio. A pulseaudio instance should be running once you login in xfce/mate/.... If so, then follow the next steps:

1) install Steve Harris' ladspa plugins:

Code: Select all
pkg install swhplugins


2) execute in a terminal (with your user):

Code: Select all
pacmd load-module module-ladspa-sink sink_name=ladspa_output.mbeq_1197.mbeq sink_master=oss_output.dsp2 plugin=mbeq_1197 label=mbeq control=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,6.0,12.0,12.0
pacmd set-default-sink ladspa_output.mbeq_1197.mbeq


Note 1:
replace 'oss_output.dsp2' with the sink that applies. To view all sinks:

Code: Select all
pacmd list-sinks


Pulse Audio Volume Control (pavucontrol) helps to see all sinks and control the volume.

Note 2:
I like 'brilliant' sound, with heavy amplification in high frequencies. You can play with other values in 'control'. In my example:

5Khz: 6dB
10Khz: 12dB
20Khz: 12dB

3) To make permanent this configuration edit /usr/local/etc/pulse/default.pa and add the following code:

Code: Select all
load-module module-ladspa-sink sink_name=ladspa_output.mbeq_1197.mbeq sink_master=oss_output.dsp2 plugin=mbeq_1197 label=mbeq control=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,6.0,12.0,12.0
set-default-sink ladspa_output.mbeq_1197.mbeq


Remember choose the right 'sink_master' for your system.

And make tests. In my case I got a couple of errors playing music and pulseaudio crashed. But I think it was due to playing with ladspa. You have to be carefull too with volume to avoid distortion; play with preamp/replay gain in your player or in pavucontrol.

If you don't want to modify pulseaudio default configuration you can test this ladspa equalizer with the aqualung player. It's able to load ladspa plugins like MultibandEQ (mbeq_1197) and graphically adjust the optimum values of each band for a perfect setup.

BR
Jes
 
Posts: 38
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Has thanked: 13 times
Been thanked: 11 times

Re: Equalizer

Postby ASX » Wed Nov 01, 2017 4:38 pm

Jes wrote: By default GhostBSD (please, let me know if I'm wrong) uses pulseaudio.

Hmm ... yes pulseaudio is shipped with GhostBSD by default, along with pavucontrol. However not all packages are configured to use pulseaudio, some do, some need to tweak the build options, and probably some don't.

Integrating pulseaudio is a long term goal, we will get ther at some point in time ;)
ASX
 
Posts: 988
Joined: Wed May 06, 2015 11:46 am
Has thanked: 58 times
Been thanked: 132 times

Re: Equalizer

Postby Jes » Fri Nov 03, 2017 9:33 am

Yes ASX, you're wright. I don't like pulseaudio too much, but I guess is better than compile players from ports to work with Jack, for example, and get Jack working. Now pulseaudio works more or less well, not when the project started (I guess the guy who made pulseaudio is the same who coded systemd.... and that doesn't say much in his favour).

I use clementine, aqualung but mainly Quod Libet. Quod Libet from packages works very well with pulseaudio. For me Quod Libet is the most complete solution to play music and get your music library updated. Lots of plugins, equalizer included, bulk replay gain, etc. I think it provides you with more fine control managing a big music library. The included equalizer plugin is not bat, but with Ladspa MultibandEQ the sound is a bit better imho.

The advantages of Ladspa MultibandEQ working with pulseaudio is that you can have an equalizer despite of players that haven't it. Downside is you have to unload/load the ladspa module is you want to modify the amplification level of each band and it consumes a bit more cpu.


BR
Jes
 
Posts: 38
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Has thanked: 13 times
Been thanked: 11 times

Re: Equalizer

Postby ASX » Fri Nov 03, 2017 1:14 pm

Yes, pulseaudio come from the same author of systemd.
However pulsaudio is a wonderful "layer" that unified the audio "mess" that afflicted Linux for ages.

As for systemd, if you take the time to understand what it does and what is the "core idea" behind the project, like I did, you will find that it is a good idea. The problem is the "implementation" of that idea turned out to not be so good, and the deployment even worse.

There is an equalizer that work with pulseaudio IIRC, but has not been ported to freebsd ... so that's something we should look into ;)
ASX
 
Posts: 988
Joined: Wed May 06, 2015 11:46 am
Has thanked: 58 times
Been thanked: 132 times

Re: Equalizer

Postby Jes » Fri Nov 03, 2017 3:44 pm

I was partially successful trying to run pulseaudio equalizer in GhostBSD. It's coded in bash and python and uses Ladspa MultibandEQ. This equalizer loads the ladspa MultibandEQ module in pulseaudio, and provides a graphical interface with eq bands as an interface for MBEQ control parameters. Everytime you apply MBEQ settings (modify some eq band) the ladspa module have to be unloaded and loaded again.

Main caveat for me is that the pulseaudio EQ plugin needs the pulseaudio daemon have to have its configuration in the user's home (~/.pulse/default.pa and so). But in GhostBSD and FreeBSD there's a good setup in /usr/local/etc/pulseaudio. Every time I try to set up a local user configuration pulseaudio is not able to start.

Finally I chose to statically load the MBEQ Ladspa module with the default pulseaudio configuration (/usr/local/etc/pulseaudio) and with my personal preference for freq amplification.

If any of you have time to prepare a GhostBSD setup for pulseaudio equalizer it would be wonderful. The code and some instructions can be grabbed from:

https://ubuntuforums.org/showthread.php?t=1308838

https://code.launchpad.net/~psyke83/+junk/pulseaudio-equalizer

BR

Jes
Jes
 
Posts: 38
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Has thanked: 13 times
Been thanked: 11 times


Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest