No audio when playing movie, can only hear GUI sounds in menus

So what is the exact model of the tv?
It probably cannot decode the passed audio.
Also could you provide logs when playing in different configurations please?
That would help determine what kodi actually passes on to the avr.

It is confusing that you don’t get surround sound when passthrough and 2.0 is enabled as I have that config all the time and my avr still shows dts or dolbydigital and all 5.1 channels.

Edit: If your tv has a arc (audioreturnchannel) option, turn that off…
Might be that in passthrough mode with the avr on standby, the tv decodes the signal to 2.0 channels and when you switch on the avr, it actually takes the arc channel from the tv with the 2.0 signal and plays that.

This indicates that passthrough is not used or the problem with the arc.
Or, of course, your tv can only play 2.0 channel sound no matter what.

And the last thing:
If your tv is not able to decode and downmix 5.1 audio, your only option might be to switch between 2.0 passthrough and 2.0 non-passthrough on every occasion, you want to have sound through the tv or the avr.
The raspberry cannot differentiate between the two and the avr will just pass whatever is on it’s input in standby. If the tv cannot handle that signal, the combination of tv and avr is really unfortunate and you would need a tv that can handle multichannel dd and dts natively.

Edit: If you have a BluRay player and set it to passthrough, select a dd track and connect it directly to the tv, does that produce sound?
Be sure to not let the dvd player decode the signal!

I agree with what you’re saying and I’m starting to accept that’s probably the only way around it.

I’m not at home at the moment, but I know the TV does support ARC but the AVR doesn’t.

Also, I’ve not mentioned this before, perhaps because it’s not really relevant, or maybe it is? Anyway, I’ve previously used a 2.1 Panasonic sound bar with the same TV, also connected via HDMI, I never had a problem playing content that was encoded with DD5.1 through my TV when using HDMI passthrough and the AVR was in standby. I’ll also add that the Panasonic 2.1 soundbar did support ARC (if that makes any difference or not).

I know it wasn’t a 5.1 setup, but the unit still said Dolby Digital or DTS when I played a movie, with passthrough enabled in OSMC, and when in standby I’d be able to hear the sound through the TV speakers.

So there also might be something wrong with the atandby feature of your avr. Or the other one decoded the sound even in standby.
You could try to contact sony about this. Maybe they have a firmwareupdate or something.

Can you report output of:

tvservice -a tvservice -n

with the AVR both powered up and in standby.
A difference here won’t actually help, as Kodi doesn’t make use of audio features reported from the EDID (because in general they are not reliably implemented).
But I’m interested if the AVR actually switches to the TV’s EDID when in standby. If so it may be possible to support auto switching of audio settings through a Kodi add-on.

The output seems to be the same when in active standby and powered on:

In standby

tvservice -a

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

tvservice -n

device_name=SNY-SONY_AVAMP

Powered On

tvservice -a

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

tvservice -n

device_name=SNY-SONY_AVAMP

Ok. That is unfortunate as the pi seems to only be able to see the avr and probably sends a format thatbyour tv cannot handle.

Could you try to reboot the pi while the avr is in standby and see if the output of the commands is still the same?

Just tried that, still exactly the same output from both commands.

So the edid of the avr is sent in standby, too, so its “active standby” is not just passing through all hdmi lines, but only the signals. I guess this behaviour was not present with the soundbar.

I would recommend to connect the pi to the tv directly via hdmi. If the tv has an optical or coax digital output, you could try to connect that to the avr then. That could work and you have sound from both.

Or, if you have another hdmi cable, you could try to use the arc function of the tv to send audio data from the tv hdmi to an input port of the avr. Not sure if this works though.