KGL Unit + USB DAC SABRE ES9023

aluver

Senior Member
Aug 30, 2014
150
35
0
Yes. "There is noise on the HU's RCA too when no sound came out from it" - That's it!
You can hear it, if you turn volume up without playing any sound.
And, by the way, devices you told (passive mixers) are the worst things human ever made. Never use it :) . The Quality is somewere on the other side...
 

peti007

Senior Member
Nov 20, 2014
125
16
0
Tatabánya
Yes. "There is noise on the HU's RCA too when no sound came out from it" - That's it!
You can hear it, if you turn volume up without playing any sound.
And, by the way, devices you told (passive mixers) are the worst things human ever made. Never use it :) . The Quality is somewere on the other side...
OK, thanks, I understand what you say.
The coax speakers in the rear doors is not a solution. I tried to fader sound to rear with FM radio and the result is terrible.
I find an other way (maybe wrong too). RCA auto switcher. This is not mixing the two inputs into one, instead switches the Input1 and Input2 if there is sound on Input2 or not.
 

aluver

Senior Member
Aug 30, 2014
150
35
0
The coax speakers in the rear doors is not a solution. I tried to fader sound to rear with FM radio and the result is terrible.
I find an other way (maybe wrong too). RCA auto switcher. This is not mixing the two inputs into one, instead switches the Input1 and Input2 if there is sound on Input2 or not.
In my opinion KGL, KLD FM Radio sound quality is so bad that you can't make worse :laugh:
I prefer PCRadio app to listen radio (do it very rarely) - internet radio app, so sound goes through DAC.
The switcher you wrote is a better idea then rca mixer. You can try it. I didn't find any characteristics about any sound change, hope it doesn't.
You also can find DSP's with same function - i.e. switching between optical and RCA inputs. I think optical spdif is a best way to deliver sound from HU with USB-spdif converter (the best is XMOS based) or DAC with spdif output (Sabre U2 for me) to DSP or amps, that located in trunk because of quality looses in analog ways. With DSP you can built a serious install with a very good sound scene using channel delays and final tuning of frequency response.
Example - HELIX DSP PRO.
Automatic Digital Signal Detection
Switching from analog input to the digital input is done automatically as soon as a signal is detected on the optical input.
 
Last edited:

peti007

Senior Member
Nov 20, 2014
125
16
0
Tatabánya
In my opinion KGL, KLD FM Radio sound quality is so bad that you can't make worse :laugh:
I prefer PCRadio app to listen radio (do it very rarely) - internet radio app, so sound goes through DAC.
The switcher you wrote is a better idea then rca mixer. You can try it. I didn't find any characteristics about any sound change, hope it doesn't.
You also can find DSP's with same function - i.e. switching between optical and RCA inputs. I think optical spdif is a best way to deliver sound from HU with USB-spdif converter (the best is XMOS based) or DAC with spdif output (Sabre U2 for me) to DSP or amps, that located in trunk because of quality looses in analog ways. With DSP you can built a serious install with a very good sound scene using channel delays and final tuning of frequency response.
Example - HELIX DSP PRO.
This Helix DSP is the ultimate solution... but has a horrific price, at least to me.
 

R4D3N

Senior Member
Dec 23, 2008
174
38
0
If this happens after cold start too, I have the one idea only. Your sevice is starting too early, before the DAC determined by system. Check your startup sequences scripts.
Insmod-commands must be at first positions of install-recovery.sh
mtcservice must be launched by install-recovery-2.sh
There is no problem for me with Malaysk fw #23.
default install-recovery-2.sh from there:
Code:
#dsa
lsd () {
	to=$1
	shift
	for i in $*; do
		if [ -d $i ]; then
			i=${i%/}
			j=${i##*/}
			if [ "${j#com.tomtom.*}" != "$j" ]; then
				k=$((k+1))
				j=$to/$j
				if [ -n "`ls $j`" ]; then continue; fi
				mkdir -p $j
				if mount | grep "$j "; then umount $j; fi
				mount -o bind $i $j
			else
				lsd $to $i/*/
			fi
		fi
	done
}

{
IFS=${IFS#??}
while ! mount | grep "/mnt/internal_sd "; do sleep 1; done
ck=0
while true; do
	k=0
	
	#########################################################################
	### lsd syntax:                                                       ###
	### First argument is the target (internal) folder.                   ###
	### Further arguments make a list of source (external) storage paths. ###
	### If any com.tomtom.* folder is found in any source path tree,      ###
	### it will be (bind) mounted under the target folder.                ###
	#########################################################################
	lsd /mnt/internal_sd/tomtom /mnt/external_sd*/*/ /mnt/usb_storage*/*/

	if [ $k -gt 0 ]; then
		ck=0
		sleep 20
		continue
	fi
	if [ $ck -ge 90 ]; then
		sleep 30
	else
		ck=$((ck+1))
		sleep 1
	fi
done
} >/dev/null 2>&1 &

getpid () {
	ps | busybox sed -n "/busybox sed -n/! s/[^ ]* *\([0-9]*\).*$1.*/\1/p"
}

while true; do
	
	pid=`getpid maxmpz`
	if [ -z "$pid" -o "$pid" != "$pap" ]; then
		om=0
		st=0
		while true; do
			st=$((st+1))
			nm=`mount | grep usb_storage | busybox wc -l`
			if [ $nm -ne $om ]; then
				om=$nm
				st=0
			else
				if [ $st -gt 3 ]; then
					if [ $nm -gt 0 ]; then
						usb=1
						break
					fi
					if [ -z "$usb" ]; then
						break
					fi
					st=0
				fi
			fi
			if [ $nm -gt 0 ]; then
				sleep 1
			else
				sleep 3
			fi
		done
		while ! am startservice -a com.maxmpz.audioplayer.API_COMMAND --ei cmd 3; do sleep 1; done
		sleep 2
		pap=`getpid maxmpz`
	fi


	pid=`getpid petrows`
	if [ -z "$pid" ]; then
		while ! am startservice com.petrows.mtcservice/.ServiceMain; do sleep 1; done
		sleep 1
	fi
	
	
	sleep 10
done &
As you can see startservice com.petrows.mtcservice exists here by default.
I have just replaced old mtcservice apk by new own edition.
PS: Answer with quotes please, because it's the only way to get an E-mail notification for me. I visit this place very rarely.
This only happens when the unit comes back from sleep.

From cold start it works as it should, but if the unit goes in sleep, when I turn it back on (after 20 seconds for example) the volume is at 100%.

Is there a way to make the default volume for DAC 5% or to force it when cames back from sleep to set it at a safe volume?
 

aluver

Senior Member
Aug 30, 2014
150
35
0
This only happens when the unit comes back from sleep.

From cold start it works as it should, but if the unit goes in sleep, when I turn it back on (after 20 seconds for example) the volume is at 100%.

Is there a way to make the default volume for DAC 5% or to force it when cames back from sleep to set it at a safe volume?
More information - faster problem cancelation :laugh:
You should say only true one ;)
Do you have \etc\install-recovery-2.sh now?
In case of USB power-off in sleep mode, your USB-DAC has detected and reconfigured every time when HU returns from sleep. Of course, it has 100%-volume after reinitialization.
If our Petrows MTC Service has not restarted through going to sleep and awakening, it doesn't set the default volume.
So, we have three ways of fix:
1. Force restart of Petrows MTC Service (need just to kill it when going to sleep). There are several modules described on the KGL forum to do that.
2. Run alsa_amixer command to set desired volume level directly at awakening.
3. Make a proper alsa config. Just set the default volume for USB-DAC there. (this way is only if you didn't route sound by editing audio.primary.rk30board.so, but have hotplug configuration for USB-DAC)
I can't try it now. I think you could do it yourself if you read this forum.
 
Last edited:

R4D3N

Senior Member
Dec 23, 2008
174
38
0
More information - faster problem cancelation :laugh:
You should say only true one ;)
Do you have \etc\install-recovery-2.sh now?
In case of USB power-off in sleep mode, your USB-DAC has detected and reconfigured every time when HU returns from sleep. Of course, it has 100%-volume after reinitialization.
If our Petrows MTC Service has not restarted through going to sleep and awakening, it doesn't set the default volume.
So, we have three ways of fix:
1. Force restart of Petrows MTC Service (need just to kill it when going to sleep). There are several modules described on the KGL forum to do that.
2. Run alsa_amixer command to set desired volume level directly at awakening.
3. Make a proper alsa config. Just set the default volume for USB-DAC there. (this way is only if you didn't route sound by editing audio.primary.rk30board.so, but have hotplug configuration for USB-DAC)
I can't try it now. I think you could do it yourself if you read this forum.
How can I do the first option or the 2nd?
 

aluver

Senior Member
Aug 30, 2014
150
35
0
@aluver

Sometimes my audio it is distorted and interrupted and it only works good after a restart. Do you have an idea why? Can it be the buffer or what?
It's just a bad or too long usb cable and bad usb power supply. What length usb cable do you use to plug usb dac to HU? Also external powered usb hub may help. Our HUs have a worst usb power I can remember. Try any low-noise DC-DC converter to power usb hub. Read our HU forum - there must be information about that.
 

R4D3N

Senior Member
Dec 23, 2008
174
38
0
I am using the most expensive USB extension cable I have found (some 3meters HAMA triple shielded with golden connectors) , powered USB HUB (it supports 5A) and only the DAC is using USB connection, the music is stored on SD Card.
 

aluver

Senior Member
Aug 30, 2014
150
35
0
Looks like the signal drops/loss on 3 meters length, not the power. Try to check with a shorter cable. One man with KGL HU had to change usb cable to 0.5 meters to disable distortions.
 

R4D3N

Senior Member
Dec 23, 2008
174
38
0
@aluver

BUt if I use shorther cable, how do I get rid of distorsions. That was the whole idea to use DAC. I was using triple shielded RCA cables but I was still picking interferences and I had ground loop problems. I solved them by placing the DAC in the trunk through the 3meters USB cable. Now, If I use shorther USB cable, and from there RCA cables, I am afraid that I will get ground loop or alternator whine again.
 

aluver

Senior Member
Aug 30, 2014
150
35
0
@R4D3N
Do you have your powered usb hub plugged between HU and 3meters USB cable? It must work as usb repeater and you must not have any problem in this case. To exclude the hub's and usb cable's losses you need just to check distortless playing of usb dac plugged to HU directly with shortest cable you can and a good one of course. Then, if it will be ok, look at your usb hub's quality. May be a change of it will help. But if you will have the problem again, you will need to "repair" the usb chains of your HU in case they are bad. I'll try to find the information about how it can be made (I saw it at KGL forums - It's the very often problem for this HU).
As for me, I have sabre U2 plugged directly to my HU (KLD) through default china usb cable. But I use the optical out from DAC - miniToslink-Toslink adapter -> optical cable 5m -> DSP in trunk. And No problems.
 

supaneko

Member
Nov 29, 2012
39
4
0
I am using the most expensive USB extension cable I have found (some 3meters HAMA triple shielded with golden connectors) , powered USB HUB (it supports 5A) and only the DAC is using USB connection, the music is stored on SD Card.
3 meters? I would try using one that is 1m or, if you can, try to find one that is even shorter. USB gets a little weird in that signal can drop and if a unit (like our cheap head units) can't push out a decent enough signal, it will degrade rapidly. Plus, I don't know about you but the unit I have already has about half a meter of USB cable sticking out the back of it. That means if I connect a 1m cable to it, I'm really pushing the limit with ~1.5m of cable to the USB adapter.

aluver, I really appreciate your good work on this. The instructions you provided for getting the USB audio drivers installed are great. I followed them but ran into some trouble (posted a new thread because I didn't want to piggy back on my friend's here). If you happen to come across the guide you mention, I'd appreciate it as well. Also, the KGL forums you mention, would you be willing to PM me the link? I am determined to get this thing working as best as I can and unsure of a good source for support (unless XDA is a good source). :)
 

R4D3N

Senior Member
Dec 23, 2008
174
38
0
Now that I sorted all out, I want to make a short DIY for other users that want to do this.


You have in the archive almost everything you need.

From playstore you have to download a script Manager, I use SManager.


1. First you have to copy all the files from archive "system.rar" to the unit with Root Explorer, in root/system.
2. You have to install a script Manager application. I use SManager.
3. With script manager, you have to set-up to run at startup with SU privilleges the file "DAC.sh". You can copy the "dac.sh" file anywere you like on the internal memory.
4. You have to install the MTC Service app from the archive (thank you @aluver for this). This is in fact a modified Headunit app.
5. After copying all the files, you have to set 0644 permissions to all .ko files, or install the AlsaMixer app from playstore. Link directly to AlsaMixer: https://play.google.com/store/apps/details?id=com.skvalex.alsamixer (again, thank to @aluver for this info)
6. Now, after the script runs, all should work.
 
Last edited:
  • Like
Reactions: aluver

aluver

Senior Member
Aug 30, 2014
150
35
0
@R4D3N, I think you forgot about setting permissions for files from system.rar after unpacking them. Also, it's more simply - just to install AlsaMixer app from google play instead of setting permissions to all alsa files.
WARNING: Replace the libasound.so from Alsamixer's install by the original rockchip libasound.so from R4D3N's archive! So, Alsamixer must be installed BEFORE the copying files!
 
Last edited:

aluver

Senior Member
Aug 30, 2014
150
35
0
What to say... It's a miracle! :)
But for those who want to make a proper install - just set permissions within Root Explorer this way:
for all ko modules, so and conf files - 644 (rw-r--r--),
Alsa has more diversity, so just make AlsaMixer install from google play ;)