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

[ENHANCEMENT] Fix audio muffling/low audio quality by changing OpenAL's default settings #3318

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

Conversation

Smokey555
Copy link

Does this PR close any issues? If so, link them below.

#2980

Briefly describe the issue(s) fixed.

Lime's OpenALSoft has a gain limiter on by default which causes audio muffling/lower audio quality. There are also more settings that could cause spatialization etc. to occur resulting in the audio not sounding like it's supposed to compared to outside media players. Adding a default alsoft.ini file fixes this, as it gets automatically detected when it's in the same directory as the executable and applied. This could work for multiple platforms but testing has only been done on Windows

Include any relevant screenshots or videos.

--

@Smokey555 Smokey555 changed the title Fix audio muffling/low audio quality by changing OpenAL's default settings [ENHANCEMENT] Fix audio muffling/low audio quality by changing OpenAL's default settings Sep 16, 2024
Copy link
Contributor

@NotHyper-474 NotHyper-474 left a comment

Choose a reason for hiding this comment

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

There's definitely a noticeable difference, approved.

(First audio uses the .ini file, second audio does not)

2024-09-16.15-33-49.mp4

@EliteMasterEric EliteMasterEric added the status: pending triage Awaiting review. label Sep 16, 2024
@moxie-coder
Copy link

moxie-coder commented Sep 17, 2024

This could work for multiple platforms but testing has only been done on Windows

this should work on Linux & Mac since you can specify which audio driver to use & it does have options for Mac & Linux
And these are quoted from the maintainer of AL soft

The default value is blank, which means the current order of the available backends. For the prebuilt binaries (32-bit and 64-bit), the list is, in order:
wasapi, dsound, winmm, null, wave

The current full list, in order, is:
pipewire, pulse (PulseAudio), wasapi, core (CoreAudio for macOS), oboe, opensl, alsa, solaris, sndio, oss (Open Sound System), jack, dsound, winmm (Windows MultiMedia), port (PortAudio), sdl2, null (dummy output), wave (Wave file writer)

Obviously a Windows build won't have all of these... some aren't possible to use on Windows, while others are technically possible but unlikely to be available on Windows.

@Raltyro
Copy link

Raltyro commented Sep 17, 2024

AND IT WAS THIS SIMPLE?!?

@Raltyro
Copy link

Raltyro commented Sep 17, 2024

Something about just putting the file in the game directory frustrates me because it just works like this like something you can configure

(Top is with alsoft.ini, bottom is without)

2024-09-17.21-32-48.mp4

@Raltyro
Copy link

Raltyro commented Sep 17, 2024

Looking this further, you know how this is the default and it's the attended way
Not only was FNF was affected but also every other programs that uses it

@Raltyro
Copy link

Raltyro commented Sep 17, 2024

This could work for multiple platforms but testing has only been done on Windows

this should work on Linux & Mac since you can specify which audio driver to use & it does have options for Mac & Linux And these are quoted from the maintainer of AL soft

https://github.com/kcat/openal-soft/blob/7c1aca7a3134be6fef71b39ee0d426e158dc5446/alsoftrc.sample#L24
image

@moxie-coder
Copy link

moxie-coder commented Sep 17, 2024

Looking this further, you know how this is the default and it's the attended way Not only was FNF was affected but also every other programs that uses it

OpenFL uses OpenAL, and of course AL soft, so anything that uses that you can use that config for

@Raltyro
Copy link

Raltyro commented Sep 17, 2024

All i can say is its fucked that knowing it has a fucked up default config

@EliteMasterEric
Copy link
Member

Is there a way to make this work without an extra file in the output folder? Maybe passing some config to OpenAL via code?

@EliteMasterEric EliteMasterEric added status: reviewing internally Under consideration and testing. type: enhancement Involves an enhancement or new feature. and removed status: pending triage Awaiting review. labels Sep 18, 2024
@EliteMasterEric EliteMasterEric self-assigned this Sep 18, 2024
@Smokey555
Copy link
Author

Is there a way to make this work without an extra file in the output folder? Maybe passing some config to OpenAL via code?

It should be possible using ALC's attribute list, ill look into it

@CCobaltDev
Copy link

CCobaltDev commented Sep 25, 2024

This could work for multiple platforms but testing has only been done on Windows

this should work on Linux & Mac since you can specify which audio driver to use & it does have options for Mac & Linux And these are quoted from the maintainer of AL soft

https://github.com/kcat/openal-soft/blob/7c1aca7a3134be6fef71b39ee0d426e158dc5446/alsoftrc.sample#L24 image

so theoretically

<assets path="alsoft.ini" if="windows" />
<assets path="alsoft.ini" rename="alsoft.conf" unless="windows" />

@Raltyro
Copy link

Raltyro commented Sep 25, 2024

yeah basically

@CCobaltDev
Copy link

thank you i will be stealing that

@ninjamuffin99
Copy link
Member

thank u goat, i'll poke thru this

@ninjamuffin99 ninjamuffin99 force-pushed the develop branch 2 times, most recently from e0b1b01 to 410cfe9 Compare October 4, 2024 01:25
@cyn0x8
Copy link
Contributor

cyn0x8 commented Oct 4, 2024

force-pushed

this pr is so messy

github-git

@AbnormalPoof
Copy link
Collaborator

Pretty sure you can just update the branch and all the extra commits will be gone

@cyn0x8
Copy link
Contributor

cyn0x8 commented Oct 5, 2024

1 nice singular commit now :steamhappy:

source/Main.hx Outdated
@@ -3,6 +3,9 @@ package;
import flixel.FlxGame;
import flixel.FlxState;
import funkin.Preferences;
#if desktop
import funkin.audio.ALSoftConfig; // Just to make sure DCE doesn't remove this, since it's not directly referenced anywhere else.
Copy link
Collaborator

@AbnormalPoof AbnormalPoof Oct 26, 2024

Choose a reason for hiding this comment

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

Dead code elimination is disabled in Funkin'

Funkin/project.hxp

Lines 560 to 562 in c0b15ec

// Disable dead code elimination.
// This prevents functions that are unused by the base game from being unavailable to HScript.
addHaxeFlag("-dce no");

@github-actions github-actions bot added pr: documentation PR modifies documentation or README files. size: large A large pull request with more than 100 changes. and removed size: medium A medium pull request with 100 or fewer changes. labels Jan 19, 2025
@github-actions github-actions bot added size: medium A medium pull request with 100 or fewer changes. size: large A large pull request with more than 100 changes. and removed size: large A large pull request with more than 100 changes. size: medium A medium pull request with 100 or fewer changes. labels Jan 19, 2025
@Hundrec Hundrec removed the pr: documentation PR modifies documentation or README files. label Jan 23, 2025
cyn0x8 and others added 2 commits January 24, 2025 18:58
Co-authored-by: Smokey <78874128+Smokey555@users.noreply.github.com>
Co-authored-by: Cobalt Bar <79053181+CobaltBar@users.noreply.github.com>
@cyn0x8
Copy link
Contributor

cyn0x8 commented Jan 25, 2025

ik for a fact this works on windows but im gonna try testing this on linux and hl rn
is anyone able to test with mac?? i cant emulate cuz its proprietary

@cyn0x8
Copy link
Contributor

cyn0x8 commented Jan 26, 2025

just tested
the audio fix works on linux!!

@github-actions github-actions bot added size: medium A medium pull request with 100 or fewer changes. and removed size: large A large pull request with more than 100 changes. labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. status: reviewing internally Under consideration and testing. type: enhancement Involves an enhancement or new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.