[TESTING] Improved LPCM output for Vero 4K


#64

Thank you, Sam! Will report after successfully updating testing :+1:t2:


#66

Successfully installed medicaenter version 17.6.0-26 here now. Testing with the above test files (https://github.com/sfiera/flac-test-files):


23:58:18.390 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 2 Output Channel Count: 2
23:58:18.390 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR
23:58:18.390 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR (ALSA: none)
23:58:18.390 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:58:18.390 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:58:18.390 T:4034917120   DEBUG:   Sample Rate   : 48000
23:58:18.390 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:58:18.390 T:4034917120   DEBUG:   Channel Count : 2
23:58:18.390 T:4034917120   DEBUG:   Channel Layout: FL,FR
23:58:18.390 T:4034917120   DEBUG:   Frames        : 2048
23:58:18.390 T:4034917120   DEBUG:   Frame Size    : 8

  • 3.0: AVR detects 3.1 PCM channels

23:58:26.962 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 3 Output Channel Count: 8
23:58:26.962 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC
23:58:26.962 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,UNKNOWN1,FC,BL,BR,UNKNOWN1,UNKNOWN1 (ALSA: FL FR NA FC RL RR NA NA)
23:58:26.962 T:4034917120    INFO: CAESinkALSA::GetChannelLayout - masking for audio output wih a mask of 4:3
23:58:26.991 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:58:26.991 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:58:26.992 T:4034917120   DEBUG:   Sample Rate   : 48000
23:58:26.992 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:58:26.992 T:4034917120   DEBUG:   Channel Count : 8
23:58:26.992 T:4034917120   DEBUG:   Channel Layout: FL,FR,UNKNOWN1,FC,BL,BR,UNKNOWN1,UNKNOWN1
23:58:26.992 T:4034917120   DEBUG:   Frames        : 2048
23:58:26.992 T:4034917120   DEBUG:   Frame Size    : 32

  • 4.0: AVR detects 5.1 PCM channels

23:58:36.432 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 4 Output Channel Count: 8
23:58:36.432 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,BL,BR
23:58:36.432 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,UNKNOWN1,UNKNOWN1,BL,BR,UNKNOWN1,UNKNOWN1 (ALSA: FL FR NA NA RL RR NA NA)
23:58:36.432 T:4034917120    INFO: CAESinkALSA::GetChannelLayout - masking for audio output wih a mask of 6:7
23:58:36.461 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:58:36.461 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:58:36.461 T:4034917120   DEBUG:   Sample Rate   : 48000
23:58:36.461 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:58:36.461 T:4034917120   DEBUG:   Channel Count : 8
23:58:36.461 T:4034917120   DEBUG:   Channel Layout: FL,FR,UNKNOWN1,UNKNOWN1,BL,BR,UNKNOWN1,UNKNOWN1
23:58:36.461 T:4034917120   DEBUG:   Frames        : 2048
23:58:36.462 T:4034917120   DEBUG:   Frame Size    : 32

  • 5.0: AVR detects 5.1 PCM channels

23:58:56.852 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 5 Output Channel Count: 8
23:58:56.852 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,SL,SR
23:58:56.852 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,UNKNOWN1,FC,SL,SR,UNKNOWN1,UNKNOWN1 (ALSA: FL FR NA FC RL RR NA NA)
23:58:56.852 T:4034917120    INFO: CAESinkALSA::GetChannelLayout - masking for audio output wih a mask of 6:7
23:58:56.881 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:58:56.881 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:58:56.881 T:4034917120   DEBUG:   Sample Rate   : 48000
23:58:56.881 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:58:56.881 T:4034917120   DEBUG:   Channel Count : 8
23:58:56.881 T:4034917120   DEBUG:   Channel Layout: FL,FR,UNKNOWN1,FC,SL,SR,UNKNOWN1,UNKNOWN1
23:58:56.881 T:4034917120   DEBUG:   Frames        : 2048
23:58:56.882 T:4034917120   DEBUG:   Frame Size    : 32

  • 5.1: AVR detects 5.1 PCM channels

23:59:22.272 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 6 Output Channel Count: 8
23:59:22.272 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,LFE,SL,SR
23:59:22.272 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,LFE,FC,SL,SR,UNKNOWN1,UNKNOWN1 (ALSA: FL FR LFE FC RL RR NA NA)
23:59:22.272 T:4034917120    INFO: CAESinkALSA::GetChannelLayout - masking for audio output wih a mask of 6:7
23:59:22.301 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:59:22.301 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:59:22.301 T:4034917120   DEBUG:   Sample Rate   : 48000
23:59:22.302 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:59:22.302 T:4034917120   DEBUG:   Channel Count : 8
23:59:22.302 T:4034917120   DEBUG:   Channel Layout: FL,FR,LFE,FC,SL,SR,UNKNOWN1,UNKNOWN1
23:59:22.302 T:4034917120   DEBUG:   Frames        : 2048
23:59:22.302 T:4034917120   DEBUG:   Frame Size    : 32

  • 6.1: AVR detects 7.1 PCM channels

23:59:36.714 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 8 Output Channel Count: 8
23:59:36.714 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,LFE,SL,SR,BL,BR
23:59:36.715 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,LFE,FC,SL,SR,BL,BR (ALSA: FL FR LFE FC RL RR RLC RRC)
23:59:36.715 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:59:36.715 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:59:36.715 T:4034917120   DEBUG:   Sample Rate   : 48000
23:59:36.715 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:59:36.715 T:4034917120   DEBUG:   Channel Count : 8
23:59:36.715 T:4034917120   DEBUG:   Channel Layout: FL,FR,LFE,FC,SL,SR,BL,BR
23:59:36.715 T:4034917120   DEBUG:   Frames        : 2048
23:59:36.715 T:4034917120   DEBUG:   Frame Size    : 32

  • 7.1: AVR detects 7.1 PCM channels

23:59:53.572 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Input Channel Count: 8 Output Channel Count: 8
23:59:53.572 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Requested Layout: FL,FR,FC,LFE,BL,BR,SL,SR
23:59:53.572 T:4034917120   DEBUG: CAESinkALSA::GetChannelLayout - Got Layout: FL,FR,LFE,FC,SL,SR,BL,BR (ALSA: FL FR LFE FC RL RR RLC RRC)
23:59:53.572 T:4034917120   DEBUG: CActiveAESink::OpenSink - ALSA Initialized:
23:59:53.572 T:4034917120   DEBUG:   Output Device : AML-M8AUDIO
23:59:53.572 T:4034917120   DEBUG:   Sample Rate   : 48000
23:59:53.572 T:4034917120   DEBUG:   Sample Format : AE_FMT_S32NE
23:59:53.572 T:4034917120   DEBUG:   Channel Count : 8
23:59:53.572 T:4034917120   DEBUG:   Channel Layout: FL,FR,LFE,FC,SL,SR,BL,BR
23:59:53.572 T:4034917120   DEBUG:   Frames        : 2048
23:59:53.572 T:4034917120   DEBUG:   Frame Size    : 32

Everything seemed to be audibly playing alright though. Even the mapping of the center surround channel of the 6.1 file - although a 7.1 signal was sent (so, the back center channel was played by both surround channels, but that was probably mapped by the Vero, not the AVR). The LFE channel was always present (except for stereo).

  • Can the LFE channel not be masked? If not, this is fine behaviour.
  • Is there a true 4.0 PCM mode that can be made possible (still passed as 5.1 atm)?
  • As there are formats like Dolby Digital EX (6.1), DTS ES 6.1 or DTS-HD MA 6.1, it’s obvious that AVRs can process true 6.1 incoming channels (at least with bitstreaming formats). Can this be done with PCM signals, too? Or is that part just not perfect yet?

#67

Remember that in the intermediate world between L+R and a full 8-channel signal, 4.0 doesn’t say enough.

Your test used what is commonly called “quad”, in that it was L+R+LS+RS. 4.0 for movies more often means L+R+C+S. Sending the second as “5.1” mapped to L+R+C+LFE+LS+RS (with LS+RS containing the original S) is no big deal, as it would give the correct surround and allow the ARV to upmix to more speakers. Also, pretty much every AVR will route low frequencies to the subwoofer if the other speakers can’t handle it, regardless of whether there is an LFE signal, so that shouldn’t cause a problem.

OTOH, L+R+LS+RS sent with silent C may or may not be the right thing to do. Some AVRs might upmix to fill in C if it is not empty, and that’s not what you really want for quad music mixes.


#68

FLAC has a clear/unique understanding about the used channel numbers and channel layout, see https://xiph.org/flac/format.html:

With the current implementation based on the amlogic and the S905X within the Vero3, four channels pairs are available for PCM: FL+FR, FC+LFE, SL+SR, RL+RR.

Unfortunately only the following layouts can be configured with that

amount channels = 2, PCM 2.0 or 2/0.0 <-> FL+FR
amount channels = 4, PCM 3.1 or 3/0.1 <-> FL+FR+FC+LFE
amount channels = 6, PCM 5.1 or 3/2.1 <-> FL+FR+FC+LFE+SL+SR
amount channels = 8, PCM 7.1 or 3/4.1 <-> FL+FR+FC+LFE+SL+SR+RL+RR

all other combinations “in between” have to be mapped to the next “higher” layout like PCM 4.0 which can be 3/1.0 or 2/2.0 will land to PCM 5.1 and so on. Again, there are combinations possible where “empty/silent” channels are used but the situation improved a t lot from the previous implementation to map all to 8 channel PCM and the current refined solution to have 4 most common used layouts for PCM. The common audio layouts within video material are all covered with that.


#69

Excellent, thanks.

I’m looking into that. Without muting it, a silent LFE will presumably stop an AVR doing proper bass management.

Same as for muting LFE - I’m hoping it’s possible.

‘True’ 6.1 is not supported by Kodi as a standard layout so is trickier than 3.0 or 4.0. But what do you lose? Only the ability for the AVR to fill in FC which is arguably not what you want.


#70

The point is, channels sent as ‘silent’ (FC and LFE) may not be filled in by AVRs because they think they are there. That’s how this whole thing kicked off with silent back or side channels. This may be what you want (quad with FC eg) but it may also inhibit bass management. Kodi’s standard 4.0 is FL,FR,BL,BR. It should pick up on a FL,FR,FC,BC layout though and play it just as it did with the 6.1 in @Chillbo’s tests (ie BC is split between BL and BR).


#71

That’s right, it would be good to not have it, if it’s not there. Especially as I have a 5.0 setup in my main apartment, so the AVR can’t just pass the blank LFE channel to a subwoofer, it will try to mix it into the front speakers.

I see. Already thought so…

If it’s possible to do, it would be great to have the center speaker masked for quad and the back center sent as a single channel. My answer would be: Why have a blank channel, if it shouldn’t be there? Like with 5.1->7.1 blank channels. Or why have Kodi do any mixing already that the AVR should do?

But not to forget: great work already and thanks for the precise feedback and replies! I’m looking forward to what else can/will be possible :slightly_smiling_face:


#72

@DBMandrake has been doing some work on mixing in LFE to FL/FR with adjustable levels.


#73

What do you mean in regards to my remark? The AVR is normally doing a fine job at mixing LFE to the front speakers’ bass chassis, but it would probably be confused, if the LFE channel is present, but empty. I’m no expert, but that was my only point. Blank channels should be avoided completely, if possible. Would say, this should be the same for the LFE channel.


#74

IIRC that LFE mix-in is because Kodi doesn’t by default mix LFE into FL/FR when speaker layout is set to 2.0. So luddites like me with only stereo amps aren’t getting the full bass from downmixed x.1 material. As it’s adjustable, those with x.1 speakers can just leave it off.

If your 5.0 setup is working fine, it’s irrelevant to you. And I’d have thought mixing a blank LFE channel into FL/FR would have no effect as long as the AVR thinks your FL/FR are full-range speakers.


#75

Ah, ok :+1:t2: Well, that doesn’t affect me.

Honestly, I don’t know… But as we all discussed before, I’d just think, getting rid of all possible blank channels would be favourable. If possible :wink:


#76

Yes we have an LFE mixing patch in staging at the moment that will be included in the next monthly update.

By default if you have Kodi in 2.0 mode outputting as stereo, any surround sound sources like Dolby digital 5.1 will be mixed down to stereo - all channels are included except for LFE.

So if a movie has most of its bass in the LFE channel it will sound very thin on a stereo system even if you have large speakers capable of reproducing the low bass, as I do.

The menu option we add allows you to enable LFE to be mixed into the stereo down mix and you can set the amount from 0% (default) to 100%, so you can choose how much LFE to mix in depending on the size of your speakers. (Or proximity of your neighbours…)


#77

Sounds like a very good thing for users with 2.0 systems or for situations when one would like to use the Vero 4k with a stereo system on holidays e.g. It would add extra flexibility :+1:t2:

Has anybody else tested the new test build so far? Didn’t have time for a more extensive test to see whether there’re any noise issues or anything else unexpected…


#78

The patch is here, and applies to OSMC on all devices, not just Vero 4K:

As for testing - I’ve been testing it for about 2 weeks on my living room Vero 4k. I always use Stereo
downmix, using 2 channel PCM output over HDMI which goes to a Samsung TV, and the analogue stereo output from the TV then goes to a Hifi amplifier (not AVR receiver) to a pair of large stereo speakers. I don’t have a surround sound system of any kind or a separate subwoofer.

I’ve not heard any crackling, popping, clipping or overloading problems even with it set to 100%, and 100% seems subjectively about the right mix of LFE.

The default value for the new preference setting is 0% which gives the traditional behaviour of no LFE in the stereo downmix. So after updating a user would have to go into the audio settings and increase it from 0% to activate it.

We made 0% or disabled the default because you would only want to add LFE to the mix if the speakers are capable of handling it without damage or distortion. We wouldn’t want users with small speakers to upgrade and then damage their speakers or suddenly find them distorting.


#79

Isn’t this in staging so available to anyone who has been testing in this thread?


#80

I just reapplied the update and this time more changes seem to have been made. The 5.0 title I have is now identified by my AVR as 5.1 when converted to PCM, previously it was identified as 7.1.


#81

correct behavior. There have been three versions of the update, but the first two were the same because of a glitch in the build.


#83

I have a test kernel which I hope will give better instructions to AVRs about channel layout. Since I don’t own an AVR I don’t know if it works. If anyone can help, please PM me.


#84

Perhaps with all these changes to audio, a new UI for config would be good. I envision:

— Drop down with choices for “2.0”, “5.x”, and “7.x or more”
— If “5.x” or “7.x or more” are chosen, then enable a button with “Do you want to mix LFE into front channels?”
— If “2.0” is chosen on the dropdown, or the LFE button is selected, then enable a slider with a range from 0–100 for the “LFE mix percentage”

What the dropdown allows is choosing the right number of channels to send, and what channels to mask/silence depending on the source.

The next choice allows users without dedicated subwoofers and AVRs that don’t do bass management well to deal with content that has an LFE channel.

Then, the LFE mix percentage allows fine tuning. Since you are already mixing LFE, you can do it for a source with any number of channels, as the mix would always only be added to LF or RF.


#85

Hi all,
I just notice that there is a round speaker icon in the upper middle screen now. is that due to the test version? I cant find any settings to remove it. it shows even when movies are playing.