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

Boom sound when using audiodxe #2073

Open
franksfc opened this issue Jul 6, 2022 · 57 comments
Open

Boom sound when using audiodxe #2073

franksfc opened this issue Jul 6, 2022 · 57 comments
Labels

Comments

@franksfc
Copy link

franksfc commented Jul 6, 2022

I have a dell Inpisron 3670 machine with alc867/891. When I use the audiodxe and play the sound, there is always a boom sound before Duang. The speaker is not to be blamed.

opencore-2022-06-26-043816.txt

@mikebeaton
Copy link
Contributor

It will be the order of sound card init commands. Check the Configuration.pdf section for AudioDxe, and see if any of the optional driver Arguments improve the situation.

@franksfc
Copy link
Author

franksfc commented Jul 6, 2022

Thank you for your help! But I tried the arguments with no luck, including --gpio-setup, --restore-nosnoop and --gpio-pins 0~15. Maybe I haven't understood the configuration.pdf correctly. Could you give me more hints?

@mikebeaton mikebeaton added the help wanted Extra attention is needed label Jul 6, 2022
@mikebeaton
Copy link
Contributor

mikebeaton commented Jul 6, 2022

Well... I only said try. Idk if those will help you for sure. But it was worth testing because, in AppleALC (for contrast) you have pretty much full control over what commands are sent to the card at audio setup (assuming you are an expert in editing/creating configs). AudioDxe, on the other hand, tries to do some generally suitable things to initialise sound which should work on all/most/many machines. Some of the code paths depend on what hardware it detects, but within a given class of hardware, there is not so much user control over what it does. Those fairly recently added arguments give some additional control.

It sounds like you need an additional option to swap the ordering of ... something (more specifically something to do with the ordering of applying power and enabling amps); investigation required. I didn't author AudioDxe, but have been updating it recently. I don't have a huge amount of time to work on it right now, though...

If you're able to go back to OC 0.7.6 (i.e. before all recent changes to AudioDxe) it would be helpful to know whether that older version still shows the problem or not. (That involves using some fairly different OC settings that you'll need to revert to (use ocvalidate from the relevant version(s) of OC to make sure your config.plist is basically right), so make sure you keep, e.g., a working, bootable USB of current OC as a backup, or do the test using a USB install of the older OC.)

@franksfc
Copy link
Author

franksfc commented Jul 6, 2022

I'm very glad that I can help improve the audiodxe! I am an old Opencore user and I have been using Opencore since 0.5x. The older versions of audiodxe have the same problem. It's my greatest pleasure to offer any help wanted.

@mikebeaton
Copy link
Contributor

It's helpful to know the older version has the same problem, thanks. I'll have to leave this open for now and get back to you in due course, unless any other devs have time to look sooner. (Btw 'Duang', you do mean 'chime', yes?)

@franksfc
Copy link
Author

franksfc commented Jul 6, 2022

Yes, Duang means the chime.

@mikebeaton
Copy link
Contributor

mikebeaton commented Jul 7, 2022

@franksfc Have you tried SetupDelay? Depending on your exact meaning of 'boom', possibly you just need this setting. Some sound card amplifiers do not respond immediately to volume changes. Therefore on card init the card can be at max (or other very loud 'default') audio volume initially, and for up to 0.5s after we change the amplifier settings. This introduces a delay before playing the chime to allow for this.

@franksfc
Copy link
Author

franksfc commented Jul 7, 2022

Unfortunately, no. I noticed 'in microseconds' so I tried 1000,10000,500000,1000000,10000000 and the issue didn't improve at all. I have also tried resettrafficclass and discconecthda quirks. Forgive me if the sentences are grammatically wrong as I am a beginner in English.

@mikebeaton
Copy link
Contributor

Yes, it is microseconds, and the docs suggest up to 0.5s delay, so your values make sense. I assume with the 10,000,000 value you did actually observe a long (10s) delay before the sound plays? If so, is the 'boom' still immediately before the sound, or ~10s before?

@franksfc
Copy link
Author

franksfc commented Jul 7, 2022

it booms 10s before the chime

@mikebeaton
Copy link
Contributor

Okay, that makes the situation clear: it is indeed the sound card setup ordering (as I suggested above), and not to do with the different problem which SetupDelay can help with.

I don't believe this is affecting many other systems, but some (certainly not all) systems also get pops or crackles at startup (which is a similar issue, and possibly even exactly the same, interacting with your speaker system). I'm going to have to park this for now. But I'll add it as something that needs addressing to the Cumulative AudioDxe issue.

@franksfc
Copy link
Author

franksfc commented Jul 7, 2022

Thanks! I will always be there if you need any further information.

@MagistraNocte
Copy link

MagistraNocte commented Nov 19, 2022

Hi, just wanted to say I'm seeing a similar problem too, I'm working on a Powermac G4 mod and I wanted to have an internal speaker to play the boot chime like the original Powermac G4, so i set up a small speaker attached to a small PAM8403 amplifier powered through USB (i actually give it power through the SPDIF motherboard header with some jumper cables, but I also tried giving it the 5V through the USB 1/2 header, the led header, molex and even an external source through my arduino board, the problem is still there, it's not in the power source) connected through a case front panel audio cable to the fronto panel audio header on my motherboard (Gigabyte Z690M DS3H), as soon as the boot chime starts playing I hear a loud pop (the chime itself starts with a loud pop, as if the sound card were abruptly being turned on), then, later in the boot process close to the login screen showing up I hear a couple of other loud pop as if the speakers were powered off and on again or something like that, I ruled out the small speaker or the PAM8403 being the problem since connecting my main speakers to the same motherboard audio header gives the same problem (the pops are not as louds with my speakers but that's probably related to the amplifier i'm driving them with smoothing it up a bit, but the pattern of the pops is exactly the same). it's also notable to add that the problem does not occur when I connect any audio source to my motherboard's rear panel audio out instead of the front panel header, it also doesn't occur when disabling the boot chime in the config.plist (or setting the gain low enough for it to not play, for that matters) so it seems to be related to opencore and the boot chime, but also specifically to the Intel HDA motherboard header channel.

@MagistraNocte
Copy link

MagistraNocte commented Nov 19, 2022

Ok, I tried adding a delay with SetupDelay and I can confirm too that the first loud pop happens as soon as the motherboard logo disappears regardless of the delay set (with a delay set the chime is pop-less but the two pops near the login screen are still there).
Also weirdly enough SetupDelay in my version of opencore (0.8.5) doesn't seem to be in microseconds, a value of 10 is an audible delay, a value of 1000 are more or less 10 seconds and a value of 1000000 (which would be 1 second if it were in microseconds) doesn't let me boot at all (I guess it would have booted but it's reading it as a 10000 seconds delay), should I open a separate issue for the SetupDelay bug?
EDIT: I see SetupDelay was changed from microseconds to milliseconds in opencore 0.8.3, the dortania guide should be updated

@MagistraNocte
Copy link

MagistraNocte commented Nov 19, 2022

I don't believe this is affecting many other systems

Could this be because it is related to the front panel motherboard header only, and that is not something every user is using? especially not to play the boot chime since front panels usually only have headphones ports and it's not usual for users to already have headphones on before even booting. maybe the issue is actually affecting more systems than we know, if not all (in my case it's just your average alder lake desktop build, nothing peculiar with weird layouts like a laptop).
Can anyone confirm there is no pop/boom/crackle sound during boot with the boot chime enabled (and outputted to all the ports) coming out of your front panel headphone port in your system?

@MagistraNocte
Copy link

Also worth noting the problem is also present when booting to windows, but since opencore is still used even when booting to windows and the boot chime still plays, this is still probably opencore related

@mikebeaton
Copy link
Contributor

Also worth noting the problem is also present when booting to windows, but since opencore is still used even when booting to windows and the boot chime still plays, this is still probably opencore related

Well, that should be easy to check: on almost all systems (and I am sure on a standard Dell - I assume you are reporting about the same hardware, since you do not say?) you can boot into Windows directly, not via OpenCore (if you set up a native BIOS boot entry for it, if there is not one already).

You can also try using OC, but with and without AudioDxe enabled (obviously when disabled losing your OC boot chime, if you have that set up), to see if the presence of that is what is making the difference.

@MagistraNocte
Copy link

Hi, thanks for the reply, I already said in my first comment that disabling the boot chime (or setting its gain so low that it doesn't play) the issue doesn't occur.

@MagistraNocte
Copy link

and I am sure on a standard Dell - I assume you are reporting about the same hardware, since you do not say?

I think you missed my other comments.

@mikebeaton
Copy link
Contributor

mikebeaton commented Nov 21, 2022

If the boom happens after boot chime, but not after no boot chime, then sure, the setup which AudioDxe is doing is indeed causing the issue. (Even more so, if we find no boom when AudioDxe is completely disabled in the Drivers section - could you try this? AudioDxe does a bunch of setup when installed, even if it never plays a sound afterwards.) It is very hard to fix these issues with no machine to replicate on though, it really requires someone with some knowledge of audio programming and OC programming, and a machine to try changes on. (I already have a Help Wanted label on this, so...)

@MagistraNocte
Copy link

I can confirm no boom is heard with AudioDxe disabled, even though the little speaker itself is still powered by the motherboard (i can hear the background noise when up close).

@MagistraNocte
Copy link

my machine is up for testing anything if you need it, audio is my field of work but I'm no programmer, I doubt I could help in that regard unfortunetely.

@MagistraNocte
Copy link

MagistraNocte commented Nov 21, 2022

with actual headphones connected to a case front panel connected to the f_panel audio header on the motherboard I hear the boot chime but the booms are not really booms anymore, they're way quieter than with the amplified speaker, I can identify them just because I know they're there, but they're barely audible, it's clear that opencore is not the only part of the equation, maybe something to do with impedence difference between headphones and a 4ohm/3watts little speaker? yet the same speaker/amplifier combo connected to the rear panel audio out doesn't play any boom sound

@mikebeaton
Copy link
Contributor

mikebeaton commented Nov 21, 2022

I can confirm no boom is heard with AudioDxe disabled, even though the little speaker itself is still powered by the motherboard (i can hear the background noise when up close).

Okay, so no boom with AudioDxe completely disabled, and also no boom with AudioDxe enabled but the chime volume below the level at which it will play anything? That narrows down where we need to look - i.e. presumably only at the code that initialises things when a sound is actually played, not at anything initialised before that.

There are 100,000 different cards - and I've already dropped in and done fixes for a few of them - this is only a spare-time pursuit, unfortunately - so I can't promise anything especially timely, I'm afraid.

A full OC debug log from your system (with debug versions of OC and AudioDxe) one with the volume up loud enough that the chime is played (and the boom effect confirmed) and one with AudioDxe still enabled but the sound volume low enough that the chime is not played (and lack of boom effect in the case also confirmed) would be helpful.

@MagistraNocte
Copy link

this is only a spare-time pursuit, unfortunately - so I can't promise anything especially timely, I'm afraid.

No worries, I'm just glad you're taking time to address this issue, thank you very much.
I produced the log you requested (if you need a differen "Target" value in config.plist just let me know, set that to 67 for now), and I also recorded 3 videos of the issue (sorry for the mess! I'm still working on the case mod): the first one with the boot chime and the booms playing (I have highlighted the exact moment of every boom with onscreen text, I hope it's clear enough), the second one with same setup but with the screen in the picture so that hopefully you can match the exact moment the boom takes place with a specific line in the logs (I've noticed the second and third booms corresponds to lines that are not in the log file, right before all those "private" lines, I guess it is because at that time opencore has done its thing and the os has taken on, and so that part of the verbose is logged to some other file inside the OS? if this is the case just let me know where to find it and I will provide it), the third one with no boot chime and no boom sound (here "MaximumGain" is set to -100, previously it was -30). I also set "SetupDelay" to 2000 so that the first boom doesn't get lost in the chime sound (since it seems to be fainter then the two later ones). I also included my config.plist.
This is my current setup:

  • Opencore version: 0.8.5 (sorry I haven't taken the time to update to 0.8.6 yet, if this is critical just let me know)
  • Motherboard: Gigabyte Z690M DS3H (audio codec: Realtek ALC897)
  • CPU: i7 12700k alder-lake
  • GPU: Sapphire AMD 5700XT (the founder edition looking one, not the pulse or the nitro one)
  • small 4ohm/3watts speaker driven by a PAM8403 amplifier chip connected to the motherboard F_audio header (same happens using a real case front panel module with actual speakers connected to it through normal audio jack cable, but it does not happen if connected to the rear motherboard audio out, see my previous comments).

I don't think the rest of the setup is relevant, if it is just let me know.
Thank you again for your time.
Files

@mikebeaton
Copy link
Contributor

Hi @MagistraNocte - I have put up a test build at https://github.com/acidanthera/OpenCorePkg/actions/runs/3613166325 - please can you download and run the debug version of this.

I have added some additional two second delays during audio setup to try to determine exactly which audio setup command(s) are causing the unwanted noise(s). (It should take about 20 extra seconds to start up - it's adding delays on 2 or 3 different commands, on 2 or 3 different widgets - so be patient.)

I need to know, on the version with the chime which gives clicks or booms, exactly when before the chime the first click or boom sound (or sounds, if there are more than one) occur(s). (E.g. on the video you sent, the initial click/boom was 2 seconds before the start of the chime.) You already have Audio->SetupDelay=2000 in your config, as you mentioned - that was helpful for being sure where the issue occurs; so that I know what delays I am seeing where, just leave that as it is.

Another annotated video with the screen in shot would be very helpful (the first boom - which I am sure you can hear clearly there - is not very audible in the video, so the annotations are useful), plus the associated OC debug log.

@MagistraNocte
Copy link

Hi @mikebeaton sorry for the late response, I wasn't home.
Thank you again for putting time into this.
Here is another video (screen in shot) with text highlights (I managed to put the speaker right next to the screen this time, you should hear everything clear now) and the corresponding opencore log.
If you need anything else just let me know.

@mikebeaton
Copy link
Contributor

@MagistraNocte Sorry it's taken me so long to get back to this. I don't think you ever put up a SysReport, please can you set SysReport=true in config.plist, then reboot, and send me the contents of {ESP}/SysReport/Audio folder.

@MagistraNocte
Copy link

Sorry it's taken me so long to get back to this

No worries.
Here's the requested folder, I used the same debug efi folder I used for past logs and test regarding this issue (I kept a copy), everything should be the same as in previous messages, let me know if you need anything else.
Audio.zip

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 15, 2023

@MagistraNocte - Thanks for that dump. I was playing around with this a bit more last night, and I'm a bit less hopeful.

I can recreate exactly (?) the same booms and pops if using the earphone output from the built in Realtek ALC255 on my Dell 3070 i9 MFF.

I previously understood @franksfc's original report to state that there were no booms and pops at all without AudioDxe (i.e. with that driver disabled), but that is not my experience:

Without AudioDxe With AudioDxe (+ SetupDelay*)
Pops on starting machine yes yes
Additional pop before chime no (n/a) yes
Two pops during macOS boot progress bar yes yes
Pops while shutting down macOS yes yes
Pops while starting Linux yes yes

*Using SetupDelay just helps to separate the audio setup pop from the chime itself.

@MagistraNocte - Can you confirm (or deny) any of the above findings, for your setup?

I also attempted fairly radically changing the setup order - and unfortunately got exactly the same pop, on exactly the same command (i.e. when enabling output amp vref as per the OC log with delays). You can try this alternative version too, if you like, it will be the macOS build artefact from here https://github.com/mikebeaton/OpenCorePkg/actions/runs/4423925293, when it has finished building, so another video with audio, showing the log on screen and being able to hear when it pops, would be useful!

@MagistraNocte
Copy link

MagistraNocte commented Mar 16, 2023

@MagistraNocte - Thanks for that dump. I was playing around with this a bit more last night, and I'm a bit less hopeful.

I can recreate exactly (?) the same booms and pops if using the earphone output from the built in Realtek ALC255 on my Dell 3070 i9 MFF.

I previously understood @franksfc's original report to state that there were no booms and pops at all without AudioDxe (i.e. with that driver disabled), but that is not my experience:
Without AudioDxe With AudioDxe (+ SetupDelay*)
Pops on starting machine yes yes
Additional pop before chime no (n/a) yes
Two pops during macOS boot progress bar yes yes
Pops while shutting down macOS yes yes
Pops while starting Linux yes yes

*Using SetupDelay just helps to separate the audio setup pop from the chime itself.

@MagistraNocte - Can you confirm (or deny) any of the above findings, for your setup?

I also attempted fairly radically changing the setup order - and unfortunately got exactly the same pop, on exactly the same command (i.e. when enabling output amp vref as per the OC log with delays). You can try this alternative version too, if you like, it will be the macOS build artefact from here https://github.com/mikebeaton/OpenCorePkg/actions/runs/4423925293, when it has finished building, so another video with audio, showing the log on screen and being able to hear when it pops, would be useful!

I can confirm that even with this new test version I get the same results as before:

Without AudioDxe With AudioDxe (+ SetupDelay*)
Pops on starting machine yes (this is probably normal and unavoidable because it happens when the audio components first receive power? that's why I never bringed it up) yes
Additional pop before chime no (no chime) yes
Two pops during macOS boot progress bar no yes
Pops while shutting down macOS no (there is one if I'm restarting it but that is the "Pops on starting machine" one) no
Pops while starting Windows yes (when starting the machine); no (the one before the chime, because no chime) yes

Made another video of the boot with the same settings as the last one + SysReport=true and this time I used the slo-mo function of my iphone to better see the lines at wich the 2nd and 3rd booms occurs, it seems the 2nd one appears somewhere around the GTrace synchronization point 1 and the Unsupported PCH lines, while the 3rd appears right in the middle of all those <private> lines. As for the first one: with this test version it appears when the screen is waiting on the bunch of lines that end up with OCC: Install console control (2C17A0B0/0/0), Current - Success.
Here is a complete copy of my test EFI folder (with sanitized config.plist), the video, the opencore log for the boot seen in the video, and the SysReport audio folder
Thank you.

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 16, 2023

Could you see if you can recreate the situation in your first videos, where console debug output carries on after the line OCC: Install console control (.....), current - Success? As it is seeing the HDA: log lines on screen compared to the timing of the sounds which helps to show exactly when the issue is occurring. Make sure you install a DEBUG version of everything from that alt. build - well, at least, of AudioDxe.efi as well as OpenCore.efi. (Also, maybe try BuiltinText instead of BuiltinGraphics, etc. - I can't immediately see why this has changed, as you do seem to be using the debug version of AudioDxe.efi: the HDA: lines are in the text log, assuming the text log comes from the same run as the video.)

@MagistraNocte
Copy link

Could you see if you can recreate the situation in your first videos, where console debug output carries on after the line OCC: Install console control (.....), current - Success? As it is seeing the HDA: log lines on screen compared to the timing of the sounds which helps to show exactly when the issue is occurring. Make sure you install a DEBUG version of everything from that alt. build - well, at least, of AudioDxe.efi as well as OpenCore.efi. (Also, maybe try BuiltinText instead of BuiltinGraphics, etc. - I can't immediately see why this has changed, as you do seem to be using the debug version of AudioDxe.efi: the HDA: lines are in the text log, assuming the text log comes from the same run as the video.)

Yes, the txt log comes from the same run as the video, I'm not sure why the logging changed, I'm still using the same EFI folder I used for the old videos (I kept an untouched copy of it while using another non-debug one for everyday use), and yes I'm using the debug version of everything (or at least everything I'm using in this EFI folder) that was in the test build you sent me, I was under the assumption that it was logging differently because of fome change on your part.

@MagistraNocte
Copy link

Ok changing to BuiltInText reverted it back to how it was in previous videos, strange though, I don't remember ever changing it in the firts place, anyway, here's another video, the chime boom clearly occurs at the enable output amp vref 1 - Success line, the rest is same as my previous comment.

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 17, 2023

Okay, that one worked. Thank you.

I agree that from your table of results, AudioDxe is negatively affecting your noises at startup (extra clicks that you don't get without it; even though on some systems - such as mine - the same clicks at the same times occur with or without it). Can I confirm one more thing? You do have sound working in macOS itself, right? And if so then, without AudioDxe, that gives no clicks or booms after the very first machine startup click, all the way up to and including macOS starting to play sounds?

If so, I guess my next step should be to look into the AppleALC setup for your machine, since that + AppleHDA apparently does know how to start your sound card without clicks.

@MagistraNocte
Copy link

I confirm that without AudioDxe no click (other than the startup one) is ever heard.

Yes my audio is setup correctly with the correct layout id and everything, it works even though I don't use it at all (I have a better external class compliant usb sound card), I must note though that if I use it (i.e. if I connect my main speakers to the integrated output of the motherboard instead of the usb sound card) the sound works but it's very noisy, since my previous build was my first assembled pc (only real macs before that one) and it was also an hackintosh (el capitan+clover, made in 2015) and I was already using this external sound card at the time, I don't really know integrated motherboard sound cards at all and I don't know if this level of background noise is normal and to be expected from them, I know they are a cheap component.

There is also some coil whine problem, coming from my psu I think, and some other (different) from my gpu (rx 5700xt), and some of it seems to end up in the integrated audio signal (maybe it wouldn't be that noisy without this), but this is a known problem with some of these cards in hackintoshes (something to do with power management I think, I don't experience it at all in windows).

@MagistraNocte
Copy link

One thing to note: you tested using headphones connected directly to the motherboard, in my current setup instead I have a small speaker (+ amplifier) connected to the hd_audio header on the motherboard (the one you usually connect case front panel to) BUT it is connected through just some jumper cables, i don't have an actual front panel cable connected to it, I'm just using the audio + and - pins to extract the signal to send to the speaker, the rest of the hd_audio header is free, as a result it is not seen as a possible output device by the OS (not even windows) because I have not populated the other pins through which the OS knows that a front panel exists (if you have one) and that headphones are connected to it, so I cannot play any sound through the speaker after boot, AudioDxe on the other hand seems to not care about the sense pin and all and it is able to play the chime through it just fine (although with clicks).

@mikebeaton
Copy link
Contributor

Yes, AudioDxe does not check the sense pins. Making it do so would be a possible upgrade.

Given the ubiquity of pops, clicks and booms (with sufficient amplification) on these sound cards, I think this would have to be moved to low priority. Sorry!

A more like-for-like test would be if you can configure macOS so that it starts up and plays sounds through the very same channel used for the chime on your rig. I'm guessing (as I think you may be suggesting?) that it might end up sounding like my system (i.e. clicks during macOS startup even without AudioDxe).

@MagistraNocte
Copy link

Yes, AudioDxe does not check the sense pins. Making it do so would be a possible upgrade.

Please don't! that would completely break my current configuration ahah (it takes advantage from the fact that AudioDxe plays the chime through the connector even though there should be nothing connected to it, this way I can draw just the audio signal from it with jumper cables without having to connect an actual front panel and salvaging it to kind of frankenstein-soldering the speaker into it).

Given the ubiquity of pops, clicks and booms (with sufficient amplification) on these sound cards, I think this would have to be moved to low priority. Sorry!

I perfectly understand, all the time you spent on it for free is already remarkable, thank you again for that.

A more like-for-like test would be if you can configure macOS so that it starts up and plays sounds through the very same channel used for the chime on your rig. I'm guessing (as I think you may be suggesting?) that it might end up sounding like my system (i.e. clicks during macOS startup even without AudioDxe).

Actually according to my first comment in this thread (I had forget about it honestly) this only ever happens to me through the hd_audio header, If I connect something (like my main speakers, the one normally connected to the external usb sound card) to the rear motherboard audio out there are no pops, with or without AudioDxe enabled (that is, if my first comment is to be trusted, since I don't really remember anymore, I should test it again), I was suggesting you should see if you hear the clicks through headphones connected to your case front pane audio out, if you have any (and if it is connected to the hd_audio header on the motherboard like my little internal speaker is) because that would be closer to my setup here (if I remember correctly what I tested back when I wrote my first comment, I had tried using the front panel from my old case, connecting it to the hd_audio header of my current build and connecting my main speakers to it and the booms where there, like you would expect), even though if you hear them from the rear motherboard out that's already enough to say you experience this problem too (although it is different).

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 17, 2023

Please don't! that would completely break my current configuration ahah

If it was done - certainly very low priority - it would definitely be as an option, with the old behaviour probably remaining the default.

I was suggesting you should see if you hear the clicks through headphones connected to your case front pane audio out

My headphones are connected to my case front panel audio out! (I assume you just mean the normal headphone connector on the front of the case - in a situation like mine with a standard setup.)

@MagistraNocte
Copy link

My headphones are connected to my case front panel audio out! (I assume you just mean the normal headphone connector on the front of the case - in a situation like mine with a standard setup.)

Oops! i guess I misread your comment, then your test shuold be equivalent to my current setup

@mikebeaton
Copy link
Contributor

Oops! i guess I misread your comment, then your test shuold be equivalent to my current setup

Well I suppose not quite, because when my headphones are plugged in macOS carries on to produce sound through those, whereas in your case it produces sound through another channel, right?

@MagistraNocte
Copy link

In my case macOS outputs sound through the usb sound card (just because I set that in system preferences, I can switch to motherboard out and optical, which I don't have), but only after boot, during boot AudioDxe is set to output sound to the hd_audio header only

@mikebeaton
Copy link
Contributor

Yes that is what I understood. The additional test which I would be interested in is, if you could manage to persuade macOS to output sound through the same channel of the same codec as your chime, then does your system replicate everything on my system, including two clicks at macOS startup (even if you do not use AudioDxe)?

@MagistraNocte
Copy link

You mean having an actual front panel connected to the motherboard instead of a couple of jumper cables and selecting it as the audio device in the OS prior to rebooting? I think I did it back before my first comment, I don't quite remember but I could certainly do that again

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 17, 2023

I don't think there is a need for changing any other connections, as long as you can short the sense pins so macOS will see the output as present and usable.

@MagistraNocte
Copy link

What pin should I short the sense one with?
this is the pin configuration on my board:

Schermata 2023-03-17 alle 2 35 17 PM

@MagistraNocte
Copy link

Actually I recall reading somewhere that shorting the sense pin only tells the OS that a headphone has been connected in the port, not that there is a front panel connected to the motherboard, I think that is more complicated and requires putting specific resistors between some pin

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 17, 2023

Tbh at a complete guess, I would have said you might just need to short Head Phone Detection to GND. But that is only if your macOS thinks there is a headphone jack, but just with nothing connected to it. Might be worth a try? If not, I agree it may be more complicated.

@MagistraNocte
Copy link

I think I'll cut through it and just connect my old case front panel like I did before, I'll do that tomorrow and let you know

@MagistraNocte
Copy link

MagistraNocte commented Mar 19, 2023

Ok I executed extensive tests in all possible configurations and found out there are two distinct sets of booms: one coming from the main speakers connected to the USB soundcard (these are barely audible normally and that's why I never noticed and never brought that up, I had to crank the amplifier volume up to hear them clearly, I also usually have the amplifier off by the time I reach the login screen), and the known old ones from the little speaker connected to the motherboard via the f_audio header (or via my old case front panel through a jack-jack cable and some crocodile connectors and then to the f_audio header, I also tested with headphones instead but the result are identical, although the booms are fainter and more difficult to identify).
How many booms there are and when they occur depends on these factors:

  • Setup (front panel or no front panel).
  • AudioDxe (enabled or disabled).
  • Sound device set in system preferences (front panel headphones or USB soundcard)

I summarized the tests setup in this table:

Setup AudioDxe Audio device in system preferences
TEST1 Frontpanel connected to motherboard, small speaker connected to front panel. Main speakers connected to USB soundcard, volume cranked up. Enabled Headphones (front panel)
TEST2 Frontpanel connected to motherboard, small speaker connected to front panel. Main speakers connected to USB soundcard, volume cranked up. Disabled Headphones (front panel)
TEST3 Frontpanel connected to motherboard, small speaker connected to front panel. Main speakers connected to USB soundcard, volume cranked up. Disabled USB soundcard
TEST4 Frontpanel connected to motherboard, small speaker connected to front panel. Main speakers connected to USB soundcard, volume cranked up. Enabled USB soundcard
TEST5 Small speaker connected to motherboard with jumper cables (no front panel, as in previous videos). Main speakers connected to USB soundcard, volume cranked up. Enabled USB soundcard
TEST6 Small speaker connected to motherboard with jumper cables (no front panel, as in previous videos). Main speakers connected to USB soundcard, volume cranked up. Disabled USB soundcard

I made videos of all 6 tests and included the corresponding opencore boot log txt here. I decided to record the videos with the main speakers volume cranked up to catch those booms too, but later I realized they also occur by simply unplugging the USB soundcard and plugging it in again with the system already on, so I discarded them as not being part of the booms issue and I will ignore them (I will only signal on screen those coming from the small speaker in the videos, ignore the rest), although they occur regardless of AudioDxe being enabled, so maybe they are related to what you are reporting?
These are the results:

TEST 1
  • 1st boom: the boom normally occurring at the beginning of the chime, here it occurs prior to that because of SetupDelay, it is a lot fainter in the front panel setup, it occurs precisely at line HDA: Widget @ 0x18 enable output amp vref 1 - Success
  • Chime
  • 2nd boom: (this and the 3rd one are the couple of booms already discussed alongside the chime one in previous videos) the one occurring prior to the bunch of <private> lines, it seems to occur at line ALF, hash_free: found kext_info <ptr> ALF, hash_free: found kext_info <ptr> IOPPF: XCPM mode but could also occur at one of the neighbouring lines, difficult to tell, pause the video to see them.
  • 3rd boom: the one occurring in the middle of the bunch of <private> lines, no info on this.
  • 4th boom: this and the 5th booms are new and exclusive to the front panel setup, this one seems to occur at the first of 5 similar lines: [AppleUserHIDEventDriver.cpp:215][0x100000680] Set LED 0x1: 0 0x0, the only thing changing between the 5 lines is the final "0x1" part, the number after the "x" increments for every line (could also be occurring at the previous line, difficult to tell).
  • All text disappears
  • 5th boom: it occurs when the screen is black.
  • Login screen appears
TEST 2
  • 1st boom: in this test this boom doesn't occur since AudioDxe is disabled and there's no chime.
  • no chime
  • 2nd, 3rd and 4th booms: these do not occur in this test, as all the other booms coming from the small speaker.
  • Screen goes black
  • 5th boom: same as the others.
  • Login screen appears
TEST 3
  • 1st boom: in this test this boom also doesn't occur since AudioDxe is disabled and there's no chime.
  • no chime
  • 2nd, 3rd and 4th booms: as for TEST 2 these do not occur when AudioDxe is disabled.
  • Screen goes black
  • 5th boom: same as the others.
  • Login screen appears
TEST 4
  • 1st boom: same as TEST 1.
  • Chime
  • 2nd boom: in this test all the lines containing the ALF, hash_free: found kext_info <ptr> string are missing in this part of the boot (before the <private> lines), so this boom seem to occur at line Unsupported PCH instead, or the line immidiately after that.
  • 3rd boom: same as TEST 1.
  • 4th boom: this seems to occur at the [IOUserUSBHostHIDDevice.cpp:1125][0x100000616] Add element to action array: 1, which is the line just before the one in TEST 1, but could also be one of the neighbouring lines.
  • All text disappears
  • 5th boom: same as TEST 1.
  • Login screen appears
TEST 5
  • 1st boom: same as TEST 1.
  • Chime
  • 2nd boom: this time this boom seem to occur at line AMFI: '/System/DriverKit/System/Library/dyld/dyld_shared_cache_x86_64h' is adhoc signed. instead, which is a couple of lines after the Unsupported PCH line of TEST 4 (could also be occurring at one of the neighbouring lines).
  • 3rd boom: same as TEST 1.
  • 4th boom: in the no-front panel configuration this boom is not present
  • All text disappears
  • 5th boom: same as 4th.
  • Login screen appears
TEST 6
  • 1st boom: same as TEST 2 and 3.
  • No chime
  • 2nd and 3rd booms: same as TEST 2 and 3.
  • 4th boom: same as TEST 5
  • All text disappears
  • 5th boom: same as 4th.
  • Login screen appears

Conclusions:
Apart from the 1st boom, the others seems to occur in pairs, like something was being shut down and turned on again (I'm not necessarily saying that is what is happening, but that is what it sounds like) the same can be heard for the booms coming from the USB sound card, I don't know if that's related.
Tests 2, 3 and 6 are identical: no boom is ever heard from the small speaker, regardless of it being connected to the motherboard with jumper cables or through the front panel, or the device selected in system preferences, the only variable affecting their presence is AudioDxe being disabled.
In all other tests where AudioDxe is enabled the 1st, 2nd and 3rd booms are always present although at slightly different positions: the 1st is slightly fainter than the others (this difference is accentuated by the front panel setup) and always appears precisely at line HDA: Widget @ 0x18 enable output amp vref 1 - Success, the 2nd boom appearance vary: maybe the boom doesn't align perfectly with the line generating it and it's always the same line, or maybe the differences in the tests dictate a different line generating it, the 3rd always appears in the middle of the <private> lines.
4th and 5th booms are only present in the front panel setup and only if AudioDxe is enabled (TEST 1 and 4): the 4th boom occurs at around the same time in both tests, I identified diffrent lines generating it in the two tests (even though they are next to each other) but could very well be generated by the same line in both, it's difficult to tell, the 5th one always occurs while the screen is black between the verbose part and the appearence of the login screen.
The device set in system preferences doesn't seem to influence the results at all (it only seems to influence the booms coming from the USB soundcard).

I don't know if any of this is useful to you, I honestly just wanted to put everything down once so to have something organized to reference, and I hope you can recognize some of those lines and maybe infer the cause from those.
I'm not interested in the booms coming from my main speakers as they are noticable only with the volume cranked up, and they seem to not being related to AudioDxe, so they're not your problem, but the ones coming from the small speaker are clearly AudioDxe related and they kind of break it for me, there's no point in having an internal speaker to play the chime in this build like the original Powermac G4 had if they also play loud pops here and there during boot, and I already put a lot of effort into figuring all out and modifying the case to mount everything in, and it's a nice feature I really wanted, so I really hope this can be fixed (althoug there's no rush, I can just disable it while I wait for a fix, if it ever comes).
That said, I perfectly understand this is kind of a remote scenario (normally people don't connect speakers to f_audio headers, as that's not what they're for) and even though this also happens with headphones and actual front panels it's still a corner case since virtually no one has headphones on while booting, so I get this is not a priority at all (although you reporting you hear them regardless of AudioDxe being enabled is a complete different story and could be affecting many more people) and I will stress again how much the time you're putting in this for free is appreciated.

@mikebeaton
Copy link
Contributor

mikebeaton commented Mar 19, 2023

It would help if you could summarize the tests and booms in a table, so maybe TEST1-TEST6 across the top, and a description of the various booms down the side (a bit like my table, but with more entries, I guess!) - and do not leave out the to USB/non-small speaker clicks and pops - you can just describe which speaker they come from in the description.

@MagistraNocte
Copy link

MagistraNocte commented Mar 20, 2023

I had originally started noting all the main speakers booms in the videos and in the comment too, but stopped and erased them after I found out they also occur when unplugging and plugging back the USB soundcard while the system is already on (this makes me think it is not related to the original issue, even though I just tested with windows and this doesn't occur), I won't go back and redo it because it was taking a huge time and their timing was not as accurate as the others so the lines they were appearing at were often different between tests, but I can do a table no problem:

Boom N° TEST 1: Front panel, AudioDxe enabled, Device: headphones TEST 2: Front panel, AudioDxe disabled, Device: headphones TEST 3: Front panel, AudioDxe disabled, Device: USB soundcard TEST 4: Front panel, AudioDxe enabled, Device: USB soundcard TEST 5: No front panel, AudioDxe enabled, Device: USB soundcard TEST 6: No front panel, AudioDxe disabled, Device: USB soundcard
1st (small speaker) the one before the chime Yes (fainter) No No Yes (fainter) Yes No
Chime Yes No No Yes Yes No
2nd (small speaker) the one prior to the <private> lines Yes No No Yes Yes No
3rd (small speaker) the one in the middle of the <private> lines Yes No No Yes Yes No
4th (main speakers) comes at the end of the <private> lines Yes Yes Yes (double*) Yes (double*) Yes Yes (comes a little earlier, around where the 3rd usually occurs)
5th (main speakers) comes a bit after the 4th Yes Yes Yes Yes Yes Yes (comes a little earlier)
6th (small speaker) [ex 4th] comes a bit before the black screen Yes No No Yes No No
Screen goes black
7th (small speaker) [ex 5th] comes while the screen is black Yes No No Yes No No
8th (main speakers) comes while the screen is black Yes Yes Yes Yes Yes Yes (come a little earlier, before the screen goes black)
9th (main speakers) comes while the screen is black Yes Yes Yes Yes Yes Yes (comes a little earlier)
Login screen appears
10th (main speakers) comes during the login screen Yes Yes Yes Yes Yes Yes
11th (main speakers) comes during the login screen Yes Yes Yes Yes Yes Yes

*In this setup it is not a single boom but rather two distinct booms but very close to each other so that they are discernible only through the slo-mo function of the video, in person they sound like a single noise, although qualitatively different than the others.

Here is an overall scheme of the boom pattern regardless of the test considered:

Speaker Small speaker Main speakers
1st boom Only when AudioDxe is enabled (fainter in the front panel setup)
Chime Only when AudioDxe is enabled
2nd boom Only when AudioDxe is enabled
3rd boom Only when AudioDxe is enabled
4th boom Always (double when in the front panel setup AND USB soundcard is selected in system preferences) (comes earlier in TEST 6)
5th boom Always (comes earlier in TEST 6)
6th boom Only when AudioDxe is enabled AND in the front panel setup
Screen goes black
7th boom Only when AudioDxe is enabled AND in the front panel setup
8th boom Always (comes earlier in TEST 6, before the screen goes black)
9th boom Always (comes earlier in TEST 6)
Login screen appears
10th boom Always
11th boom Always

@franksfc
Copy link
Author

@MagistraNocte - Thanks for that dump. I was playing around with this a bit more last night, and I'm a bit less hopeful.

I can recreate exactly (?) the same booms and pops if using the earphone output from the built in Realtek ALC255 on my Dell 3070 i9 MFF.

I previously understood @franksfc's original report to state that there were no booms and pops at all without AudioDxe (i.e. with that driver disabled), but that is not my experience:

Without AudioDxe With AudioDxe (+ SetupDelay*)
Pops on starting machine yes yes
Additional pop before chime no (n/a) yes
Two pops during macOS boot progress bar yes yes
Pops while shutting down macOS yes yes
Pops while starting Linux yes yes
*Using SetupDelay just helps to separate the audio setup pop from the chime itself.

@MagistraNocte - Can you confirm (or deny) any of the above findings, for your setup?

I also attempted fairly radically changing the setup order - and unfortunately got exactly the same pop, on exactly the same command (i.e. when enabling output amp vref as per the OC log with delays). You can try this alternative version too, if you like, it will be the macOS build artefact from here https://github.com/mikebeaton/OpenCorePkg/actions/runs/4423925293, when it has finished building, so another video with audio, showing the log on screen and being able to hear when it pops, would be useful!

Here is a recording of my issue. I set my SetupDelay to 1000. There is always a boom sound before the driver tries to play the chime. I know the boom sound may happen in some cases such as booting the PE, but it never happens when booting the windows. Hope I have made it clear.
Chime 2.zip

@mikebeaton
Copy link
Contributor

Thanks for the recording. It is accepted that there is an issue, which will be annoying to people on whose setup it shows. In fact I was able to replicate something very similar on my headphone jack. But it's likely to be a fairly significant investment of time to figure out how to resolve this (and very likely in some systems it will not be fully resolvable). 'Help wanted' label still applies, for anyone who has, or wants to gain, the necessary skills to look at this.

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

No branches or pull requests

3 participants