Jump to content

On Nothing Phone (2), any audio seems to resample to a fixed rate, then resamples again.


1meter
Go to solution Solved by maxmp,

Recommended Posts

I noticed that whenever I try to listen to audio at all in Poweramp, it always gets resampled to 16 bit, 44.1/48 khz audio (usually 48khz), then gets resampled again to whatever sample rate the headphone settings are set to. It doesn't matter if the sample rate of the audio matches the sample rate of the headset, what the sample rate settings are set to in-app (for the most part), or if the resampler has already resampled the audio, if that part matters.
I can't use a wired headphone directly to my phone, so I can only verify that this seems to only happen on wireless audio devices and external DACs, but they have slightly different issues.

I realized this recently because I have three bluetooth audio devices, all with different sample rates: The Airpods Pro 2, the Sony WH-1000XM5 and a FiiO BTR5.
The Airpods Pro 2 uses the AAC codec with a sample rate of 16-bit, and a sample format of 44.1 khz,
The Sony WH-1000XM5 uses the LDAC codec with a sample rate of 32-bit, and a sample format of 96 khz,
The FiiO BTR5 uses the APTX HD codec with a sample rate of 24 bit, and a sample format of 44.1 khz, but I can switch it to the LDAC codec. This device is also an external DAC.

On bluetooth, the only occasion that will lead to possibly getting rid of that initial resampling to 16-bit, 48khz audio resampling is by using the AAudio Output plugin and changing your settings to be bit perfect with your hardware. I'm not sure why none of the other plugins have trouble doing this.
I've also noticed that the FiiO BTR5, when using APTX HD, will have things properly resample to 44.1 khz, but not to 24-bit. It resamples to 16-bit first. In LDAC, it has the same issues as the Sony headphones.

As for external DACs, it does something a bit different.
Anytime the sample rate in settings is less than or equal to 48 khz in any way, it will resample to 16-bit, 48 khz and the DAC will use 16-bit, 48 khz.
Anytime the sample rate in settings is greater than 48 khz in any way, it will resample to 32-bit, 384 khz, and the DAC will use 32-bit, 384 khz.
It does not matter what the sample rate is set to, it will act as described above.

There's a few images attached to this post with a look at what I can see.

My current Poweramp build number is 976, the device I'm using is the Nothing Phone 2 and it's on Android 13.

Please let me know if there's any missing info.

 

Screenshot_20230912-065016.png

Screenshot_20230913-005801.png

Edited by 1meter
Clarity in the title, as this seems to be a device specific issue.
Link to comment
Share on other sites

@1meter Equalizer app shows sample frequency as reported to it (via visualization component). If this is incorrectly reported, there may be some errors in the visualizations, but not in the DSP part as internally Android should know the frequency it's operating on (or there is a major bug in a firmware, immediately obvious).

As for multiple resamplings, bluetooth codec will force sample rate and it's not possible to change it. The codec and codec parameters are negotiated by the Android BT stack and the BT device (some hints from Developer options may be taken into account as well). In this case I would suggest selecting the Poweramp output sample rate to avoid extra reamplings as much as possible.

For LDAC over BTR, please note that 96kHz is there only when BTR is within 20-30cm from the phone, it transparently jumps to 48khz if distance is any larger. It's transparent to human ear as humans do not hear frequencies above 20khz (but the sample rate can be measured in base of BTR easily due to the 3.5 output easily connectible to the analyzing device).

Link to comment
Share on other sites

4 hours ago, maxmp said:

It's transparent to human ear as humans do not hear frequencies above 20khz

Off-topic perhaps, but the sample rate has nothing to do with the range of human hearing. This is how many slices per second are being used to digitize the original analog waveform into 16/24/32 bit samples. The higher sample rates and bit depths help to reduce the potential size of the digital “steps” and ensure a more accurate representation of that original signal when decided back to analog. This is the key benefit of higher resolution audio. The increased high frequency potential is a secondary benefit since it pushes the upper limits well beyond the 22kHz limit that was established when 16/44.1 was set for the CD redbook standard. It also means that the low pass brick wall filters that impact the upper range of that same 20-20k audio range can also be pushed way up or even eliminated in some cases to further improve those higher frequencies.

But you are correct about the LDAC range and the ability to support 96kHz. Unless the devices are very close the pairing will automatically throttle down to maintain the connection quality as the first priority.

Link to comment
Share on other sites

16 hours ago, maxmp said:

As for multiple resamplings, bluetooth codec will force sample rate and it's not possible to change it. The codec and codec parameters are negotiated by the Android BT stack and the BT device (some hints from Developer options may be taken into account as well).

@maxmp

I don't understand... So if the sample rate as defined by developer settings is something like 24-bit, 88.1 khz, and the audio device supports that sample rate and format, it will resample to 48 khz anyway, even if Poweramp settings are set to 24-bit, 88.1 khz? And this is because of how Android operates?

16 hours ago, maxmp said:

For LDAC over BTR, please note that 96kHz is there only when BTR is within 20-30cm from the phone, it transparently jumps to 48khz if distance is any larger. It's transparent to human ear as humans do not hear frequencies above 20khz (but the sample rate can be measured in base of BTR easily due to the 3.5 output easily connectible to the analyzing device).

11 hours ago, MotleyG said:

You are correct about the LDAC range and the ability to support 96kHz. Unless the devices are very close the pairing will automatically throttle down to maintain the connection quality as the first priority.

@maxmp @MotleyG

I don't know if I'm doing something wrong while using LDAC, but I've found that no matter what the distance or settings, I can't get Poweramp to not resample the track to 16-bit 48 khz. It just does the same thing as the picture above. Am I doing something wrong?

Link to comment
Share on other sites

@1meter in this case of Bluetooth connection, the allowed sample rates are defined by the codec, firmware bt stack settings, phone + bt device negotiation, and if multiple sample rates/bit formats are possible, developer options can be taken into account.

7 hours ago, 1meter said:

I don't know if I'm doing something wrong while using LDAC, but I've found that no matter what the distance or settings, I can't get Poweramp to not resample the track to 16-bit 48 khz. It just does the same thing as the picture above. Am I doing something wrong?

Poweramp will resample to whatever the sample rate you set. This will be resampled again to the codec sample rate as needed. 

If you want to get 96khz from LDAC, and your firmware is playing safe (as 96khz is not reliable for many devices on distance > 20cms)  and not allowing that by default, try to set (in Developer options) LDAC bitrate to 990kb and LDAC sample rate to 96khz.

If Poweramp output sample rate is set to auto, it will use 96khz automatically. Also try AudioTrack output, not the Hi-Res output.

Link to comment
Share on other sites

@maxmp

I've done what you said, but I still can't get any audio to transmit above 48khz at all. I've changed LDAC bitrate to 990kbps, switched to AudioTrack and put my devices very close together (like, touching each other close), and the same thing happens.

Here are some screenshots showing what I've done, the track's sample rate and format, and what Poweramp shows me is happening:

Screenshot_20230914-180732.thumb.png.2d32f0b3857cafe282748a0f978982ca.png  Screenshot_20230914-183737.thumb.png.5bd360d409ccad6071083f7783fa6b88.png  Screenshot_20230914-180902.thumb.png.24166fe7fa2a6971b9c04c73e8b35bf9.png  Screenshot_20230914-180918.thumb.png.d71fb5e85de817712f10f1cf689cd591.png

Even if I'm on APTX HD, auto settings on any output plugin seems to disregard that my device can play 24-bit, 44.1khz natively and resamples to 16-bit, 48khz, then goes back up...

 Screenshot_20230914-190604.thumb.png.51bb7d2b55b8bd43d97301df4eb39b22.png  Screenshot_20230914-190631.thumb.png.ca11141a26047c29dd83e07c5abb4e97.png  Screenshot_20230914-190526.thumb.png.579c89e35d5040e656ee9f91298cd809.png  Screenshot_20230914-190557.thumb.png.a73a0f13c36f5accf5b14a7d8885cf0d.png

On APTX HD, it looks like I can use the Hi-Res Output and manually change the rate and format so that it properly gives me non-resampled audio, but this doesn't work properly for any of my other devices.

Screenshot_20230914-192041.thumb.png.2bc668c4c900c83a23cd3e3d73f19032.png  Screenshot_20230914-191932.thumb.png.6e44c81af4f80665062f92d674c7075d.png  Screenshot_20230914-191924.thumb.png.33820907109aadb6ecb1ed474904316d.png

If everything is correct here, would the problem just be my phone's firmware?

Link to comment
Share on other sites

  • Solution

@1meter thanks for the details.

I tested various outputs on this device, and apart from USB DAC running on 384khz, any other output device (including LDAC) are forced to 48khz. Quick investigation revelead "Dirac" sound effect hanging around globally and forcing audio being 48khz on all times, causing those weird 44.1->48->44.1 or 96->48->96 resamplings. The Dirac effect switch in Settings does nothing (effect is still there, enabled).

The effect can be disabled by "adb shell pm disable-user --user 0 com.dirac.acs" (+ reboot) and reenabled by "adb shell pm enable com.dirac.acs".
Then you can get Hi-Res output working properly on this device:
image.pngimage.png

 

Link to comment
Share on other sites

@maxmp

Ah, I thought the Direc audio might've been the culprit before, but I ruled it out because turning it off seemed to no nothing at all. Now I know why, haha. I wonder if that's a bug or something intentional.

After following your steps, I can confirm that it is indeed working without the weird resampling issue is no longer there. Thanks for that tip, it's appreciated.

One last thing. Why doesn't the auto sample rate and format settings match those to the highest sample rate and format that the device in use can go to? Is this developer intention, something that has to do with my firmware, or something else?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...