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

feat(just): Update surround to use spatializer #1838

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

EPOCHvoyager
Copy link
Contributor

Updates the ujust to setup virtual surround to use the new PipeWire Spatializer module in place of the older HeSuVi-style convolver.

Not only is this method now recommended in the PipeWire Wiki, but free .sofa HRTF files are much more plentiful online; which is particularly relevant given head-related transfer functions must pertain to the individual's anatomy for proper effect.

The sample HRTF is downloaded from the Sofacoustics database in the script, with the original measurements from MIT being freely available here, where they're allowed free redistribution.

Additionally, I've taken the liberty to add small step-by-step instructions at the end of the script's execution, including links, as to how to identify and obtain a .sofa which will better match the user, and provide fuller effect.

- Also adds instructions to identify and get a .sofa HRTF which best
matches user anatomy.
@EPOCHvoyager EPOCHvoyager marked this pull request as ready for review October 31, 2024 22:29
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Oct 31, 2024
@HikariKnight
Copy link
Member

i would suggest deleting the old config (~/.config/pipewire/pipewire.conf.d/virtual-surround-71.conf) if found to avoid potential issues or at least moving it out of the pipewire.conf.d and with .bak extension
otherwise this looks good.
will test and approve after work tomorrow once that change is done.

@EPOCHvoyager
Copy link
Contributor Author

i would suggest deleting the old config (~/.config/pipewire/pipewire.conf.d/virtual-surround-71.conf) if found to avoid potential issues or at least moving it out of the pipewire.conf.d and with .bak extension

Done - backs the file up on enabling, and removes it instead on disable.

@EPOCHvoyager
Copy link
Contributor Author

Something of note otherwise is that while the configuration is based on this one from the PipeWire repo, I've changed the output channels to Side Left and Right, instead of Front Left and Front Right - as that's consistent with how EasyEffects handles things and doesn't make it so the sound is always coming from in front.

@HikariKnight
Copy link
Member

hmm i ran the just recipe and restarted pipewire, but i did not get any new sink available to me to select 🤔

@EPOCHvoyager
Copy link
Contributor Author

hmm i ran the just recipe and restarted pipewire, but i did not get any new sink available to me to select 🤔

Weird, works perfectly here; though you have to be on a recent image for the added sofa module. Anything on logs?

@HikariKnight
Copy link
Member

hmm i ran the just recipe and restarted pipewire, but i did not get any new sink available to me to select 🤔

Weird, works perfectly here; though you have to be on a recent image for the added sofa module. Anything on logs?

might be why, my system is still on F40 due to some bugs in a few packages i rely on for my main system. so i dont have any other ideal hardware to test with.

Copy link
Member

@HikariKnight HikariKnight left a comment

Choose a reason for hiding this comment

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

Tested by Vet Gaming and confirmed working

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 6, 2024
@KyleGospo KyleGospo added this pull request to the merge queue Nov 8, 2024
Merged via the queue into ublue-os:main with commit 39fdca7 Nov 8, 2024
2 checks passed
@EPOCHvoyager EPOCHvoyager deleted the surround-spatializer branch November 8, 2024 17:17
@AlexNPavel
Copy link

I'm having issues with the new spatializer. I removed the old convolver and tried this one out and there is no bass. It's as if there is no subwoofer registered. The subwoofer does appear in the sound settings though and it tests correctly as "rear center" audio. I reset the pipewire config and went back to the old convolver to make sure it wasn't something else that broke and it works correctly there, so I think something is wrong with this new spatializer based config.

@EPOCHvoyager
Copy link
Contributor Author

EPOCHvoyager commented Nov 15, 2024

@AlexNPavel, this version should sound different from the previous HRIR-based one, given it's using an HRTF based on completely different measurements(literally measurements of a dummy head at MIT); it's only meant as a placeholder file that we can distribute. Did you follow the instructions given at the end of the new installation process?

@AlexNPavel
Copy link

@EPOCHvoyager I understand that it should be different, but it is a pretty bad initial experience. After doing some more research, it seems most HRTF models (like MIT KEMAR and the ARI models) don't have any testing for frequencies below 300Hz since they're designed for research, not virtual surround. This means that there's essentially no subwoofer with those models. Even the ARI B models only go down to 50Hz and lack depth as a result. IMO, one of the "Widespread" models as a default would make more sense, since those are generated using computer simulations, allowing them to get info for lower frequencies that isn't possible with physical in-ear microphones.

There definitely should still be the message to experiment with other models for users to find what they like best, but the default should also provide a good experience IMO.

@EPOCHvoyager
Copy link
Contributor Author

one of the "Widespread" models as a default would make more sense

The reason I picked KEMAR was because the measurements explicitly allowed for free redistribution, outside of any other practical reasons. Wouldn't be wise to knowingly distribute something in license limbo on an open source project like Bazzite. If you can find another with such a clause that I missed, I'd be happy to hear it.

There definitely should still be the message to experiment with other models for users to find what they like best, but the default should also provide a good experience

This is orthogonal to the actual issue, but with HRTFs, it's far less of an emotional preference over how your anatomy interacts with your present soundscape. You can do some more generalized models like the commercial options do, but it's always going to be a trade-off between basic utility and general naturality. Even still, there will be a sizeable portion of the populace to which they'll provide neither, and largely couldn't provide without alienating others. Although I have to outline the caveat that I'm not anything resembling a researcher on the field.

With that in mind, and the limitations outlined to your previous point, I still believe it's best to try and guide people on how to get something that better matches their anatomy, than to make an effort to provide one that's "good enough" right away - as whatever that means would be particularly unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants