Disabling or Bypassing Resampling in Android: Methods,
Resampling refers to the process of converting digital audio from one sample rate to another. On Android devices, the system will automatically resample audio to 48kHz or 44.1kHz before outputting it to headphones or speakers. This is done for compatibility and to standardize audio playback on the platform.
However, audiophiles and audio purists often prefer to disable resampling, as converting between sample rates can potentially degrade audio quality and alter the original recording. There is debate around whether resampling causes audible changes, but some users want the ability to play back music bit-perfectly at native rates like 96kHz or 192kHz. Additionally, professional audio applications may require bypassing Android’s resampling.
For these reasons, users may wish to disable resampling on their Android device. This allows source audio to pass through unaltered before final output. The following sections examine different methods to bypass Android’s default resampled audio pipeline.
Reasons to Disable Resampling
There are a few key reasons why users may want to disable resampling in Android:
Improved battery life – Resampling is a processor-intensive task. Bypassing it reduces the load on the CPU and can marginally improve battery life (source).
Better performance – Disabling resampling reduces the processing workload, which can lead to smoother overall system performance.
Higher image/video quality – For images and videos, resampling can introduce artifacts and degrade quality. Disabling it ensures no resampling artifacts.
Smoother gameplay – Games that render at high frame rates can benefit from disabling resampling to prevent frames from being blended together.
More accurate audio – Audio resampling can alter the original sampling frequency. Bypassing it provides bit-perfect output.
Overall, disabling resampling reduces unnecessary processing, leading to gains in battery, performance, quality, and accuracy.
How Android Handles Resampling
Android utilizes sample rate conversion and resampling in various parts of the audio pipeline to adjust between different sample rates. According to the Android documentation, “A sample rate converter, or resampler, is a module that implements sample rate conversion” (https://source.android.com/docs/core/audio/src). The resampler utilizes techniques like interpolation and filtering to convert the audio from one sample rate to another.
A key component that performs resampling in Android is the AudioFlinger service. As noted in the Android NDK documentation, “The AudioFlinger service runs at a native audio hardware sampling rate and performs resampling as needed on buffer queues when the client sample rate does not match hardware” (https://developer.android.com/ndk/guides/audio/sampling-audio). So AudioFlinger handles on-the-fly resampling to bridge connections between different sample rates.
Some best practices given for resampling in Android include using simple ratios between sample rates, preferring upsampling over downsampling, and limiting resampling when possible by picking optimal sample rates. Android relies on resampling to enable flexibility in audio routing, but resampling can negatively impact quality.
Disable Resampling in Developer Options
Developer options provide an easy step-by-step way to disable resampling on Android. Here is how to do it:
1. Open Settings and scroll down to locate the “About phone” option. Tap it.
2. Scroll down and rapidly tap the “Build number” option 7 times until you see a message that “Developer options have been enabled.”
3. Back in Settings, you will now see a “Developer options” menu. Open it.
4. In Developer options, scroll down and locate the “Disable Bluetooth A2DP hardware offload” option. Enable it.
According to this Reddit thread, this will disable audio resampling for Bluetooth audio.
5. Scroll down further until you find the “Disable USB audio routing” option. Enable it.
According to the same Reddit source, this will disable resampling for wired USB audio output.
6. Restart your Android device for the changes to take effect.
With those two developer options enabled, you have successfully disabled Android’s default resampling behavior for both Bluetooth and wired audio output.
Use ADB to Disable Resampling
You can disable audio resampling on Android by issuing ADB commands. Here is a step-by-step guide:
- Enable USB debugging on your Android device in the Developer options settings.
- Install ADB on your computer and connect your device via USB.
- Open a command prompt or terminal and enter
adb devices
to confirm your device is detected. - Enter the command
adb shell
to get a shell prompt on your device. - Enter
setprop audio.sys.resample false
to disable resampling. - Restart your device for the change to take effect.
Now Android will output audio at the original sample rate without any resampling. This allows the external DAC to handle any sample rate conversion. [1]
This ADB command method only works if your device is rooted. There are Magisk modules available to automate disabling resampling as well. Overall, using ADB provides precise control to bypass Android’s default audio resampling.
Modify Build Prop File
One method for disabling resampling system-wide on Android is to modify the build.prop file. The build.prop contains system-level settings and properties for Android. By adding a few lines, you can configure Android to disable audio resampling.
To edit build.prop to disable resampling, first you will need root access on your Android device. Then access the build.prop file located at /system/build.prop using a file editor app with root permissions.
In the build.prop file, add the following lines:
ro.audio.silent=1
ro.config.media_vol_steps=30
ro.config.vc_call_vol_steps=11
Saving these settings will configure Android to disable automatic audio resampling system-wide [1]. The “ro.audio.silent=1” line in particular disables the Android audio resampler. This can help playback music and audio at higher sample rates.
After editing build.prop, reboot your Android device for changes to take effect. With resampling disabled at the system level, audio will play back bit-perfect as intended by the source material.
Use Custom Roms or Kernels
One way to disable audio resampling system-wide on Android is by using a custom ROM or custom kernel that allows bypassing Android’s default audio resampling. Many custom ROMs like LineageOS or Resurrection Remix have options in their developer settings or audio settings to disable resampling. Similarly, custom kernels like ElementalX, EX Kernel Manager, and others have built-in functionality to modify the audio sample rate.
The advantage of using a custom ROM or kernel is that it overrides Android’s default audio stack and provides more granular control over audio parameters. Popular custom kernels like Viper4Android have additional DSP effects and audio tweaks beyond just disabling resampling. With a custom kernel, options like changing the sample rate, bit depth, SRC, and other advanced parameters can be modified.
When choosing a custom ROM or kernel, look for ones that specifically advertise the ability to disable audio resampling or bypass Android’s mixer limitations. Features like high-quality audio, lossless output, Bit Perfect, and SRC control are good indicators. Flashing a custom ROM or kernel will give you full control over Android’s audio for bit-perfect lossless playback.[1]
[1] https://www.reddit.com/r/Android/comments/73v3o6/this_is_how_you_change_the_sample_rate_to_441_khz/
Resampling in Specific Apps
Certain apps like YouTube, Camera, and social media apps tend to resample audio and video to lower quality defaults. Here are some tips for disabling resampling in specific problematic apps on Android:
For YouTube, use a third party app like NewPipe or SkyTube which allow setting a higher default resolution and disabling resampled audio.
In the Camera app, look for advanced settings to shoot video at higher resolutions like 4K at 60fps to avoid heavy compression and resampling. Some Samsung phones have a “High Efficiency Video Codec” setting which can be disabled.
Try using third party apps for social media instead of the official apps, as they often allow disabling compression and resampling when uploading media.
Overall, be on the lookout for advanced settings in problematic apps that control resolution, bitrates, and sampling rates. Using third party alternatives can help avoid forced resampling in official apps.
Automating Disabling Resampling
One option to make disabling resample easier is to setup an automation that can toggle it on and off for you automatically in different scenarios. Two popular automation apps on Android that can accomplish this are Tasker and MacroDroid.
In Tasker, you can create a profile triggered by application launch or Bluetooth connect/disconnect events that will run a task to execute ADB commands or modify the build prop to disable/enable resampling. For example, you could automatically disable resampling when you launch your music player app and revert when you close it.
Similarly in MacroDroid, you can setup triggers based on events like app launch, headset connect, or time of day. The action would run a shell script or command via adb as needed to toggle resampling. This allows automating the process so you don’t have to remember to manually disable resample every time.
Profiles in both apps can be enabled/disabled easily as needed. Automation makes it convenient to disable resampling in scenarios where audio quality matters most, without having to always leave it off globally.
Conclusion
In summary, disabling resampling in Android can provide some benefits like improved image quality in certain use cases, but it also comes with tradeoffs. The exact impact will depend on your device, Android version, apps used, and personal preferences.
The easiest methods are using Developer options or ADB commands, which allow temporarily disabling resampling. For a permanent solution, modifying the build.prop file or using a custom ROM/kernel gives you the most control. Specific apps like Camera apps may also have toggles to disable certain resampling features.
Overall, resampling is a complex topic without a one-size-fits-all solution. The methods discussed give users more options and transparency into how Android handles images. Consider experimenting with your specific device and workflow to determine if disabling resampling improves your experience or not.
Just be aware of potential downsides like higher memory usage or worse performance in some apps. As always with advanced Android tweaks, proceed with caution, back up your device, and be ready to revert changes if needed.