USB DAC with 5.1 output, no sound out of Center and LFE outputs

  • I've determined this isn't only an issue in LibreELEC but I hope someone has had experience with something similar.

    I'm trying to get a USB DAC with 5.1 output to give me sound on all channels.

    I can only get sound out of Front Left & Right, and Surround Left & Right.

    Center & LFE outputs are silent.

    Sound out of all channels works in Windows 10 with default drivers.

    I have tried both LibreELEC 11.0.1 and 11.0.3, and I also fired up an Ubuntu Desktop 22.04.3 which gave the same results, so it's not a LibreELEC only problem.

    The device is a LEAGY branded C-Media CM6206 (or perhaps technically CM6206-LX which seems to be the 6-channel version).

    For reference, it's like the ones described and listed here:

    C-MEDIA CM6206 5.1 USB Audio Sound Card Line-In & Line-Out Bass Extension Low Frequency Response Upgrade
    Article Updated: 22 Mar 2022 C-MEDIA CM6206 is a cheap and solid performance audio codec...
    tehnoblog.org

    https://www.amazon.com/Channel-External-Surround-Recording-Compatible/dp/B076PC4VV4

    Receiver is ruled out after testing several combinations of the outputs to receiver input.

    To rule out KODI (which with 5.1 selected still only gives the 4 channels without Center and LFE), I ran speaker-test from the shell.

    speaker-test -l 1 -c 6 -D surround51:CARD=ICUSBAUDIO7D,DEV=0

    I also ran with the sine test at low frequency to make sure the pink noise speaker-test didn't skip the subwoofer, and I also tried the 7.1 device (speaker-test -l 1 -c 8 -D surround71:CARD=ICUSBAUDIO7D,DEV=0). Center & LFE outputs remain silent.

    The device seems to be using the regular ALSA snd_usb_audio module.

    Anyone here who's had experience with USB 5.1 DACs of this type?

    Any configurations or overrides I can attempt, perhaps with a custom asound.conf entry or something?


    Commands: aplay -l & aplay -L

    Display Spoiler

    LibreELEC:~ # aplay -l

    **** List of PLAYBACK Hardware Devices ****

    card 1: ICUSBAUDIO7D [ICUSBAUDIO7D], device 0: USB Audio [USB Audio]

    Subdevices: 1/1

    Subdevice #0: subdevice #0

    LibreELEC:~ # aplay -L

    null

    Discard all samples (playback) or generate zero samples (capture)

    front:CARD=Intel

    Front output / input

    surround21:CARD=Intel

    2.1 Surround output to Front and Subwoofer speakers

    surround40:CARD=Intel

    4.0 Surround output to Front and Rear speakers

    surround41:CARD=Intel

    4.1 Surround output to Front, Rear and Subwoofer speakers

    surround50:CARD=Intel

    5.0 Surround output to Front, Center and Rear speakers

    surround51:CARD=Intel

    5.1 Surround output to Front, Center, Rear and Subwoofer speakers

    surround71:CARD=Intel

    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

    default:CARD=ICUSBAUDIO7D

    ICUSBAUDIO7D, USB Audio

    Default Audio Device

    sysdefault:CARD=ICUSBAUDIO7D

    ICUSBAUDIO7D, USB Audio

    Default Audio Device

    front:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    Front output / input

    surround21:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    2.1 Surround output to Front and Subwoofer speakers

    surround40:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    4.0 Surround output to Front and Rear speakers

    surround41:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    4.1 Surround output to Front, Rear and Subwoofer speakers

    surround50:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    5.0 Surround output to Front, Center and Rear speakers

    surround51:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    5.1 Surround output to Front, Center, Rear and Subwoofer speakers

    surround71:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

    iec958:CARD=ICUSBAUDIO7D,DEV=0

    ICUSBAUDIO7D, USB Audio

    IEC958 (S/PDIF) Digital Audio Output

    LibreELEC:~ #

    Commands: speaker-test

    Display Spoiler

    LibreELEC:~ # speaker-test -l 1 -c 6 -D surround51:CARD=ICUSBAUDIO7D,DEV=0

    speaker-test 1.2.8

    Playback device is surround51:CARD=ICUSBAUDIO7D,DEV=0

    Stream parameters are 48000Hz, S16_LE, 6 channels

    Using 16 octaves of pink noise

    Rate set to 48000Hz (requested 48000Hz)

    Buffer size range from 96 to 96000

    Period size range from 48 to 48000

    Using max buffer size 96000

    Periods = 4

    was set period_size = 24000

    was set buffer_size = 96000

    0 - Front Left

    4 - Front Center

    1 - Front Right

    3 - Side Right

    2 - Side Left

    5 - LFE

    Time per period = 15.987218

    LibreELEC:~ #

    LibreELEC:~ # speaker-test -c 8 -D surround71:CARD=ICUSBAUDIO7D,DEV=0

    speaker-test 1.2.8

    Playback device is surround71:CARD=ICUSBAUDIO7D,DEV=0

    Stream parameters are 48000Hz, S16_LE, 8 channels

    Using 16 octaves of pink noise

    Rate set to 48000Hz (requested 48000Hz)

    Buffer size range from 96 to 96000

    Period size range from 48 to 48000

    Using max buffer size 96000

    Periods = 4

    was set period_size = 24000

    was set buffer_size = 96000

    0 - Front Left

    4 - Front Center

    1 - Front Right

    3 - Side Right

    7 - Side Right

    2 - Side Left

    6 - Side Left

    5 - LFE

    Time per period = 21.987770

    LibreELEC:~ #

    The surround51 and surround71 entries from alsactl dump-cfg

    Display Spoiler

    cards.USB-Audio.pcm.surround51.0 {

    @args.0 CARD

    @args.CARD {

    type string

    }

    @func refer

    name {

    @func concat

    strings [

    'cards.USB-Audio.'

    {

    @func card_name

    card $CARD

    }

    '.pcm.surround51:CARD='

    $CARD

    ]

    }

    default {

    type route

    ttable.0.0 1

    ttable.1.1 1

    ttable.2.4 1

    ttable.3.5 1

    ttable.4.2 1

    ttable.5.3 1

    slave {

    pcm {

    type hw

    card $CARD

    device 0

    }

    channels 6

    }

    }

    }

    cards.USB-Audio.pcm.surround71.0 {

    @args.0 CARD

    @args.CARD {

    type string

    }

    @func refer

    name {

    @func concat

    strings [

    'cards.USB-Audio.'

    {

    @func card_name

    card $CARD

    }

    '.pcm.surround71:CARD='

    $CARD

    ]

    }

    default {

    type route

    ttable.0.0 1

    ttable.1.1 1

    ttable.2.4 1

    ttable.3.5 1

    ttable.4.2 1

    ttable.5.3 1

    ttable.6.6 1

    ttable.7.7 1

    slave {

    pcm {

    type hw

    card $CARD

    device 0

    }

    channels 8

    }

    }

    }

  • Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link
  • I'm afraid I don't expect Kodi logs to give any details, but here goes.

    I've fetched a test file for 5.1 audio from here: https://www.reddit.com/r/hometheater/…t_every_format/

    Test run with audio device "@:CARD=ICUSBAUDIO7D,DEV=0" selected in GUI, and audio channels set to 5.1. Effective device selected is as expected "surround51:CARD=ICUSBAUDIO7D,DEV=0".

    http://ix.io/4JXO


  • USB device and channel layout are looking good on the log.

    • I'm not sure whether LE can play that "Microsoft variant" codec. Maybe you'll find another test file with a different 5.1 codec.
    • It might also be a slow NAS connection ("Allowing max Out-Of-Sync Value of 35 ms"). So try to play from a thumb drive instead.
  • Thanks for helping, though it's really not about the connection to my NAS, and it's not only Kodi. I suspect it's an ALSA driver issue. The CM6206-LX has been around for a long time, some variants seem to have been around for at least 14 years (and the Windows drivers provided by the OEM go back to 2009 for XP&Vista), but different vendor variants maybe behave slightly differently.

    Still, I tried with a different file with PCM 5.1 audio. File also has DTS and AC3 tracks, but I didn't play those for the log. Same result with all three.

    http://ix.io/4JY8

  • What does lsusb and dmesg report in both LE and Ubuntu for the DAC. Is it correctly identified. Have you tried the DAC in Kodi for Windows. Does it perform correctly there.

    Here’s an interesting article on that particular chip and it looks like the user got it to work eventually via SPDIF OUT https://discourse.osmc.tv/t/modifying-us…ect-spdif/78384

    That's a very interesting link. I don't think it's applicable in my current situation, but I would have loved to know of this kind of audio duplication and remapping of channels to SPDIF output for another project a few years ago.

    I haven't tried with Kodi in Windows 10, no, but all 6 channels work with default drivers (included with Windows) so the hardware output is functional, unlike in Linux.

    I can activate the SPDIF out, but that defeats the purpose of having Kodi output analog 5.1 to my receiver instead of using passthrough.


    lsusb output is identical

    Bus 009 Device 002: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device

    dmesg is, from what I can tell, the same, only Ubuntu is being slightly more verbose.

    LibreELEC

    [ 3.343934] usb 9-1: new full-speed USB device number 2 using xhci_hcd

    [ 6.352868] usb 9-1: current rate 30464 is different from the runtime rate 96000

    [ 6.380586] usb 9-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.

    [ 6.380592] usb 9-1: [9] FU [Mic Playback Volume] ch = 2, val = -6144/1921/1

    [ 6.386200] usb 9-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.

    [ 6.386205] usb 9-1: [11] FU [Line Playback Volume] ch = 2, val = -6144/1921/1

    [ 6.398726] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 6.398732] usb 9-1: [8] FU [Mic Capture Volume] ch = 2, val = -4096/2832/1

    [ 6.401517] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 6.401522] usb 9-1: [15] FU [Line Capture Volume] ch = 2, val = -4096/2832/1

    [ 6.404458] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 6.404463] usb 9-1: [2] FU [PCM Capture Volume] ch = 2, val = -4096/2832/1

    [ 6.405235] usbcore: registered new interface driver snd-usb-audio

    Ubuntu

    [ 2.542298] usb 9-1: new full-speed USB device number 2 using xhci_hcd

    [ 2.693546] usb 9-1: New USB device found, idVendor=0d8c, idProduct=0102, bcdDevice= 0.10

    [ 2.693552] usb 9-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0

    [ 2.693554] usb 9-1: Product: USB Sound Device

    [ 2.695592] input: USB Sound Device as /devices/pci0000:00/0000:00:1e.0/0000:05:02.0/0000:07:1b.0/usb9/9-1/9-1:1.3/0003:0D8C:0102.0002/input/input6

    [ 5.195963] usb 9-1: current rate 30464 is different from the runtime rate 96000

    [ 5.356277] usb 9-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.

    [ 5.356284] usb 9-1: [9] FU [Mic Playback Volume] ch = 2, val = -6144/1921/1

    [ 5.380497] usb 9-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.

    [ 5.380504] usb 9-1: [11] FU [Line Playback Volume] ch = 2, val = -6144/1921/1

    [ 5.448568] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 5.448577] usb 9-1: [8] FU [Mic Capture Volume] ch = 2, val = -4096/2832/1

    [ 5.466712] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 5.466718] usb 9-1: [15] FU [Line Capture Volume] ch = 2, val = -4096/2832/1

    [ 5.486262] usb 9-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.

    [ 5.486269] usb 9-1: [2] FU [PCM Capture Volume] ch = 2, val = -4096/2832/1

    [ 5.498334] usbcore: registered new interface driver snd-usb-audio


    The warnings show up in old threads all over, without a resolution and unclear what impact they may have. This old post even shows the exact same device ID, and same warnings.

    https://alsa-user.narkive.com/vDmePBDV/cm6206-lx-usb-sound-card-problem

    The names which seem related to the warnings I believe are not relevant for Center & LFE. They seem related to inputs, and playback of the inputs.

  • Thanks for helping, though it's really not about the connection to my NAS...

    Code
    2023-10-26 02:36:55.423 T:1060    debug <CWebserver[8080]>: request received for /jsonrpc?Application.GetProperties
    2023-10-26 02:36:55.439 T:1057     info <CWebserver[8080]>: Skipped 13 duplicate messages..
    2023-10-26 02:36:55.439 T:1057    debug <CWebserver[8080]>: request received for /jsonrpc?Player.GetActivePlayers
    2023-10-26 02:36:55.471 T:1038     info <general>: Skipped 31 duplicate messages..
    2023-10-26 02:36:55.471 T:1038    error <general>: Unable to lookup host: 'TRUENAS'

    Please try with a thumb drive anyway. I want to rule that out, before we dig deeper.

  • Well this is odd, it now works.

    I can't say what is different now, I surely didn't intentionally change anything with the setup in LibreELEC or Ubuntu, I even use the exact same USB port for the DAC. However, after a few system restarts and moving the USB DAC to my Windows PC and back a couple of times more, the device is now providing sound also on the Center & LFE output. Works with both LibreELEC (both Kodi and speaker-test) and in Ubuntu Desktop (GUI and speaker-test).

    I changed nothing about the configuration of the two Linux setups, and there's no difference in the hardware logs related to the USB DAC from what I can tell. I have no real explanation for why it was not working previously in Linux, and why it works now. Best guess I can come up with is that perhaps there is something persistent written to the device from running it in Windows, perhaps related to changing the speaker setup there, for that is as far as I recall the only thing I have manually done. I don't even have the OEM drivers installed, just using the included generic driver that comes with Windows 10.

    Also to note for good measure I ran a quick test with media on a USB stick (USB 3.0 NVME adapter with an M.2 PCIe SSD), and the auto-adjusted out-of-sync latency due to self-learning was still in the 42-45 ms range. Perhaps it's more related to my current system than network or storage source. "pastekodi" wouldn't give me a link, I suspect the debug data was too large to be uploaded.

    So for now, issue is magically gone. The CM6206 (or CM6206-LX) DAC from LEAGY now properly provides sound on all 6 channels, just as I want and expect.

    If it is of interest I can fetch another debug log later today or this weekend, but I suspect it will not be any different from the previous ones I sent.

  • Maybe an out-of-sync error...

    ...and the auto-adjusted out-of-sync latency due to self-learning was still in the 42-45 ms range.

    • "Allowing max Out-Of-Sync Value of 35 ms"
  • I'm no expert on out-of-sync in Kodi, though the way I read things, up to 100 ms is allowed for this value, and there is no error triggered related to it (no error adjustments). I also have not changed the default (10 ms), so why it once printed 35 ms for this initial value is very weird; all other times it is 10 ms as expected. And it still performed the self-learning adjustment after, which is only done when the initial setting is 10 ms.

    I have managed to reproduce the problem. Not only once, but twice. Though I fail to reproduce a third time, so this is still confusing.

    First reproduction was during a video playback, approximately 10-15 minutes after starting playback. I got slightly annoyed with a minor lip sync mismatch, and went to alter the audio offset by a small amount. After I altered the Audio Offset slightly, first down then up, after a moment I noticed the center channel disappearing. Might have been a gradual loss over a few seconds. But, it was gone, just like before.

    I tried to disconnect and reconnect the USB DAC, but center & LFE were still providing no sound. I restarted LibreELEC, and still the problem persisted.

    Next, I disconnected the USB DAC, hooked it up to a Windows PC briefly just to perform a sound test on the center channel (successful, no problem), and then I moved it back to LibreELEC. After this, the center & LFE again are operational.

    Odd, I thought, so after a minute or two of working center channel, I again tried to modify the audio offset. And again, the problem was triggered. This time I removed the USB DAC, connected to my Windows PC only briefly, and then moved it back. The result, center & LFE once more operational.

    I didn't see anything at all in the Kodi log, and nothing odd in the dmesg log.

    Now, unfortunately after enabling debug tracing, I was not able to trigger the problem a third time by altering the audio offset. I've tried to restart LibreELEC, and still not been able to trigger it again. I have disabled debugging, restarted Kodi and LibreELEC, even disconnected and reconnected the USB DAC during playback. I am still unable to reproduce it a third time today.

    This continues to be very strange. There may be some odd driver behavior at play, but it's very hard to say for sure. I will try some more with debug tracing enabled, to trigger this behavior again.

    I'd appreciate if this thread can be kept open for a while longer, while I keep trying to isolate this, to also allow others to comment and contribute.

  • Next, I disconnected the USB DAC, hooked it up to a Windows PC briefly just to perform a sound test on the center channel (successful, no problem), and then I moved it back to LibreELEC. After this, the center & LFE again are operational.

    Theory: An increased buffer value is set inside of the DAC by Windows, but not by Linux (LE, Ubuntu etc.). Due to the increased buffer value, the out-of-sync error is gone, and all channels play.

    So the Linux driver for that DAC seems to be incomplete. It should set an appropriate buffer value first. We don't write Linux drivers. I guess some sort of a bug report is necessary elsewhere. /shrug

  • What indicates out-of-sync errors (actual problems reported by Kodi) in my logs, or what should I look out for, and what could be the underlying causes?

    I still very much doubt there is any problem with network or storage in my setup. I have wired gigabit connectivity and a fast low-latency storage server. I play high quality video perfectly with no issue, including the Jurassic Park trailer at 32 Mbps video and close to 7 Mbps PCM 5.1 audio. Immediate playback, no stutters, no hiccups. No errors in the logs. But of course I can¨'t rule out something under the hood and hidden during playback would cause some corner case to trigger a problem with the USB DAC. It's unfortunate that I don¨¨'t have debug logs from Kodi from the times I managed to reproduce the problem, but I will activate debugging and keep trying.

    For the log entry you mentioned, "Allowing max Out-Of-Sync Value of 35 ms", that is as far as I can tell an initiation value (which granted is odd since default should be 10 and I did not have an override configured). In any case, I am not seeing any out-of-sync errors at least from Kodi. I can also force this initial value to be something other than 10 but still low, e.g. 11 ms, with an entry in advancedsettings.xml, and doing this will keep Kodi from updating due to any self-learning after 30 seconds. I don't know if this even has any impact on the USB DAC, but anything goes at this point I suppose.

    So far, my observations are:

    • There is not yet a clear trigger for the problem in my setup.
    • The problem can trigger seemingly spontaneously, or at least the device can start out working on all 6 channels and then drop output from two channels, both being from the 3rd 3.5mm TRS output (center & LFE).
    • It has only ever affected the third output (center & LFE).
    • Once the problem is triggered, it has remained in this problematic state, at least until I connect the device to a Windows PC (and I'm not even sure if this will always resolve the problem), and the problem persists outside of Kodi and LibreELEC so it is persistent in hardware and/or with the Linux ALSA driver across installations.
    • A Windows PC can perform "magic" on the USB DAC and restore full 6-channel operation (but perhaps not every time).
  • One thing you have to compare: Does it play with the same audio quality on Windows and Linux? As you know, a DAC offers different codecs, and the player selects one.

  • The only thing I could suggest here is, if you haven’t already tried this and purely for testing purposes, install an older version of LE and do side by side testing.

    I've only tried with 11.0.1 and 11.0.3 so far. Both are running Kodi 20.x, specifically 20.1 and 20.2 respectively. And I only tried 11.0.1 when the USB DAC was in a problematic state, so I never really attempted to trigger the problem while running this release.

    One thing you have to compare: Does it play with the same audio quality on Windows and Linux? As you know, a DAC offers different codecs, and the player selects one.

    Subjective listening experience? Identical I would say. I did a small sit-down with CD-ripped flacs playing from both Kodi and a Windows PC using the same USB DAC and for front left and right channels I cannot perceive any difference in quality.

    I have still not been able to trigger the problem consistently. It did reappear twice today, and both times were recovered without disconnecting the USB DAC.

    First time was about 15 minutes into a video and I had debug logging enabled. The debug log didn't seem to indicate anything out of place. The trigger was likely related to a slight seeking to rewind a few times, prior to the center & LFE channels being lost. But then while I was looking at the logs, and about 10 minutes had passed, the center & LFE returned. Again I think I had just prior to the return of the center & LFE channels done some brief rewinding of the video.

    Second time was very shortly after I had changed USB cable. This "new" cable is an external HDD cable, slightly longer and with a ferrite core near the USB DAC end of the connection. I played some video files, testing all manner of things. Seeking backwards and forward, changing audio offset. Nothing triggering the loss of center & LFE. I then listened to some flac stereo music files. After listening to the music, I fired up one more video, and noticed immediately that the center channel was missing. I started fiddling with the audio, changed tracks, and rewinding, and the center channel returned.

    I have set the following settings to try to eliminate variables:

    Keep audio device alive: always

    Send low volume noise: disabled

    applydrc (advancedsettings.xml, dynamic range compression for AC3): 0.0 (disabled)

    maxpassthroughoffsyncduration (advancedsettings.xml, a setting that should not be relevant except for passthrough): 11 (ms)

    I was trying to have debug logging active for the whole day, but it stops logging after a while so I didn't manage to capture anything useful since the problem is so uncommon.

    Is there some limit to debug log size in LibreELEC? It got stuck mid-line after about 7 MB.