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

framework: Add hardware.framework.laptop13.audioEnhancement option #1253

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

miketth
Copy link
Contributor

@miketth miketth commented Nov 16, 2024

Description of changes

This PR adds the hardware.framework.laptop13.audioEnhancement option, which adds filters that enhance the audio coming from the laptop speakers. This config yields vastly enhanced audio, including much better bass.

These techniques are heavily inspired by the Asahi project's asahi-audio repo and contains an equalizer transformed from the "Lappy McTopface" preset from ee-framework-presets (both MIT-licensed).

I am unsure about putting the option under hardware.framework.laptop13, but this applies to Framework Laptop 13, but not the 16 and there wasn't an existing option for this subset.

I had this in my personal config for quite a bit of time, but decided to upstream it, in case it helps others. It isn't perfect by all means, but it makes the speakers sound much better than their defaults.

Things done
  • Tested the changes in your own NixOS Configuration
  • Tested the changes end-to-end by using your fork of nixos-hardware and
    importing it via <nixos-hardware> or Flake input

@Mic92 Mic92 force-pushed the framework-13-audio-improvements branch from 23ef53a to 7a5dae6 Compare November 16, 2024 14:20
@Mic92 Mic92 force-pushed the framework-13-audio-improvements branch 2 times, most recently from bf693d3 to 53da0ce Compare November 16, 2024 22:09
@Mic92 Mic92 force-pushed the framework-13-audio-improvements branch from 53da0ce to 2c7fa3e Compare November 16, 2024 22:31
@Mic92
Copy link
Member

Mic92 commented Nov 16, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Nov 16, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 672ac2a

@mergify mergify bot merged commit 672ac2a into NixOS:master Nov 16, 2024
3 checks passed
@miketth miketth deleted the framework-13-audio-improvements branch November 16, 2024 23:37
@leo60228
Copy link
Member

I tested this on my device and the filtering is also applied to headphones, which doesn't seem like the expected behavior.

@Mic92
Copy link
Member

Mic92 commented Nov 21, 2024

@miketth @leo60228 any idea how to avoid this? Are you using the headphone jack? I mostly do bluetooth headphones, so I missed that bit.

@marcan
Copy link

marcan commented Nov 21, 2024

See the most recent commit to asahi-audio, that avoids having to use the automatic PipeWire node name. You need to target the specific device you want to use as the raw device in the matcher, which can be done via multiple property matches.

However, that depends on at least the PCM being different. If this is one of those setups where the ALSA PCM for speakers and headphones is the same and it just switches in hardware (or driven by software/UCM) on jack hotplug (do those exist still? I thought most modern machines had separate PCMs) then I have no idea how you'd fix it. If it's HDA then hopefully separate PCMs at least exist and it should be possible to write a UCM config to drive them independently instead of muxing a single PCM.

@leo60228
Copy link
Member

The instructions from https://github.com/luisbocanegra/linux-guide-split-audio-ports seem to work to split it into separate PCMs, but are quite a few steps.

@leo60228
Copy link
Member

I'm not sure this is the best solution for nixos-hardware, but I added this to my personal configuration: leo60228/dotfiles@d8edbb9

@leo60228
Copy link
Member

Using UCM instead of ACP seems to have the side effect of making headphones and speakers appear as separate PipeWire nodes, even though it doesn't change that they use the underlying PCM. This patch achieves this, though I'm not sure it should be upstreamed: leo60228/alsa-ucm-conf@616f1eb

(Instead of rebuilding the world, you can override the path to the ucm2 folder with the ALSA_CONFIG_UCM2 environment variable. This does not appear to be mentioned in documentation.)

@miketth
Copy link
Contributor Author

miketth commented Nov 24, 2024

Sorry, I missed that part completely as I don't use the headphone jack either... I'll look into this soon-ish, but if I don't find anything cleaner, it might be the best to go with the solution from @leo60228

@Mic92
Copy link
Member

Mic92 commented Nov 24, 2024

If the audio configuration becomes more complex than this, it might be worth considering starting a new project. Audio filters and equalizer is a bit of a different skill set from what we usually have in nixos-hardware. It would be cool to host these profiles in a separate repository and maybe reference them here? Just my thoughts, nothing set in stone.

@Titaniumtown
Copy link

Titaniumtown commented Nov 24, 2024

Cool stuff! I did this myself using easyeffects: https://git.gardling.com/titaniumtown/dotfiles/src/commit/555a049637da8d679e0f5712f366e19a976ddd16/home-manager/progs/framework-13-easyeffects.nix

I'll switch over to doing it through nixos-hardware. glad to see other people found this useful.

EDIT: This doesn't work at all and I get no audio output :( I'm on a framework 13 12th gen intel

@taha-yassine
Copy link

EDIT: This doesn't work at all and I get no audio output :( I'm on a framework 13 12th gen intel

It worked for me after a reboot.

@Titaniumtown
Copy link

Rebooting also didn't fix 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.

7 participants