It sounded muffled and broken with 5.1, so I put “default-sample-channels” to 8 and got “alsa_output.0.analog-surround-71.monitor” as device.
Unfortunately it’s the same deal as alsa, center comes out from surround left, lfe from surround right.
Does it work in Kodi correctly?
I don’t think I am able to change the mappings, they are correctly mapped as expected by API. Maybe there are configuration files you can change?
Where did you do the custom.conf part? I will test on my kit.
@Adam86 here, “/storage/.config/pulse-daemon.conf.d/custom.conf”
@smg04 Yeah, Kodi works perfectly fine with 5.1 setting and surround files. No weird mapping. I’m looking at Arch wiki and there seems to be ways to map stuff, I’ll mess around a bit more.
OK created a custom.conf and now pactl list sinks shows the same information as yours.
Enabled surround sound within moonlight config as 5.1 and then specified the custom device.
Connected to my machine and my amp still shows 2 channel unfortunately and the Windows Control Panel Sound only has stereo to choose from which is odd as the last time I was messing about I had 5.1 & 7.1 showing.
Will have to some more digging :-s
If you edited moonlight.conf, it’s gonna get overwritten by Luna when starting.
If you can, try testing with the commands, hopefully I did them right and they are the safest bet to test how everything’s working out. You’re gonna see errors in the console if there are any.
I got it working with correct mapping, I basically have no idea what I’m doing. Thanks to arch wiki and some trial and error I fixed the mapping.
First, I added “default-sample-channels=8” to “custom.conf”. After that I ran @smg04’s command “pactl load-module module-alsa-card device_id=0”
Then I created another sink with correct mapping,
“pactl load-module module-remap-sink sink_name=test8 master=alsa_output.0.analog-surround-71 channels=8 master_channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right channel_map=front-left,front-right,lfe,front-center,rear-left,rear-right,side-left,side-right”
Basically, just changed lfe and center. I wonder why it was broken in the first place though, Kodi worked fine with pcm surround stuff.
Ps. I’m not sure if 5.1 is broken on Amlogic, I tried it only once and it sounded broken.
@smg04, I edited the config using the Luna GUI?
Could you try using the commands? I’m finding it weird that your setup shows stereo only, that means it probably didn’t even try using surround. Maybe your Enable surround audio is disabled in the GUI?
@smg04, will have a proper play about with it tomorrow and try work out what’s going on
Hi all, I have a question unrelated to surround sound . Is there any special configuration required to have the remote input flow through to the streaming device?
I used to be able to use my Kodi remote air mouse & keyboard to control the computer through moonlight, but the device doesn’t show up at all anymore. It may have stopped working with the update to 0.8.x, although I hadn’t really checked until now.
Edit:
It does get mentioned in the logs briefly.
Platform AMLogic VPU
Loading mappingfile gamecontrollerdb.txt
Not mapping Multimedia Air Mouse Keyboard as a gamepad
Not mapping Multimedia Air Mouse Keyboard as a gamepad
Not mapping meson-ir as a gamepad
Not mapping cec_input as a gamepad
@smg04, @Kaan - you are both geniuses!
So Iast night I was making the stupid mistake of looking a the wrong audio device in Windows!
I had another shot again and of course 5.1 sound was just completely messed up as before, but I know you’ve explained that 5.1 doesn’t work properly on Amlogic.
So I made the custom.conf change as Kaan has done "default-sample-channels=8"
Then ran the commands:
pactl load-module module-alsa-card device_id=0
pactl load-module module-remap-sink sink_name=test8 master=alsa_output.0.analog-surround-71 channels=8 master_channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right channel_map=front-left,front-right,lfe ,front-center ,rear-left,rear-right,side-left,side-right
Now this errored for me so when i ran “pactl list sinks” my device name was “alsa_output.0.hdmi-surround71” & not “alsa_output.0.analog-surround-71” so I changed the command above to reflect. Tried Moonlight and it still didn’t work.
Looked at my Kodi audio settings and my Audio Output Device was “ALSA: AML-AUGESOUND, HDMI Multi Ch PCM” so I changed this instead to “ALSA: AML-AUGESOUND, HDMI”.
Rebooted my box and ran the above commands again with no errors, this time my sinks showed “alsa_output.0.analog-surround-71” - configured Luna/Moonlight to the remapped “test8” device straight away, and this time my AVR was finally showing LCPM 7.1! Carried out a sound test and it actually worked!
Now my Luna/Moonlight I initially configured surround as 7.1, so this was showing two extra side speakers, which strangely did play out of my setup, but obviously these don’t physically exist! So I have now configured Luna to 5.1 surround which is the true setup, and carried out another sound test, this now works perfectly! My AVR does display LCPM 7.1, but obviously we’re telling Windows just to use a 5.1 config.
I’m going to do some proper testing later in some games that use surround sound really well.
Just another thing to note, my number of channels in Kodi I’ve left as 2.1 - anything that isn’t in Surround Sound I like the AVR to do Pro Logic/Virtual Surround.
Presumably going forward, we need to add those commands into the autostart.sh for the audio sinks to be configured on each startup as opposed to manually, and as long as the device name is specified correctly within Luna this should give us the surround sound we have been aiming for?
I tested audio within Kodi afterwards and that all appeared to continue working as expected.
I must say, if this is well and truly cracked now, I can finally unplug my old S912 box!
Cheers both for your continued efforts in looking into this.
This is either caused by moonlight since v2.5.0 (won’t fix, in that case it’s incompatible) or Kodi locking access, then I would have to return to alt shell script. I’ll take a look at it.
@Adam86 Did you check the mapping, was it correct for you?
If it’s correct, maybe there’s something different between CoreELEC version of pulse and the one main developers use… If this is some Amlogic hack, then I could possibly design a patch so you don’t have to use a remap sink, possibly reducing the latency this way…
This is gonna be great, like basically I only need to run 1 command for surround to work and use pulse.
Probably not true in your case, but I have to replug my usb keyboard after I start a moonlight session.
@smg04, OK so have just spent some more time running commands to see what’s what.
So for me what I am finding is it matters what device Kodi is set to for this to work. It only works for me using “ALSA: AML-AUGESOUND, HDMI”.
With that default set in Kodi, I now find if I set my custom.conf with “default-sample-channels=6” and reboot followed by pactl load-module module-alsa-card device_id=0 then “pactl list sinks” always shows this information below which is just the same as if this is set to “default-sample-channels=8” which is interesting:
LOUNGE-FD:~ # pactl list sinks
Sink #1
State: RUNNING
Name: alsa_output.0.analog-surround-71
Description: Built-in Audio Analog Surround 7.1
Driver: module-alsa-card.c
Sample Specification: s16le 8ch 44100Hz
Channel Map: front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
Owner Module: 14
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB, rear-left: 65536 / 100% / 0.00 dB, rear-right: 65536 / 100% / 0.00 dB, front-center: 65536 / 100% / 0.00 dB, lfe: 65536 / 100% / 0.00 dB, side-left: 65536 / 100% / 0.00 dB, side-right: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: alsa_output.0.analog-surround-71.monitor
Latency: 314400 usec, configured 371519 usec
Flags: HARDWARE HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
Properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = ""
alsa.id = "TDM-C-dummy dummy-3"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "3"
alsa.card = "0"
alsa.card_name = "AML-AUGESOUND"
alsa.long_card_name = "AML-AUGESOUND"
device.bus_path = "/devices/platform/auge_sound/sound/card0"
sysfs.path = "/devices/platform/auge_sound/sound/card0"
device.form_factor = "internal"
device.string = "surround71:0"
device.buffering.buffer_size = "262144"
device.buffering.fragment_size = "131072"
device.access_mode = "mmap+timer"
device.profile.name = "analog-surround-71"
device.profile.description = "Analog Surround 7.1"
device.description = "Built-in Audio Analog Surround 7.1"
device.icon_name = "audio-card"
Ports:
analog-output: Analog Output (type: Analog, priority: 9900, availability unknown)
Active Port: analog-output
Formats:
pcm
So using “alsa_output.0.analog-surround-71” as my custom sound device in Luna and doing a sound test, my channels are completely messed up, I think only front left is correct.
Once I run the command to create the sink that @Kaan has discovered “pactl load-module module-remap-sink sink_name=test8 master=alsa_output.0.analog-surround-71 channels=8 master_channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right channel_map=front-left,front-right,lfe ,front-center ,rear-left,rear-right,side-left,side-right” and set that sink name as the custom sound device within Luna then it works perfectly in each channel.
Just tested GTA5 & that sounds fantastic, much better than when I use Moonlight on my S912 box as I tend to find the sound is very quiet on that.
As a test I did try adding those two commands to autostart.sh and rebooted the box, Kodi doesnt like that as the “ALSA: AML-AUGESOUND, HDMI” device dissapears from my device list. Wonder if its to do with the timing of Kodi starting up?
Like I say, it does seem to depend on what device is set to default on Kodi as it totally does not work when I had it set to “ALSA: AML-AUGESOUND, HDMI Multi Ch PCM”.
Interesting, mine is set to that and I never touched it.
Btw, the channels are messed up even when I use the Alsa device directly with Luna. (“hw0,3” in my case.) Probably something to do with Alsa drivers instead of Pulse. Otherwise I wouldn’t even bother with Pulse stuff.
Could you test this one? The only thing I did was a patch to switch out center and LFE from the original mapping. Try with ALSA too, if you want to.
script.luna-0.8.3-matrix.118.zip (3.1 MB)
@Kaan, that’s interesting how it is different for you. What box do you have out of interest? Mines an X96 AIR P3.
@smg04, will test that release ASAP.
Yep, that did it for me too. A replug after starting it up makes the controller work again.
@smg04, have installed that version and using sysdefault audio backend it doesnt work, but if I customize my audio device by choosing:
"card0: AMLAUGESOUND [AML0AUGESOUND], device 3: TDM-C-dummy dummy-3"
Then I get surround sound with the correct channels! Kodi Output Device still set as “ALSA: AML-AUGESOUND, HDMI” - My AVR shows LPCM 5.1 too, I also tried swapping Output Device back to “ALSA: AML-AUGESOUND, HDMI Multi Ch PCM” out of interest and now I just get a black screen.
So that’s definitely looking good too as that rules out any PulseAudio config as I rebooted the box to revert that config.