[T-Mobile Samsung Galaxy S 4] panchox:
This will be a long post to explain my problem and I hope somebody could enlighten me on what's happening and if it's fixable

Sound Problem

Bought an used T-Mobile S4 (SGH-M919), came with stock 4.3 (MK2), not rooted, not KNOX warranty voided, everything working perfectly including sound, 2 days of constant use, then I wanted to upgrade to 4.4.4 (NK2), I tried through system update on Android and it only said "Failed to register" or something similar, however with Kies3 I was able to upgrade, then the nightmare started.

Being a stock firmware I thought, what could go wrong, update went smoothly, everything was working but after 10 minutes and here comes the important part, the SOUND GETS STUCK/DOESN'T RESUME/DIES AFTER THE SYSTEM GOES TO SLEEP, it always happens when I leave the screen turn off for like 5-10 minutes, the longer it stays off, less chances sound returns, not through ear piece, speaker or headphones, weird part it's that if I turn the phone off and on it works normally again until sleep, everything works normally, except for the part that if the screen goes off, hell begins, the longer it stays off, less chances sound resumes, and I say that because sometimes sound resumes but after like 5-15 seconds of waking, AND IT REPRODUCES EVERY SOUND IT SHOULD HAVE DONE WHEN IT WENT AWAKE (like button presses, volume change, sound systems, etc), like if something was stuck or in large queue, I can almost say it's 100% something related to software and not hardware since it reproduces the animation sound at the boot every time.

After the sound dies, weird stuff happens, Youtube videos get reproduced at like 0.5x speed, trying to play music with the default player says "Not supported" (varying mp3's from 128 to 320kbps), sometimes if I reboot from Android it gets stuck in a restart loop, not always, sound only seems to return again when it's restarted through shutdown/manually (that doesn't seem to happen with custom ROMs), sometimes Android gets weird, like laggy, no background on the home screen, stuck and with only the shutdown menu working, not even volume bar showing up or very laggy (this was something very rare in custom ROMs or it didn't happen at all).

I had to void the KNOX warranty to install a custom recovery (TWRP) and flash custom roms, I already tried stock 4.4.4 roms debloated/deodexed/rooted and even a 5.0.1 rom, tried 2 different kernels + stock, different modems varying from MK2 to NK2 again (flashed like 5 times each one), hell even I tried to flash the LTE modem (NON-HLOS.bin) from MK2, however I didn't get any sound (WiFi was working, weird) since I read that it has to match the bootloader version.

At this moment I'm downloading a 4.3 custom ROM to do another test and probably the last one, I'm running out of options.

Little Facts:

-Already went to complete stock through Kies3 and tried flashing the full firmware with Odin too.

-Volume bar changes normally, I really assured it wasn't muted in any way.

-I f*ckd up IMEI, too much wipes, kernel switches, rom flashing, I did an EFS backup just to find it was at 0 already, however problem started way before that, one problem at the time.

-Light/RGB sensor doesn't work, headphone jack do (I even dissassembled and reassembled without headphone jack to test, didn't work).

-Tried plugin headphones and removing them multiple times.

-Tried with and without a SD card/SIM/WiFi.

-No warranty.

Sorry for the long post, I can create a thread if the mods prefer.