1. MINIX team will be having Chinese Lunar New Year holidays from 23/01 to 05/02, replies will be limited during this period, please kindly note.

Audio stuck on 48kHz for stereo music

Discussion in 'X8 - X8H Official Firmware 002' started by MichaelBarber, Dec 21, 2014.

  1. MichaelBarber

    MichaelBarber New Member

    I have the X8 connected through HDMI to an AV receiver that is capable of PCM at all usual sampling rates (44.1, 48, 88.2, 96)kHz etc.

    Music and videos play fine. However, no matter what music I attempt to play, it always gets sent to the receiver at 48kHz, meaning it's being resampled somewhere. This includes normal cd (redbook) audio at 44.1k/16b, as well as any high-res stuff (like 96k/24b). This is all two-channel content, and it all plays at 48k.

    I have tried both HDMI passthrough and PCM mode, but to no avail -- in the minix settings as well as in xbmc.
    I've also tried XMBC, PowerAmp and Neutron, also to no avail. Neutron, fwiw, reports 48kHz as the only available sampling rate on the output device.

    I know the receiver works correctly because I was using a WDTV live player prior to this, and it had no issues -- it picked up the capabilities from the receiver and worked.

    I'm not too fussed getting really high-res stuff working, but I really don't want normal cd audio going through a 44.1 -> 48kHz sampling rate conversion. It's particularly ugly. I know Android handles 44.1kHz fine because it uses this sampling rate on my Galaxy S3.

    Does anyone have an ideas on how to get normal CD audio working correctly? It's quite possible I've missed something. I have done a fair bit of digging around to see if anyone has a solution, but haven't succeeded in finding one yet.

    If it's a bug, it shouldn't be too hard to fix -- I'm guessing it's a config issue. In the mean time, I'd be a lot happier if I was stuck on 44.1k instead of 48k :) Any ideas?

    Oh yes -- forgot to mention -- I'm on the new 002A firmware and XMBC beta 8. That's all working nicely :)
  2. davide95

    davide95 Member

    Very interested, I have a neo x6
  3. MINIX - Ken

    MINIX - Ken MINIX Team Member Administrator

    Interesting findings, I'll ask Amlogic about this.
  4. MichaelBarber

    MichaelBarber New Member

    Thanks Ken!

    I've done some more investigating too. Maybe this helps ;)

    1. I can confirm that HDMI passthrough works fine for the other formats -- DTS goes through to the receiver fine.

    2. It looks like the hardware supports 44.1 -- you can do echo "44.1k" > /sys/class/amhdmitx/amhdmitx0/aud_mode and output changes to 44.1k instantly.

    3. I found this aud_mode hook poking around some kernel code that looks like it belongs to the Amlogic 802 (or a close relative). Forum rules won't let me post the link because this is only my second post, but I do have it available.
    In that code, this function is also defined: static int hdmitx_notify_callback_a( ... )
    And in that function, it looks like it's supposed to switch to 32k, 44.1k, 48k, 88.2k, 96k, 176.4k or 192k depending on the input stream sample rate.
    switch (substream->runtime->rate) {
    case 192000:
    audio_param->sample_rate = FS_192K;
    break;
    case 176400:
    audio_param->sample_rate = FS_176K4;
    break;
    case 96000:
    audio_param->sample_rate = FS_96K;
    break;
    case 88200:
    audio_param->sample_rate = FS_88K2;
    break;
    case 48000:
    audio_param->sample_rate = FS_48K;
    break;
    case 44100:
    audio_param->sample_rate = FS_44K1;
    break;
    case 32000:
    audio_param->sample_rate = FS_32K;
    break;
    default:
    printk("HDMI: unknown audio frequence\n");
    break;
    }


    4. Not sure if it's related to my receiver's capabilities, but I can do cat /sys/class/amhdmitx/amhdmitx0/aud_cap which yields the following:
    CodingType, MaxChannels, SamplingFrequency, SampleSize
    PCM, 2 ch, 32/44.1/48/88.2/96/176.4/192 kHz, 16/20/24 bit
    PCM, 8 ch, 32/44.1/48/88.2/96/176.4/192 kHz, 16/20/24 bit
    AC-3, 6 ch, 32/44.1/48 kHz, bit
    DTS, 7 ch, 32/44.1/48/88.2/96 kHz, bit
    OneBitAudio, 6 ch, 44.1 kHz, bit
    Dobly_Digital+, 8 ch, 44.1/48 kHz, bit
    MAT, 8 ch, 48/96/192 kHz, bit
    DTS-HD, 8 ch, 48/96/192 kHz, 16 bit

    My best guess is that XBMC and/or Android is processing and mixing two-channel audio instead of sending it unchanged via passthru to HDMI. Maybe something like a "force passthru for two channel / pcm" would be possible; it would certainly raise the bar on the audio side and give us bit-perfect playback. Probably good for the spdif and usb guys too. :)
    MichelG likes this.
  5. ArceeKay

    ArceeKay Active Member

    Don't think it's XBMC is processing or mixing the two-channel audio, because when I use XBMC on OpenElec on my Mediacenter PC the audio does play bit perfect. I do hope the SettingsMbox app will have such a setting in the next firmware update, as not having bit perfect audio makes me revert to my Mediacenter PC for listening to music. And I want to retire my Mediacenter PC, which is what the Minix was meant for...


    Sent from my iPad using Tapatalk
  6. MichaelBarber

    MichaelBarber New Member

    I think you're right -- XBMC is probably resampling to 48k because Android is reporting it as the only available sampling rate. Same thing happens with other audio player apps. Pretty sure it's a firmware issue.
  7. windex961

    windex961 New Member

    Anybody find any resolution to this? I to am using HDMI passthrough from my x8h-plus and the receiver is picking up the music as 48khz instead of 44.1khz through XBMC.. Thanks
  8. ArceeKay

    ArceeKay Active Member

    As long as XBMC or Kodi run from within Android, all PCM audio is resampled to 48khz which for me was a show stopper. But there is a solution. Forget Android and install OpenElec. It runs perfectly on my X8-H and audio is not resampled. Instead you get 16bit 44.1khz all the way up to 24bit 192khz bit perfect. I am on OpenElec now on my Minix and will never move back.

    Check out this thread:
    http://www.minixforum.com/threads/openelec-minix-x8-h-plus.3342/page-10


    Sent from my iPhone using Tapatalk
  9. windex961

    windex961 New Member

    I've tried the OpenElec V3 I believe.. seems very responsive and all good things, except with the X8h-plus the Ethernet is not currently working... Been waiting for a fix for this for awhile.. I guess it's just the waiting game for me now... Thanks for the info though!
  10. ArceeKay

    ArceeKay Active Member

    Surkovalex, the guy developing the X8HP build, is aware of that issue and working on it. I believe the latest 5.0.5 V1 and V2 are efforts to make it work. But the guy doesn't have the X8HP box himself so he cannot test them. I am already happy he is developing Minix builds for us X8H owners. Sooner or later, I am sure it will work!


    Sent from my iPad using Tapatalk
  11. windex961

    windex961 New Member

    It does seem that he's working hard on it, so many releases in the last few weeks, its great having these devices supported so well.. Hopefully the OpenElec also fixes the 1080p audio timing issue... I'm stuck setting the box on 720p60hz for now until that happens as well... Thinking I should of just went with the X8h instead of the plus, but I'm sure all the growing pains will be sorted out sooner or later