FORUMS
Remove All Ads from XDA

[Solved] How to remove audio distortion from all stereo phones with unequal speakers

29 posts
Thanks Meter: 44
 
By Voidablazer, Junior Member on 25th September 2018, 07:20 PM
Post Reply Email Thread
AinurArise

[Brought to you by a collaboration of Ainur and ARISE]


Description of the issue:
The issue with all Oreo ROMs for mi max 2 right now, is that there is very apparent audio distortion at max volume.

The reason for that is this:
The phone uses a stereo setup with the earpiece acting as the left channel and the bottom loudspeaker acting as the right channel.

Of course those two speakers are not of the same quality or meant to play the same frequencies.
Reading a bit around the official miui forum you will find that the earpiece speaker is meant as a treble speaker playing mid to high frequencies and the bottom loudspeaker as a woofer playing low to mid frequencies or even high ones since it can.

Using an aosp Oreo ROM though loses that optimization and treats the two unequal speakers as equal with the result of having the earpiece rattle heavily when it must play a frequency under 550hz.

Using an equalizer such as the one included in Dolby Atmos Axon 7, to reduce every frequency Lower than 500hz worked to remove the rattle from the earpiece but also removed the bass from the bottom loudspeaker, which isn't the ideal solution.

The final solution was to implement a high filter pass (suggested by UltraM8/Sovetnikov from Ainur), which was elaborated upon and implemented by Joe0Bloggs from ARISE.


Description of included impulses:

If your left channel is the earpiece and the right channel is the bottom speaker, (which is true for mi max 2) you need one of the following impulses:
1) Hi-Low Speakerphone HiL:
Which simply applies a high filter pass of 500hz to the left channel

2) Hi-Low Speakerphone 4-Way HiL:
Which applies a high filter pass of 500hz to the left channel but also redirects those left channel frequencies that are cut-off and merges them with the right channel.
So in the scenario that the left and right channel have a difference you will he able to hear it instead of it being just cut-off

If your right channel is the earpiece and the left channel is the loudspeaker, (which may be true for other phones with a similar issue) you need one of the following impulses:
1)Hi-Low Speakerphone HiR:
Simply cuts off any frequency under 500hz with a high filter pass on the right channel.

2)Hi-Low Speakerphone 4-Way HiR:
Cuts off any frequency under 500hz from the right channel with a high filters pass but also redirects and merges it with the left channel.

To test which is your left and right channel, you can use anyone of the myriad left-right channel test videos in YouTube:
Left Right Channel Test

All the impulses are wav files and they are zipped in ImpulsesOxygen.zip, so you simply unzip them and import the wav file of your choosing in the JamesDSP Convolver.

Those impulses can also be used with ROMs of other phones that either come with dual-speaker setup or use a mod to create two channel audio.


Installation Procedure:

You will need to flash the following modules through Magisk (They can all be found in the Downloads section of Magisk Manager):
1) Ainur Sauron
2) Ainur JamesDSP (you can also use viper4a fx, but it has some bug when switching impulses)
3) Audio Modification Library
4) Audio Compatibility Patch

After flashing the requirements:
1) Reboot so all Magisk Modules are installed
2) Copy the impulse of your choosing (wav file) at 'Internal Storage/JamesDSP/Convolver' (I suggest you use the 4-Way HiL wav found in the zip for mi max 2)
3) Open JamesDSP
4) Enable the Master Switch on top of that window to activate JamesDSP
5) Enable the Convolver option near the bottom of that window
6) Select as Impulse your chosen wav file (4-way HiL for example)

Download:Mega.nz -ImpulsesJoe
(Or from the zip attachment in this post)

MD5sums of the attachments:
HiL: e9dc1fd5ce67793a60bc1d7bfb73eb72
HiR: 2ed4dab03e326643d72a7eec0f53b246
4-Way HiL: 96207e83552fc99a40e6012ff5646bbe
4-Way HiR: c0d88c31352d50ba350755f97a924266
ImpulsesOxygen.zip: 99149367d212c447d2427fd372eb2be5

Contact: For any clarifications feel free to contact @Joe0Bloggs on Telegram.
Attached Files
File Type: zip ImpulsesOxygen.zip - [Click for QR Code] (58.9 KB, 980 views)
The Following 26 Users Say Thank You to Voidablazer For This Useful Post: [ View ] Gift Voidablazer Ad-Free
 
 
25th September 2018, 08:05 PM |#2  
Joe0Bloggs's Avatar
Senior Member
Thanks Meter: 1,354
 
More
Thanks for putting the word out for this solution!
The Following 2 Users Say Thank You to Joe0Bloggs For This Useful Post: [ View ] Gift Joe0Bloggs Ad-Free
25th September 2018, 08:09 PM |#3  
OP Junior Member
Thanks Meter: 44
 
More
Quote:
Originally Posted by Joe0Bloggs

Thanks for putting the word out for this solution!

Good work man. Cheap stereo speakers can die another day.
25th September 2018, 09:16 PM |#4  
ridershahmir's Avatar
Senior Member
Thanks Meter: 95
 
More
Quote:
Originally Posted by Voidablazer

The issue with all Oreo ROMs for mi max 2 right now, is that there is very apparent audio distortion at max volume.

The reason for that is this:
The phone uses a stereo setup with the earpiece acting as the left channel and the bottom loudspeaker acting as the right channel.

Of course those two speakers are not of the same quality or meant to play the same frequencies.
Reading a bit around the official miui forum you will find that the earpiece speaker is meant as a treble speaker playing mid to high frequencies and the bottom loudspeaker as a woofer playing low to mid frequencies or even high ones since it can.

Using an aosp Oreo ROM though loses that optimization and treats the two unequal speakers as equal with the result of having the earpiece rattle heavily when it must play a frequency under 550hz.

Using an equalizer such as the one included in Dolby Atmos Axon 7, to reduce every frequency Lower than 500hz worked to remove the rattle from the earpiece but also removed the bass from the bottom loudspeaker, which isn't the ideal solution.

The final solution was to implement a high filter pass (suggested by UltraM8/Sovetnikov from Ainur), which was elaborated upon and implemented by Joe0Bloggs from ARISE.

You will need to flash the following through Magisk:
1) Ainur Sauron
2) Ainur JamesDSP (you can also use viper4a fx, but it has some bug when switching impulses)
3) Audio Modification Library
4) Audio Compatibility Patch

Now you simply have to reboot, open JamesDSP , enable the master switch, scroll down, enable convolver and select one of the attached Impulses.
(All impulses must be moved go the directory: InternalStorage/JamesDSP/Convolver)

If your left channel is the earpiece and the right channel is the bottom speaker, (which is true for mi max 2) you need one of the following impulses:
1) Hi-Low Speakerphone HiL:
Which simply applies a high filter pass of 500hz to the left channel

2) Hi-Low Speakerphone 4-Way HiL:
Which applies a high filter pass of 500hz to the left channel but also redirects those left channel frequencies that are cut-off and merges them with the right channel.
So in the scenario that the left and right channel have a difference you will he able to hear it instead of it being just cut-off

If your right channel is the earpiece and the left channel is the loudspeaker, (which may be true for other phones with a similar issue) you need one of the following impulses:
1)Hi-Low Speakerphone HiR:
Simply cuts off any frequency under 500hz with a high filter pass on the right channel.

2)Hi-Low Speakerphone 4-Way HiR:
Cuts off any frequency under 500hz from the right channel with a high filters pass but also redirects and merges it with the left channel.

To test which is your left and right channel, you can use anyone of the myriad left-right channel test videos in YouTube:
Left Right Channel Test

All the impulses are wav files and they are zipped in ImpulsesOxygen.zip, so you simply unzip them and import the wav file of your choosing in the JamesDSP Convolver.

Those impulses can also be used with ROMs of other phones that either come with dual-speaker setup or use a mod to create two channel audio.

Download:Mega.nz -ImpulsesJoe
(Or from the zip attachment in this post)

MD5sums of the attachments:
HiL: e9dc1fd5ce67793a60bc1d7bfb73eb72
HiR: 2ed4dab03e326643d72a7eec0f53b246
4-Way HiL: 96207e83552fc99a40e6012ff5646bbe
4-Way HiR: c0d88c31352d50ba350755f97a924266
ImpulsesOxygen.zip: 99149367d212c447d2427fd372eb2be5

Contact: For any clarifications feel free to contact @Joe0Bloggs on Telegram.

Can you please explain it in simple steps. Kind of noob friendly?
25th September 2018, 09:41 PM |#5  
OP Junior Member
Thanks Meter: 44
 
More
Quote:
Originally Posted by ridershahmir

Can you please explain it in simple steps. Kind of noob friendly?

Installation Procedure:

You will need to flash the following through Magisk:
1) Ainur Sauron
2) Ainur JamesDSP (you can also use viper4a fx, but it has some bug when switching impulses)
3) Audio Modification Library
4) Audio Compatibility Patch

After flashing the requirements:
1) Reboot so all Magisk Modules are installed
2) Copy the impulse of your choosing (wav file) at 'Internal Storage/JamesDSP/Convolver' (I suggest you use the 4-Way HiL wav found in the zip for mi max 2)
3) Open JamesDSP
4) Enable the Master Switch on top of that window to activate JamesDSP
5) Enable the Convolver option near the bottom of that window
6) Select as Impulse your chosen wav file (4-way HiL for example)
The Following User Says Thank You to Voidablazer For This Useful Post: [ View ] Gift Voidablazer Ad-Free
25th September 2018, 09:42 PM |#6  
Joe0Bloggs's Avatar
Senior Member
Thanks Meter: 1,354
 
More
Quote:
Originally Posted by ridershahmir

Can you please explain it in simple steps. Kind of noob friendly?

Sure, for the user, all that's involved is
1. Have the problem--a phone that's got a big speaker and a little speaker for stereo and a custom ROM that isn't optimized for their difference
2. Test and find out whether the "small" speaker is for the left or right channel--using this video https://youtu.be/hTvJoYnpeRQ for example
3. Install the solution: the OP mentioned 4 programs but you mostly have to just make sure Ainur JamesDSP is working. Then copy the files from ImpulsesOxygen.zip to (InternalStorage)/JamesDSP/Convolver .
4. In JamesDSP, enable Master switch for Speaker and, some way down the menu, enable "Convolver enable" for convolver and choose one of the files from ImpulsesOxygen.zip as "Impulse response". Choose "hiL" or "4way hiL" if (referring back to step 2) your small speaker is for the left channel; choose "hiR" or "4way hiR" if your small speaker is for the right channel. Below screenshots are example config for the Mi Max 2 with small speaker for left channel.
Attached Thumbnails
Click image for larger version

Name:	James1.png
Views:	836
Size:	93.1 KB
ID:	4604941   Click image for larger version

Name:	James2.png
Views:	814
Size:	97.8 KB
ID:	4604942  
The Following 3 Users Say Thank You to Joe0Bloggs For This Useful Post: [ View ] Gift Joe0Bloggs Ad-Free
26th September 2018, 05:40 AM |#7  
Senior Member
Thanks Meter: 93
 
More
Quote:
Originally Posted by ridershahmir

Can you please explain it in simple steps. Kind of noob friendly?

I really don't think it can be explained in simpler steps...

@Joe0Bloggs This is really nice, thank you for the insight. What do you think, can it be implemented on a system level without Ainur and Audio libraries?
The Following User Says Thank You to sirdickens For This Useful Post: [ View ] Gift sirdickens Ad-Free
26th September 2018, 08:25 AM |#8  
Joe0Bloggs's Avatar
Senior Member
Thanks Meter: 1,354
 
More
Quote:
Originally Posted by sirdickens

I really don't think it can be explained in simpler steps...

@Joe0Bloggs This is really nice, thank you for the insight. What do you think, can it be implemented on a system level without Ainur and Audio libraries?

Someone more experienced in that level of modding can chime in here I hope... The OP was working on a modified mixer_paths that should have similar effect but it hasn't worked so far. The lines that were supposed to do the job read like this I believe
<ctl name="RX3 HPF cut off" value="MIN_3DB_850Hz" />

https://github.com/mozilla-b2g/devic...ixer_paths.xml

The present approach with JamesDSP and convolver files does have more fine-grained control over the sound and the bandpass+phase shifted signal of the bass redirection channel in the 4-way filters should not be doable outside of JamesDSP or V4A.
26th September 2018, 10:19 AM |#9  
Senior Member
Thanks Meter: 93
 
More
Quote:
Originally Posted by Joe0Bloggs

Someone more experienced in that level of modding can chime in here I hope... The OP was working on a modified mixer_paths that should have similar effect but it hasn't worked so far. The lines that were supposed to do the job read like this I believe
<ctl name="RX3 HPF cut off" value="MIN_3DB_850Hz" />

https://github.com/mozilla-b2g/devic...ixer_paths.xml

The present approach with JamesDSP and convolver files does have more fine-grained control over the sound and the bandpass+phase shifted signal of the bass redirection channel in the 4-way filters should not be doable outside of JamesDSP or V4A.

Sounds interesting, I am not an expert but will try and look into it.

Thank you for your kind explanation. I hope developers will also take a look at it.

Btw, stereo is awesome now! It would be interesting to tweak a bit more as I think earpiece might carry over a bit lower frequencies, thus pushing stereo even further!
26th September 2018, 01:32 PM |#10  
Senior Member
Flag Ho Chi Minh City
Thanks Meter: 45
 
More
AML has been included in Ainur Sauron, I can see AML libs and scripts inside the zip file. This is exactly what I did with my Max2, as I mentioned in MXM review, but I have lack of deep investment as yours, instead I use some other impulses and luckily fixed the problem too. Nice to see this thread since it can help other users. Btw, can you please write a guide to install these mods with SuperSu instead of Magisk? (AML can not install in recovery without Magisk)
26th September 2018, 04:46 PM |#11  
Joe0Bloggs's Avatar
Senior Member
Thanks Meter: 1,354
 
More
Quote:
Originally Posted by romeo_coi

AML has been included in Ainur Sauron, I can see AML libs and scripts inside the zip file. This is exactly what I did with my Max2, as I mentioned in MXM review, but I have lack of deep investment as yours, instead I use some other impulses and luckily fixed the problem too. Nice to see this thread since it can help other users. Btw, can you please write a guide to install these mods with SuperSu instead of Magisk? (AML can not install in recovery without Magisk)

I don't know about AML but as far as I can tell the essence of the mod doesn't require you to install Ainur and only requires you to install one of JamesDSP and V4A, hence AML isn't necessary.
Post Reply Subscribe to Thread

Tags
crackling, distortion, hiss, rattle, sound

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes