davidjo / snd_hda_macbookpro

Kernel audio driver for Macs with 8409 HDA chip + MAX98706/SSM3515 amps
GNU General Public License v2.0
288 stars 62 forks source link

[temporary fix] Sound distorted after reboot back to macOS (how to restore macOS sound coreaudio) #131

Open flagsoft opened 3 months ago

flagsoft commented 3 months ago

Sound distorted after reboot back to macOS.

Have to RESET macOS sound sytem.

macOS reset sound

% sudo pkill coreaudiod

or

% sudo pkill -9 coreaudiod

or

You can kill the CoreAudio process by opening Terminal and running: sudo kill -9 ps ax|grep 'coreaudio[a-z]' | awk '{print $1}' It will restart automatically after a couple seconds.

-> Someone can fix this, restore the sound hardware settings as it was before change in Linux kernel module ?

davidjo commented 3 months ago

Well this has never happened to me so have no idea. There is no connection between linux and OSX. What method are you using to boot into linux?

flagsoft commented 3 months ago

I know, there should be no physical connection between a reboot from macOS to Linux and back. But there is NVRAM (non voltage ram) which survives a reboot and power loss. Maybe there is a problem? I know macOS stores for example the user setup sound loudness there.

Setup:

macOS:

  1. run original macOS 13.5.2 (Ventura) on original hardware.
  2. plug in Linux with USB external drive
  3. reboot macOS
  4. press and hold option or alt key
  5. choose external USB drive with Linux
  6. hit enter to start Linux
  7. work with Linux (and sound works with your kernal patch)
  8. Reboot
  9. unplug USB drive with Linux
  10. boot normal back to macOS
  11. back on macOS: Sound is distorted
  12. Apply RESET macOS sound with sudo pkill coreaudiod sound goes back to normal.
davidjo commented 3 months ago

All I can do is describe my setup - which is a macbook pro not Imac First, I rarely use USB disk - I have separate OS partitions on main disk for OSX and linux (plus user data partitions for OSX and Linux). I am booting using something called refind - this is an EFI boot tool - think I had problems with using the option key for linux booting - which initially was pre grub2 - Ive been using refind since before the current 14,3 model. Im also running High Sierra still - Apple seems to have been locking down OSX since then so very wary of it - although I did recently create an external USB boot for I think Ventura. I think there was a command for looking at nvram in linux but doesnt seem to exist now in Ubuntu 24.04 - the one thing I am doing is using efibootmgr (linux) which does write efi variables (but I think they may be different from nvram variables). Its curious that killing coreaudiod resets your sound - my linux driver is based on the Apple IOHDAFamily.kext which is the low level driver (under the AppleHDA kext - however I dont think you can see that now as I believe Apple has "removed" kexts as separate loadable drivers and placed them all into some huge "library" which is now immutable) - coreaudiod is the high level driver.

I have issues with linux booting - sometimes it doesnt work - especially after multitple reboots - plus if reboot from linux to linux a few times that also seems to lead to boot failures (which requires a power off sometimes or at least a boot into osx) - suggesting something is getting corrupted - although I suspect this is because some devices are setup at boot time prior to the actual OS starting - but didnt think this was for the audio part.

Do you get the issue if you power off on the switch from linux to OSX?

flagsoft commented 3 months ago

I did a test, with Power OFF (plug removed from the main outlet), wait about 10 seconds, and reboot to macOS again. And the sound seems to be normal.

fspkwon commented 3 months ago

just reset (pull) the pram/nvram like command option shift p r power and plug power in let it shut off itself virtually then while off hold power 30s remove ram if having to hold power 30s with it off like a date/time and standard password reset

davidjo commented 3 months ago

Well its either a hardware difference between powerbooks and imacs or an os version difference. Maybe newer Apple OSs arent resetting the hardware as much between reboots. Have you tried without blackhole - it seems to be a higher level virtual driver so wouldnt think its an issue. Could you try Mojave - the lowest version it seems your imac will support - from what I googled dont think you can use High Sierra.

davidjo commented 3 months ago

One other thought is have you tried without blackhole installed?

fspkwon commented 3 months ago

i found it to be acceptional where i dont know if its 44100 / 12-bit audio or w/e its called you cant exceed and notices when an application does itll sort of appear to be going through whats called a frequency filter but other than that the driver doesnt support locking(); and has a memory_limit<- but aside from just saying that it does i dont find that ardour for example is Hindered by any sort of limitation that would be i think thats because its an actual HDA/Codec i map in the output select theres 0/1/2/3 i have 0/2 meaning it might say 1/3 <- this means that the left side of the computer will function while using the digital audio workstation that could just be for sake of bandwidth while working who knows why chose to do that that way<- also you have to disconnect the audio input entirely which just do it 1nce and save it as a template save your configuration as a template and make everything use software mixer is the only way to get persistent sound state saving <- meaning how you select 0/2 1/3 you go to the input drop down list or tab itll show the lines going to ardour in right click one and click disconnect all and thatll fix the audio monitoring issue for your session you can also disconnect it through the mixer but you want to do it at the interface configuration level, im on gentoo and can confirm all is working throughout kernel recompiles also.........