Resampling question

Report bugs and unexpected behavior here.
John22
Posts: 6
Joined: Thu Jun 08, 2017 9:08 am

Resampling question

Post by John22 » Thu Jun 08, 2017 9:16 am

I'm testing Neutron (Eval) on my Galaxy S7 Android 7.0. I don't understand die FAQ answer to the question "Why do I need to know about Resampling?" because the answer is "Generally speaking, you don't. Until the moment when you get music files which have frequency other than 44.1kHz. Android OS is hard-coded to 44.1kHz frequency,". I always thought Android is hard-coded 48 kHz. In the settings in "Audio Hardware" and "Frequency" I can only select 48000. All my music files have the 44.1 kHz frequency. Will these songs played native with 44.1 kHz or resampled to 48 kHz?

rofz
Posts: 3
Joined: Tue Jan 16, 2018 8:16 pm

Re: Resampling question

Post by rofz » Tue Jan 16, 2018 8:49 pm

Hey john, this is a post from another thread. I have a LG V20 with a 32-bit DAC. These settings were a starting point for me to achieve other sampling rates with Neutron.
Rioter wrote:HTC 10.
1) Generic Driver = ON
2) Generic Driver -> Hi-Res Codec (Offload) = OFF
3) Generic Driver -> Hi-Res Speaker = ON
4) Generic Driver -> Custom Format = ON
5) Custom Format -> FORMAT -> 32-bit int (all options worked).
6) Custom Format -> Frequency -> 44100-192000 (352800-768000 is working too but sounds dull).
7) Custom Format -> Mode -> selected all (all working, tried by selecting each separately).
8) Low Latency = OFF
9) 32-bit Output (IEEE 754) = OFF
Hope this helps.

wzx
Posts: 23
Joined: Sat Nov 16, 2019 5:53 pm

Re: Resampling question

Post by wzx » Sat Nov 23, 2019 1:21 pm

Hello,

I use an external DAC, supporting up to 384Khz.
I'm thinking that not changing original frequency should have less quality loss than resampling.
My question is: will resampling occur anyway in the process before signal is sent to the DAC? (because of 48 khz of Android?)
If yes, I'd select the highest frequency in the output setting.
If not, why not offer an option in "Frequency" such as "original"?

Thanks,

Zx

wzx
Posts: 23
Joined: Sat Nov 16, 2019 5:53 pm

Re: Resampling question

Post by wzx » Sat Nov 23, 2019 1:26 pm

Sorry, just found the option in Audio Harware->"Follow Source Frequency".

blaubär
Posts: 1359
Joined: Tue Apr 02, 2019 6:48 am

Re: Resampling question

Post by blaubär » Sat Nov 23, 2019 1:54 pm

Android originally was limited to a fixed sampling rate of 48 kHz. When high-resolution-audio became fashionable android began to support other sampling rates as well. As to the question whether this is beneficial the opinions are divided. Some people think that anything better than CD is wasted money, cpu and storage. Personally I have set "Follow source frequency", so that my 44.1 kHz mp3 files are delivered with 44.1 kHz to the DAC.

Bjrmd
Posts: 34
Joined: Sun Jan 15, 2012 2:39 pm

Re: Resampling question

Post by Bjrmd » Wed Dec 04, 2019 1:31 am

Unless one uses the custom USB driver, the Android audioflinger and mixer will resample 44.1 to 48k. No matter what neutron indicates, you will get resampling.

blaubär
Posts: 1359
Joined: Tue Apr 02, 2019 6:48 am

Re: Resampling question

Post by blaubär » Wed Dec 04, 2019 5:18 am

Bjrmd wrote:
Wed Dec 04, 2019 1:31 am
Unless one uses the custom USB driver, the Android audioflinger and mixer will resample 44.1 to 48k. No matter what neutron indicates, you will get resampling.
Can you prove that ? You had tested it with Note 10 and Pixel 3 and USB DAC, but how do you know that this is generally so ? And how would you check that is isn't a special problem when using a USB DAC ?
Bjrmd wrote:
Mon Sep 16, 2019 4:20 pm
I have the generic driver set to Raw, high res checked and sample rate at 44.1k (native to the track). Although Neutron displays a play sample rate of 44.1, the Note 10 is putting out 48K as per the color on the Dragonfly Cobalt. I checked the log cat and the Note is creating a resampler to do this. I previously had a Pixel 3 and had the same issue, either the mixer or audioflinger will resample any 44.1 to 48K. Has anyone actually seen the Note 10 put out real 44.1k to a device that will confirm that (Dragonfly Chord Mojo)?
If one would really want to test this one would have to play a high-res-track containing high frequencies, e.g. pink noise from 20 Hz - 80 kHz on a flac file with a sampling rate of 192 kHz, then connect an oscilloscope to the line out and check what frequencies are produced.

blaubär
Posts: 1359
Joined: Tue Apr 02, 2019 6:48 am

Re: Resampling question

Post by blaubär » Wed Dec 04, 2019 7:22 am

So, is anybody here in the forum equipped with such gear and would check whether any high-resolution-output is available on any android device at all ? One successful test would falsify Bjrmd's allegation. @Bjrmd : do you agree ?

dmitrykos
Site Admin
Posts: 1847
Joined: Mon Apr 25, 2011 6:15 pm

Re: Resampling question

Post by dmitrykos » Wed Dec 04, 2019 9:39 am

Hi All,

There is a confusion in this thread about hi-res audio output on Android. First of all we must split the usage case to:
1) Output via internal DAC of the device
2) Output via USB DAC connected via USB OTG to the Android device

In case of 1) all depends on firmware and how firmware developer implemented support for audio DAC. Normally all modern Qualcomm SoCs come with standard drivers which support hi-res audio output and if firmware does not limit this support due to some reason we get hi-res output. All LG Vx, OnePlus or recent Galaxy S10 devices (confirmed in Twitter post: http://twitter.com/neutroncode/status/1 ... 5745920002).

In case of 2) all depends on usbaudio driver of Android which might be different from device to device but normally it gives max 24/192 output. Some firmwares are limited to 48 kHz output only (for example Google Pixel) and therefore only Audio Hardware -> Direct USB Access option will help to output hi-res audio to USB DAC. Direct USB Access is Neutron's USB driver which talks to USB DAC directly, so Android's firmware is fully bypassed.

> Bjrmd
> Android audioflinger and mixer will resample 44.1 to 48k

It is not always true, it fully depends on firmware and usbaudio driver. Audioflinger is not limited to 48 kHz only output and all depends on firmware developer, whether they decided to expose multiple sample rates of the DAC or not. For example OnePlus or LG Vx devices have no problem sending higher sample rate via Audioflinger and can work up to 24/192 without Neutron's USB driver (Direct USB Access).

> Bjrmd
> generic driver set to Raw, high res checked and sample rate at 44.1k (native to the track)

Setting flags will not help because if usbaudio driver does not support multiple rates, nothing will change that. Even if you force multiple frequencies and send unsupported frequency to the OS via Audioflinger it may be accepted but internally OS will resample to the output rate. The answer for this problem - just use Neutron's Direct USB Access. Moreover with Direct USB Access you get support for 32-bit Integer format and unlimited max sample rate (tested up to 768 kHz PCM).

So, hi-res audio IS available on Android devices but you just need to select correct Android device which works for the given usage scenario. You can always test hi-res audio availability by playing Sweep tone and recording & analyze its spectrum with Audacity, similarly how it was done in a Twtter post.

wzx
Posts: 23
Joined: Sat Nov 16, 2019 5:53 pm

Re: Resampling question

Post by wzx » Sun Dec 08, 2019 6:22 am

So for a phone which already supports hi-res via USB, when "Follow Source Frequency", I should get signal without resampling, right? (My phone is Huawei P20 Pro)
On the other hand, as I already reported in another thread, Direct UAB Access stops when the phone is idle.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests