No sound on the HDMI of RPI3 model B

Using HDMI cable, I connected RPI 3 to a TV and a home theater to perform the tests, however I could not play radio sound or audio file.

Applied Configuration

sudo amixer cset numid = 3 2

Applied configuration to /boot/config.txt

sudo nano /boot/config.txt

initramfs volumio.initrd
gpu_mem=32
max_usb_current=1
dtparam=audio=on
audio_pwm_mode=2
dtparam=i2c_arm=on
disable_splash=1
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_mode=16
include userconfig.txt

Suggested commands:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 2/3
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2

$ tvservice -a
[E] Failed to initialize VCHI (ret=-1)

$ tvservice -s
[E] Failed to initialize VCHI (ret=-1)

I get sound on HDMI using the command
$ speaker-test -c2

I can get video normally on TV and at home theater

Any help is welcome

Like this? I did not remove the post. Did I do something wrong?

Another question. HDMI only has two audio channels?
~$ sudo /opt/vc/bin/tvservice -a
PCM supported: Max channels: 2, Max samplerate: 48kHz, Max samplesize 24 bits.

Oh, I’m using the version > volumio-2.882-2021-04-24-pi.img

Is a solution possible?

It seems that you can get output 5.1 with the command:

sudo speaker-test -c6 -D hw:0,1

Source: How to enable 5.1 channel audio over HDMI - Raspberry Pi Forums

no @NaviGO you didn’t do any thing wrong i wasn’t sure so we have to wait
for the pro’s i’m just novice… @gvolt can you pick it up… i’m more a rpi4 guy.

I am not familiar with audio over HDMI, so I can’t really help. I can only report that it just worked on a Pi4 running Volumio 2.882 with the output device set to “HDMI out”. I did not use any commands from the command line (like sudo amixer cset numid = 3 2).

Just in case it could be of interest, here is the output of aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 3/3
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2

And sudo /opt/vc/bin/tvservice -a gave:

 PCM supported: Max channels: 8, Max samplerate: 192kHz, Max samplesize 24 bits.
 AC3 supported: Max channels: 6, Max samplerate:  48kHz, Max rate  640 kb/s.
 DTS supported: Max channels: 6, Max samplerate:  96kHz, Max rate 1536 kb/s.
 EAC3 supported: Max channels: 8, Max samplerate:  48kHz, Max rate    8 kb/s.
 DTS_HD supported: Max channels: 8, Max samplerate: 192kHz, Max rate    8 kb/s.

Using “MPlayer” I can play MP3 files easily at HDMI output, that is, very likely is a Volumio bug.
Would it be case to open some help request in Github?

i would advice to skip this version and look if 3.xx runs oke that would be a faster way,
and Mplayer could use a different kernel.

I downloaded a new file, same version (volume-2.882-2021-04-24-pi.Img), recorded in microSD and worked well now.

Thank you for your help @dvo @gvolt

Another question, in the GPIO module with digital output (coaxial, spdif, …), some of them provide more than two audio channels?

5.1 surround sound physically needs only a stereo connection (which the R-PI has in the form of the 3.5mm jack). Surround information is encoded in the phase difference of the stereo signal. GPIO Module they call that a Hat you will find them in many forms.

https://www.raspberrypi.org/forums/viewtopic.php?t=274880