[Android X86]HDMI 音频或3.5mm无法输出的问题

搜索凤凰OS也有此类问题,他们大部分解决方法是删除音频设备,然后杀掉服务然后就有声音了,然后添加在开机脚本里面,开机时候执行下就ok了。

基于N显卡参考文献:https://forum.xda-developers.com/android/help/android-x86-hdmi-audio-problem-t3719337

转载一篇文章提供思路。由于是外网的,就复制出来了。

在你尝试所有办法都行不或者就干脆没有你设备的驱动,那么还有一种外部补救办法,买一个USB转3.5mm接口线或者买USB音箱。VGA的主板还可以换成USB转HDMI。VGA效果很差。


Title:How to fix HDMI audio in Android-x86 if it doesn’t work out of the box

Cache Time:2016/6/1

source:https://hernaaan.wordpress.com/2018/02/08/how-to-fix-hdmi-audio-in-android-x86-if-it-doesnt-work-out-of-the-box/


Okay. I’m writing this mini tutorial after several hours of reading and trying different things. I hope it works for you too.

Let’s say you have a laptop and boot Android-x86 from there. Maybe from HDD or maybe from USB, I think it doesn’t matter. And you connect your TV to it. You modify Grub to set HDMI-only output (‘video=LVDS-1:d’ did for me), and you get video.

If you then notice you have no sound at all, try this. Oh, and beforehand, have a short WAV file stored in the system.

1) Open a terminal (from Android menu) and ask for root access with ‘su’.

2) Check what number your HDMI card is:
# cat /proc/asound/cards

Generally, “0” is onboard audio and “1” is HDMI.

3) Check which devices are associated to your HDMI card:
# ls -l /dev/snd/

Here you have you take note of all the pcmC*D*p values, where C* is the number of the card from step 2.

4) Activate sound for the card with the following commands:
# alsa_amixer -c1 set 'IEC958',0 on
# alsa_amixer -c1 set 'IEC958',1 on
# alsa_amixer -c1 set 'IEC958',2 on
# alsa_amixer -c1 set 'IEC958',3 on

In this example, I’m using card “1” (check step 2 for yours).

5) Then, testing. To check which is the correct device you’ll need the WAV file mentioned before:
# alsa_aplay -Dplughw:1,3 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,7 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,8 /storage/path_to_file/sample.wav
# alsa_aplay -Dplughw:1,9 /storage/path_to_file/sample.wav

In this example, I checked devices “3”, “7”, “8” and “9” from card “1” (check step 2 for your card, and step 3 for its devices). You’ll hear sound in the right one.

6) When you get the correct device, proceed to edit the boot script to make the changes permanent:
# vi /system/etc/init.sh

Add these lines in the “function init_hal_audio()” section, right below “esac”:
alsa_amixer -c1 set 'IEC958',0 on
alsa_amixer -c1 set 'IEC958',1 on
alsa_amixer -c1 set 'IEC958',2 on
alsa_amixer -c1 set 'IEC958',3 on
mv /dev/snd/pcmC1D3p /dev/snd/pcmC1D3p.original
ln -sf /dev/snd/pcmC1D7p /dev/snd/pcmC1D3p

Where:
“c1” is your HDMI card (step 2),
“pcmC1D7p” is your audible device (step 5),
and “pcmC1D3p” is the FIRST one of the card (as seen in step 3).

This will allow you to keep the onboard sound if you choose to boot without HDMI video.

7) Reboot to check if you did everything okay.

原文链接:[Android X86]HDMI 音频或3.5mm无法输出的问题