Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for equalization via alsaeq #307

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

jcass77
Copy link
Member

@jcass77 jcass77 commented Jul 25, 2015

Adds software-based equalisation using alsaeq, based on the guide published over at HifiBerry as well as this one.

Requires that the alsaeq modules be installed first using sudo apt-get install -y libasound2-plugin-equal, so will have to be incorporated in a future distribution of MusicBox.

I wasn't able to test the fallback to USB in the first part of the if statement, so if someone with a USB DAC could run a quick check before merging that would be great.

Implements the enhancement requested at #306

pcm.plugequal {
type dmix
ipc_key 1024
controls "/home/mopidy/.alsaequal.bin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this controls but for? This path doesn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .alsaequal.bin file should be created automatically on the first reboot after the equalizer module is installed.

The file is used to store the user-defined equalizer profile that can be configured with alsamixer -D equal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's some sample output of alsamixer -D equal, but you'll have to run sudo apt-get install -y libasound2-plugin-equal first.

mopidy ssh 180x46

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok Yeh I figured it was to store the state. And then I remembered that
/home/mopidy does exist in 0.6. But it won't exist in 0.7 since we'll be
using mopidy from apt which sets up the mopidy user account properly. Since
this is system state, it probably deserves to go somewhere system-ish
anyway.
On 25 Jul 2015 09:37, "John Cass" notifications@github.com wrote:

In filechanges/opt/musicbox/setsound.sh
#307 (comment)
:

@@ -179,33 +179,56 @@ then
cat << EOF > /etc/asound.conf
pcm.!default {
type plug

  • slave.pcm plugequal;
    +}
    +pcm.plugequal {
  • type dmix
  • ipc_key 1024
  • controls "/home/mopidy/.alsaequal.bin"

Here's some sample output of alsamixer -D equal, but you'll have to run sudo
apt-get install -y libasound2-plugin-equal first.

[image: mopidy ssh 180x46]
https://cloud.githubusercontent.com/assets/10268911/8888708/e444550a-32b8-11e5-98c4-3c3dae26d8a3.png


Reply to this email directly or view it on GitHub
https://github.com/woutervanwijk/Pi-MusicBox/pull/307/files#r35481120.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think /var/lib/alsa/alsaequal.bin would be appropriate? It is not a folder under Musicbox's control, but seems like a good candidate location for storing alsa-related configuration?

@jcass77
Copy link
Member Author

jcass77 commented Jul 29, 2015

The latest commit contains the following changes:

  • equalizer defaults to 'off' which reverts to the old Musicbox functionality
  • setting the qualifier to 'default' will delete the control file on every reboot and revert to default system settings
  • I've scaled all of the presets down to 50%-65% to avoid likelihood of sound distortion occurring.

@jcass77
Copy link
Member Author

jcass77 commented Jul 29, 2015

...pushed 7c1efad to make use of an obvious opportunity to simplify the script logic, which I missed the first time round.

@kingosticks, not sure if you would prefer that we move the .alsaequal.bin file location at this stage?

@jcass77
Copy link
Member Author

jcass77 commented Aug 14, 2015

Having fiddled around with the sound curve settings for a while, the following sequence has yielded the most pleasing results for me on a set of small speakers:

65 65 65 62 58 52 54 56 62 54

@jcass77
Copy link
Member Author

jcass77 commented Oct 18, 2015

Update: resynchronised with main development branch.

@maxrozen-codesource
Copy link

Just FYI - your sound curve numbers are in the wrong order.
Left-most numbers increase bass, right-most numbers increase treble.

Test this by using
treble) curve="65 65 65 62 58 54 51 51 51 50" ;;
then contrast that with
bass) curve="50 50 50 52 56 60 63 65 65 65" ;;

Your "treble" setting increases bass

@jcass77
Copy link
Member Author

jcass77 commented Apr 12, 2016

Yes that didn't make sense to me either. The curves are based on an example that I found here: http://www.pclinuxos.com/forum/index.php/topic,110087.msg944835.html#msg944835.

Not sure if just the bass and treble ones are switched around or if the same is true of the other presets - your thoughts?

In the end I decided to just leave them as-is in the hope that the community will improve on it if the PR ever gets merged - but switching treble and bass makes sense as a first step.

@jcass77
Copy link
Member Author

jcass77 commented Apr 12, 2016

For future reference: instructions for setting up a 15-band equalizer is available at: https://discuss.mopidy.com/t/equalizer-alsaequal-on-pimusicbox-with-dac/1189/8?u=jcass77

@Sytten
Copy link

Sytten commented Jul 25, 2018

Can we expect to see this anytime? I really need it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants