Posts by logan893

    Thanks for the heads-up about the storage partition size. I'm inclined to install on a proper SSD if I get this working well enough.

    An update from this past week is that I seem to have had a combination of problems. The past few times when the center channel was spontaneously lost after approximately 15 minutes, and also spontaneously returned, may be related to a poorly seated speaker connection after having moved my receiver around a few times during troubleshooting of the USB DAC. What characterized these more recent and spontaneous drop-outs was that the center channel was working initially, then volume dropped gradually over a brief moment (not instantaneous but less than a minute I would say) before the channel was lost completely. I didn't verify the USB DAC outputs, and the center channel operation did return on its own, so I suspect it was not a DAC issue these more recent times.

    I've reseated all the speaker connectors properly, and hopefully this will prevent problems that are not USB DAC related. The DAC so far doesn't seem to be giving me any problems, all channels keep working. Will watch a movie or two this weekend, I'll keep this thread updated.

    So it's not related to Windows, and happens randomly. I still think that DAC buffer size is wrong, or not initialized at all.

    Linux driver issue is my bet. Here is a link for a bug report: https://www.alsa-project.org/wiki/Mailing-lists

    I was hoping your AVR shows sampling rate etc., just hearing isn't enough to estimate data rate differences. However, since we know that it's not Windows-related, it doesn't matter.

    If the log becomes too large, upload by pastekodi doesn't work anymore. Then you can only copy & paste from /storage/.kodi/temp.

    I don't think there is any AVR that can show device output sampling rate for its analog inputs. I would think that requires some fancy audio analyzer hardware.

    I concur, it seems to boil down to a driver problem, possibly combined with quirks in hardware that seem at least somewhat persistent.

    There are two primary reasons for why I'm trying to do what I am doing.

    1) My receiver is over a decade old and only has inputs and outputs for HDMI at 1080p, and my 4K TV can only do PCM Stereo sound over ARC (no eARC support, and I'm not even sure if the receiver can take a 5.1 input from the TV output)

    2) Kodi 20.x (and I think 19.x too) running on a Google Chromecast 4k device has an insane amount of audio latency in Passthrough mode (I believe it was not constant, it varies depending on the audio format), and in non-passthrough mode I naturally get only Stereo sound with the Chromecast hooked up directly to the TV.

    Reason number 1 is primarily why I need a USB DAC also for the LibreELEC player. If there were some USB-A-to-HDMI adapter with Linux support that I could connect to the receiver, to have display out directly to TV and only audio via the USB adapter to the receiver, that would also be an alternative. Last resort may be to get an audio extractor with 5.1 analog output. I tried to search in the forum, and it seems there might not be any such devices, but someone reported that having a laptop with HDMI output they could at least select that device for audio, even if they were not able to move the video output from their built-in screen.

    After more general searching, I have found a device that may be doing exactly what I need to continue using Kodi in the Chromecast for now. The Chromecast is on the slower side for Kodi, but it would enable displaying also Dolby Vision sources for example.

    VSP01201 HDMI 2.0 Splitter 1x2 with EDID-Management - FeinTech
    Makes it possible to distribute one HDMI source to 2 displays (monitor, TV, projector) or AV receiver, automatic downscaler for Full HD displays with UHD…
    feintech.eu


    As for the logging, not only did the log become too large, but it stopped writing to the file. When printing the end of log with tail (both while it was the primary kodi.log, and also after a restart as kodi.old.log) it was stuck mid-line, several hours in the past. The size didn't increase, but the modified timestamp kept updating even while it was the primary log.

    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.

    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).

    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.

    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.

    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, 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

    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


    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

    }

    }

    }