Thanks! Worked for me as well. On the Raspberry Pi 3, seems there’s about a half second delay in speaker output from HDMI to the audio output. A little shorter delay may be livable, but doesn’t even sound like a concert hall echo.
Is the audio ahead of the picture or behind ? Are you sure it’s half a second ?
If the audio seems to be ahead of the picture then this is expected - analog audio output has zero delay/latency, however HDMI picture and audio always has an inherent processing delay in the TV/display - typically this is anywhere from about 40-150ms on a modern LCD TV, and it depends greatly on what post processing modes you have enable such as frame interpolation (“smooth” mode) etc…
If you use HDMI audio the delay of the picture and audio is equal so there is no problem - the TV knows to delay the audio to match the image processing delay because it knows what its own image processing delay is.
If you use HDMI for video but analog for audio the Pi has no idea what the image processing delay of the TV might be - so inevitably the image lags behind the audio by an amount equal to the processing delay of the TV. With lots of post processing options enabled (especially frame interpolation) the delay can be substantial.
To fix this you would need to either set a default audio offset for all videos (through the OSD controls) or set a default video delay in advancedsettings.xml. My primary Kodi box is a Mac Mini with DVI output - so only the image is sent to the HDMI TV, analog audio is routed directly to the AV amp - in this configuration I need to set an audio delay of about 150ms, but this depends on which image post processing settings I have enabled on the TV, so I leave those settings alone.