Android 4.4-r3 hdmi audio not working / set default audio output

1,941 views
Skip to first unread message

Goroth

unread,
Sep 21, 2015, 8:46:11 PM9/21/15
to Android-x86
I have ran alsa_aplay -l and can see the HDMI audio but it is not at index 0.
The HDMI is listed as 0,3.
So I ran 

dd if=/dev/urandom bs=8000 count=1 | aplay -D plughw:0,3

The sound does play through the HDMI when the above command is executed.
So how to I set the default audio as the HDMI audio output?

DZ

unread,
Sep 22, 2015, 11:00:42 AM9/22/15
to Android-x86

I don't know the answer but I came across this site which may help.

http://www.sabi.co.uk/Notes/linuxSoundALSA.html

DZ

unread,
Sep 22, 2015, 11:06:30 AM9/22/15
to Android-x86

Goroth

unread,
Sep 22, 2015, 4:20:48 PM9/22/15
to Android-x86
Thanks for the links.
Unfortunately, it looks like Android does not have the alsa.conf file or the .asoundrc file.
I did use alsa_aplay and alsa_amixer to view the sound card information but I can't see any place to set the default sound device.
There is mention of setting the "index=" in the link but then it never show how.
I found another article that said to change the index of the sound devices I would have edit some "c" file for sound and rebuild the kernel.
I am new to Linux / Android but in my mind rebuilding a kernel just to change the "default" sound device seems odd.

Antony Stone

unread,
Sep 22, 2015, 4:25:48 PM9/22/15
to andro...@googlegroups.com
On Tuesday 22 September 2015 at 22:20:47, Goroth wrote:

> Thanks for the links.
> Unfortunately, it looks like Android does not have the alsa.conf file or
> the .asoundrc file.

Do you mean they don't already exist, or that it wouldn't pay attention to
them if you created them?

Just because they aren't already there doesn't mean they might not work if you
put them in place - it's worth a go.

> I am new to Linux / Android but in my mind rebuilding a kernel just to
> change the "default" sound device seems odd.

I completely agree.


Antony.

--
If the human brain were so simple that we could understand it,
we'd be so simple that we couldn't.

Please reply to the list;
please *don't* CC me.

Goroth

unread,
Sep 22, 2015, 10:53:30 PM9/22/15
to Android-x86, Antony...@android.open.source.it
First I added a new file "/system/etc/asound.conf" with the following:
pcm.!default {
   type hw
   card
0
   device
3
}

ctl
.!default {
   type hw
   card
0
   device
3
}

rebooted and ran "alsa_aplay -l" but this still shows my device as 0:3 not at index 0
I then ran "dd if=/dev/urandom bs=8000 count=1 | alsa_aplay -D default" but that did not work.

So I added a new file "~/.asoundrc" with the same layout listed above but that did not work.

I can run "cat /system/usr/share/alsa/alsa.conf" and see that it should read both "asound.conf" or ".asoundrc" but that does not see to be the case.

Goroth

unread,
Sep 23, 2015, 8:24:43 PM9/23/15
to Android-x86, Antony...@android.open.source.it
I just noticed that in terminal if I do "su" then run "alsa_aplay -l" I get "no soundcards found" 
BUT if I do "su" then run "alsa_aplay -l" I get a list of sound devices.
I wonder if this is a permission issue for the Android user?

Goroth

unread,
Sep 23, 2015, 8:52:13 PM9/23/15
to Android-x86, Antony...@android.open.source.it
Well I know it is reading the "/system/etc/asound.conf" file because when I forgot an ending } the alsa_aplay throw errors.
Still does not let me change the default but at least it is reading the file. "As SU".

Goroth

unread,
Sep 23, 2015, 10:13:35 PM9/23/15
to Android-x86, Antony...@android.open.source.it
I feel I am close.
I followed this link https://bbs.archlinux.org/viewtopic.php?id=124380 and changed "/system/etc/asound.conf" to
pcm.!default {
  type plug
  slave
{
    pcm
"hw:0,3"

 
}
}
ctl
.!default {
  type hw
  card
0
}

And now I can run "alsa_aplay -D default test.wav" and I hear sound from the HDMI.
BUT when I go into apps like YouTube, I don't hear sound. The sound is still being directed to the output on the computer not the HDMI.

DZ

unread,
Sep 26, 2015, 7:32:49 AM9/26/15
to Android-x86, Antony...@android.open.source.it

What system are you testing this on?

Goroth

unread,
Sep 26, 2015, 2:29:12 PM9/26/15
to Android-x86, Antony...@android.open.source.it
They system is a Zotac CI320.
Based on the DEV_0892 it looks like the sound is a Realtek ALC892.
If I disable the sound card in the BIOS then HDMI sound does not work at all.
When I use APLAY -L then there is only on CARD 0 but several devices on that card.
Someone had mentioned that a person could edit some "C" file in the Android x86 code to change the device order but I can't seem to find that link again.

Goroth

unread,
Sep 26, 2015, 7:00:30 PM9/26/15
to Android-x86, Antony...@android.open.source.it
I found this page http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html that talks about using plugins for alsa.
I tried "null" to disable device hw:0,0 did not work.
Then I tried "copy", "share", "route_policy" but none of them seem to work.

DZ

unread,
Sep 27, 2015, 6:04:44 PM9/27/15
to Android-x86, Antony...@android.open.source.it
Is this link the mention of the edit to the source code that you were referring to?

http://grokbase.com/t/gg/android-x86/13bc25705s/intel-nuc

Goroth

unread,
Sep 27, 2015, 6:35:34 PM9/27/15
to Android-x86, Antony...@android.open.source.it
That link seems to be if PCM was not working for HDMI but it is working on mine.
Anyway, I am abandoning this post. 
I have 4 other posts at other forums and even stack overflow but it seems that it is not possible to change the device order on a single sound card.
This project was for a car pc and I was having way to many problems to overcome. 
No sound, no on screen keyboard, bluetooth acting odd at times, and can't seem to get all screens to lock in landscape mode.
Anyway, I installed Windows 10 and put the computer in my car with an ODBII connection.
I will try Android again in about a year or two when it has a bigger support community for hardware issues.

Thank you for all your help.
Reply all
Reply to author
Forward
0 new messages