OpenScaler Open Source High Quality Up-sampling for RPi 4

Discussion in 'Computer Audiophile: Software, Configs, Tools' started by soumya, Jan 7, 2024.

  1. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    Got some spare time last month - so wanted to finish the long pending activity.
    This is the first draft of OpenScaler - an open source Linux based High Quality up-sampling framework for Raspberry Pi 4. Though it can be targeted to any system for so long the needed pieces are available / can be compiled.

    The up-sampling is highly optimized in both Frequency and Time domains. A large portion of the taps are pure sinc coefficients which brings excellent transient information.

    The framework supports up-sampling up to 705.6 kHz PCM and DSD64.
    By combining with other open source projects like librespot, shairport-sync, gmediarenderer etc, you can easily listen to streaming services like Tidal , Qobuz, Apple Music.

    One immediate drawback of this framework being it can not adapt to changing input sampling rate from source. Since vast majority of tracks are 44.1 kHz it's not an immediate problem for most. It's also possible to do async sampling rate conversion at input but kind of defeats the whole purpose why this framework is being created :)

    This is how my RPi 4 resource usage looks like while playing Apple Music streamed from iPod Touch via shairport-sync (v1 using ALAC) and played as DSD64 with about 3 seconds latency .
    [​IMG]

    The framework puts together several excellent open source libraries. With the right configuration the end result is truly great specially when you pit it against a paid software like HQPlayer. Sure it missed on the UI, but it's also highly configurable if you are someone who likes to build their own FIR filters.

    This is a high level block diagram for DSD64 chain
    [​IMG]

    OpenScaler makes use of SoX for initial up-sampling (0 stuffing), applying Apodizing filter and final Sigma Delta modulation based on mansr SoX fork.
    The SoX build makes use of OPENMP builds so that compute intensive operations can be parallelized.

    The heavy weight FIR is done via BRUTEFIR which internally makes use FFTW. Unfortunately FFTW for ARM does not support OPENMP, still it's crazy fast. Instead of BRUTEFIR one can use camilladsp. Though, I found BRUTEFIR to be more efficient and somehow subjectively sound better.

    For PCM the output of BRUTEFIR is sent directly to aplay (ALSA util that sends PCM samples directly to DAC).
    For DSD, the input PCM is 8X upsampled and sinc interpolated via BRUTEFIR, then up-sampled, apodized and finally sigma delta modulated at 8th order CLANS , converted to DSD Over PCM (DoP) and finally sent to the DAC via aplay.
    Between each block , MBUFFER is used to hold the samples in buffer which is another excellent open source FIFO buffer.

    I will try to upload sometime this week the needed scripts, systemd service files, and instructions for installing / compiling the needed libs and binaries.
     
    • Like Like x 9
    • Epic Epic x 1
    • List
  2. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    [RESERVED]
     
  3. soumya

    soumya Acquaintance

    Joined:
    Jun 24, 2018
    Likes Received:
    42
    Trophy Points:
    18
    Location:
    Mordor, Middle Earth
    [RESERVED]
     
  4. Tristan Jones

    Tristan Jones Acquaintance

    Joined:
    May 6, 2018
    Likes Received:
    70
    Trophy Points:
    18
    Location:
    Seattle
    This is super exciting stuff. Can't wait to see the files
     
    • Agreed, ditto, +1 Agreed, ditto, +1 x 1
    • List

Share This Page