yashsingh1/xdaforums huggingface dataset:
[Nexus 5X Themes and Apps] chdloc:
As I suspected, you are on a kernel that uses Faux sound. Hence, the kernel is taking over all gain control. Anything you change in mixer_paths.xml or tinymix will get overwritten by the kernel. I'm willing to bet that you are currently not able to tune left-right speaker balance. You could use a kernel "tuner" app that exposes sound control or tinker with the values exposed in the file system, i.e. in /sys/kernel/sound_control_3/ for the appropriate use-case. Hello Tasker...

I have never used ElementalX myself but after having studied the code you may be better off using the stock kernel if you like the "luxury" of being able to control all gains, in particular with respect to stereo loudspeaker playback. Note that, inside the codec (on a hardware level), the earpiece follows the same signal path and gain controls as the left headphone, which makes the control inseparable with Faux. Not good in the context of this thread.
[Nexus 5X Themes and Apps] PrimaScelta:
between surround mod and louder surround mode what change?
[Nexus 5X Themes and Apps] sshafranko:
Only volume raised a couple notches.
[Nexus 5X Themes and Apps] perceptualdoor:
Does the 6.0.1 surround mod take care of the volume increase in the handset speaker or do I still need to flash the upper speaker mod from 6.0?
[Nexus 5X Themes and Apps] AquilaDroid:
Just saw this, but when I try to install Fauxsound on my N5X with PureNexus ROM and ElementalX kernel (1.1.2) I get a "kernel not supported" message.
[Nexus 5X Themes and Apps] parthabhatta:
[MENTION=5108383]sshafranko[/MENTION]

I had attached the XML from Android N as asked for by you. I think you missed that. Anyway, if you have time, the attached XML is in the link below for you to see and mod for N with volume of main speaker reduced by 25 to 30 percent.

Regards

http://xdaforums.com/nexus-5x/themes-apps/mod-surround-sound-testers-t3252659/post66170873
[Nexus 5X Themes and Apps] chdloc:
If the following directory exists in your setup

/sys/kernel/sound_control_3/

then (a version of) Faux sound is offered by the kernel you are using. You may need to use some other kernel control app or figure out how to manipulate the parameters in the sound_control_3 directory directly.
[Nexus 5X Themes and Apps] sshafranko:
I did miss it...ty
[Nexus 5X Themes and Apps] AquilaDroid:
OK, that directory is there and I can change the volumes with Kernel Adiutor. Thanks!
[Nexus 5X Themes and Apps] grognaz:
Never mind my questuon, its already answered in this thread....
[Nexus 5X Themes and Apps] dpj52190:
Possible to have the earpiece speaker filter by the high frequency? that way it'll sound like surround sound but with less distortion.
[Nexus 5X Themes and Apps] chdloc:
Possible? Absolutely (see post #105). Simple and straightforward? No, unfortunately.
[Nexus 5X Themes and Apps] Neutrality:
Look, I did something :D

http://xdaforums.com/showpost.php?p=66320840&postcount=1059
[Nexus 5X Themes and Apps] RFOX100:
hi all.

i am about to get my Nexus 5x in a week.

i want to try this mod also

i am just afraid about ruin the speaker in long term.

is any 1 of you using this mod for long time and still not facing any issue?

what else it will effect my phone?

it will act like i have 2 speakers at all time?

if it was so easy to do why Google itself didnt do it for us so we can get benfit from our n5x ?

thanks
[Nexus 5X Themes and Apps] Neutrality:
I used the same mod on Nexus 5 - no issues

It seems that mode affects only the sound

except telephone calls (maybe except for speakerphone calls)

because the quality of the speakers and the sound is so terrible xD
[Nexus 5X Themes and Apps] sshafranko:
I made a test zip a couple pages back that included the mod on speaker phone call but im not sure if it works i didnt get much feedback or i may have missed it have to look again...
[Nexus 5X Themes and Apps] Neutrality:
I just tested - @RFOX100 in the current version of mod one speaker works at a call on speakerphone (bottom).

@

sshafranko Soon I'll try to check your test zip (this one? #214)
[Nexus 5X Themes and Apps] sshafranko:
Yea thats it...ty very much
[Nexus 5X Themes and Apps] ShockBuddy:
Works great on the latest Android N Dev. Preview.

Really like this mod, thank you. :)
[Nexus 5X Themes and Apps] AABatteries:
Does it work well? No crashes/ force closes? So this mod gives you the surround mod + stereo recording in video mode? Nice! How is the audio quality? Much better?
[Nexus 5X Themes and Apps] Neutrality:
the bit rate and noise suppression is not changed, but the two-channel stereo sound is definitely better)) I did not see any crashes and so on, but we need more people who will test it...
[Nexus 5X Themes and Apps] AABatteries:
Great, that's good to hear! I will test this in a few days once I buy some usb-c cabled and root the phone (just got it in the mail)

Great work!
[Nexus 5X Themes and Apps] RFOX100:
thanks

Thank you Very Much bro

:good:

---------- Post added at 12:10 PM ---------- Previous post was at 12:09 PM ----------

thank you all
[Nexus 5X Themes and Apps] EVR_PR:
Is there a way to split the speakers by frequency instead of channel a la HTC 10? For example, letting the earpiece speaker handle treble and the bottom handle mids and bass, instead of the top handling the left channel and the bottom one handling the right?
[Nexus 5X Themes and Apps] sshafranko:
The Htc 10 has a different speaker on top...i have to take a look at it...im gonna order a replacement HTC10 top speaker and see what its all about. Maybe even wire it in on my Note 5
[Nexus 5X Themes and Apps] AABatteries:
I can confirm - it works! Stereo recording audio in video, and surround sound also works flawlessly! I think you should add this somewhere as a sticky, or even a separate topic, eg. [MOD] Stereo Audio Recording for Video

Great job!
[Nexus 5X Themes and Apps] Neutrality:
I wanted to make a separate topic, but decided it was not fair. After all, I just combined the two mods into one. I don't know...
[Nexus 5X Themes and Apps] sshafranko:
Do whatever youd like i dont mind at all...use it up man
[Nexus 5X Themes and Apps] Neutrality:
Hi [MENTION=5108383]sshafranko[/MENTION]

One more question)) It seems to me, or right (aka bottom) speaker is louder than the left? What happens if I do "RX7 Digital Volume" value a little less?
[Nexus 5X Themes and Apps] sshafranko:
If you mean lower it below the Stock value i havent tried on this phone. I tried on Samsung phones and it bootlooped every time on reboot.
[Nexus 5X Themes and Apps] aamadorj:
I tried this test mod and it seems to work on my N5X running latest Pure Nexus. I must admit is hard to tell if the upper speaker is making sound when using speaker phone, because volume is quite low compared to the bottom speaker.

I even tried the trick to cover bottom speaker while talking, but I really can't tell for sure sound at the top of the phone is not coming internally from the bottom.

Anyway, I think this test mod works. Thanks a lot for your work, [MENTION=5108383]sshafranko[/MENTION].
[Nexus 5X Themes and Apps] sshafranko:
Thanks so much for your feedback...ill have to do a little more testing then..it will never sound as good or as loud as the lower speaker but you should be able to hear it. I guess playing music from the incoming call line may help things. Thanks
[Nexus 5X Themes and Apps] suku_patel_22:
Was wondering, would it be possible to route audio from call stream to media stream so that hangout call may be sent over chromecast?
[Nexus 5X Themes and Apps] Flyjo:
I have no file mixer_path1 only mixer_path. And i have no file mixer_paths.xml.bak in my phone...

And what is the difference between HPHL(R) volume and RX1(2) Digital Volume? Thank You very much!
[Nexus 5X Themes and Apps] dragonalex155:
Do I need to root for this?
[Nexus 5X Themes and Apps] szucsgf:
No, just unlocked bootloader and custom recovery.
[Nexus 5X Themes and Apps] k.s.deviate:
Here's something to ponder, after flashing this mod the earpiece sounds light and airy. As discussed previously, it's because the earpiece speaker and the media speaker are not the same.

However, it has been shown that the N5x has the same earpiece speaker as the N5. But when flashing this same mod for the N5 (dual mono zip), the earpiece speaker is actually bassier than the main media speaker and the sound is quite balanced, not airy at all and sounds quite good.

So, what are the differences on the software side that are causing the sound differences? Can we achieve the same quality of sound found on the N5 on our N5x?
[Nexus 5X Themes and Apps] Jose-MXL:
Dual mono speaker lines ported and tested fron N5

Update1:

I will review if filters for low frequencies improve the reproduction on earpiece so that we can get a less distorted reproduction on earpiece (either low or high level layer on software), and if so, to put it together in the simplest way that my ability can allow me.

EndOfUpdate1.

Hey guys, although the conventional name of this mod would be "dual mono", I would call this as "Twitter assisted Mono speaker".

The explanation as to why I did this could be 3 pages long but long story short, I don't think the N5X benefits from the surround sound mod, therefore I just copy pasted the mixed channel mod from [MENTION=5108383]sshafranko[/MENTION] Nexus 5 mod and it worked like a charm.

I consume a lot of media, literally, I watch 3~4 GB MKV movies on this phone, and having the channels split in between modded earpiece and speaker results in a lot of audible media loss for me. Since the media I consume has proper left and right channels, whichever way I set my earpiece/speaker channels (left/right or right/left), the channel playing on the earpiece takes a big hit and worsen my media instead of helping.

Now with these lines added to the xml, both earpiece/speaker are playing both right/left channels (long way to say dual mono), and since earpiece can only play high pitched sounds (if any), it acts as a complementary twitter to the main speaker.

My media just got better now! I can tell a WOW difference when watching "Edge of tomorrow" movie which has a lot of high pitched mechanical sounds through the action scenes and it made a day and night experience there (i.e. the rain in the Cage vs. Skinner scene is so crisp and loud, I was surprised).

Posted below is the xml I have and picture with the added lines.

I think 1 or 2 users have asked for this already so hope they read me.

NOTE: Earpiece will still distort at high volumes and produce an airy/hissing sound when earpiece tries to play frequencies that it can't. This is exactly the same as the surround sound mod, except that now the main speaker will play both right/left channels (instead of one or the other) and you will not miss any audible media. Any personal changes that you want to make (less gain to earpiece or balancing to speaker) are all subject to individual preference and welcome as a feedback.
[Nexus 5X Themes and Apps] CerB:
is it possible to get that as a zip ?
[Nexus 5X Themes and Apps] suku_patel_22:
Just replace the XML in the original zip.
[Nexus 5X Themes and Apps] sshafranko:
Good job brother...my bad i havent been able to keep up with the thread as much as id like to do to work, i also have this mod on many other phones probably 8 to 10 threads besides this one to keep up not to mention the pms i get to mod other phones...

Anyway ill zip this, post it in the op and credit u today...
[Nexus 5X Themes and Apps] sshafranko:
OP updated with [MENTION=5940484]Jose-MXL[/MENTION] mixer file in flashable zip...
[Nexus 5X Themes and Apps] peikojose:
Hi.. tried your mod... it is weird but using your mod sounds is distorted... maybe lowering the volume of the earpiece ? I get less distortion using original mod... but I understand your point and it really makes sense should work better...
[Nexus 5X Themes and Apps] Jose-MXL:
Hi, I'm working on it. It has to do a lot with the type of media I'm using to test.

I noticed that the mod worked OK with movies but when I tested with music it was blown away with a lot of distortion.

Seems like playing both right/left channels was overkill for the poor earpiece, plus you were right, the gain was a little bit up, I don't know why.

So here is the deal, I am working on a version of my mod that uses filters from [MENTION=2760454]chdloc[/MENTION] to make a very narrow band, I have tested a lot of songs myself using ONLY the earpiece and ONLY the left channel (this is the way I made the "twitter" mod) and it seems that most of the distortion is gone. The earpiece can play mids with no problem but distorts on lows and highs (makes sense since it's an earpiece), so I attenuated the frequencies 85<Freq<12,000.

UPDATE

I inadvertently disabled left channel on main speaker, corrected zip file reattached.

UPDATE

Please try attached zip file and provide feedback, it has a filter for low and high bands and this took away most of the distortion on the music I played. Again, it is very subjective to the media I was using to test. I can spend weeks designing the filters but to be honest I just want to brush away most of the distortion in the fewest attempts possible. If 87 is too much gain for your earpiece, adjust it to your liking, mine is fine.

The way my mod works at this point is as follows:

-Right channel is untouched.

-Left channel is filtered with filter "Test1" from attached picture.

-Main speaker plays both right channel and filtered left.

-Earpiece plays filtered left channel only (avoiding most of the distortions at high volume with the filters).

-With this mod you get a 100% right channel and a filtered left channel at about ~140% its original volume. Not bad, even for me.

[MENTION=5108383]sshafranko[/MENTION]

[MENTION=2760454]chdloc[/MENTION]

View attachment 3738287
[Nexus 5X Themes and Apps] Jose-MXL:
Most definitely!! I will work on your feedback and everyone's feedback. [MENTION=2760454]chdloc[/MENTION]

I am just spending time on this since I see a lot of people interested and have the minimum set of skills required to work on it, plus a N5X (please notice I said the minimum and hence why so many errors and noobish mistakes, lack of knowledge).

Let's talk about topic by topic so I can work on it:

- 96 Khz filter, I figured most of the music (streamed too) would be good to go here, I had no clue that mother Google tricked us by downsampling under the hood. I will set the filters to 48Khz and test myself to see what the changes are and start walking from there.

- I want to accomplish Left channel on the earpiece only (since it will have the filters to avoid distortion at the frequencies we identify down the road), and both right and filtered left on the main speaker. I think this is the only and best way to crank the volume on the earpiece a little bit and have it act as a "twitter" (hence the cost of the tradeoff of volume for a narrower band).

Should I manually copy paste a pass through to IIR2 according to your indication?

- Yes I noticed that I inadvertently made this mistake on the main speaker and corrected it on the previous post before reading this (your) post, I am constantly testing a youtube Left/Right channel test that I like and realized the mistake this morning. I rushed last night to pack the xml and didn't tested this.

I am not sure I understood what you said with "digital full-scale representation" but please confirm that this does not apply to the mod I'm trying to make since I will only be playing the left channel on the earpiece (in which we desperately want to crank up the volume and avoid distortion).

- Please point as to how to disable sidetone to test if any improvement is achieved.

- Any other feedback? I have received none so far.....
[Nexus 5X Themes and Apps] chdloc:
I'm not aware of any streaming service that provides 96 kHz sampled audio, irrespective of its futility.

Yes, if you only want to apply filter to the left channel, you need to set all filter coefficients pertaining to the right channel, IIR2, to passthrough, i.e.

<ctl name="IIR2 Band1" id="0" value="268435456" />
<ctl name="IIR2 Band1" id="1" value="0" />
<ctl name="IIR2 Band1" id="2" value="0" />
<ctl name="IIR2 Band1" id="3" value="0" />
<ctl name="IIR2 Band1" id="4" value="0" />

<ctl name="IIR2 Band2" id="0" value="268435456" />
<ctl name="IIR2 Band2" id="1" value="0" />
<ctl name="IIR2 Band2" id="2" value="0" />
<ctl name="IIR2 Band2" id="3" value="0" />
<ctl name="IIR2 Band2" id="4" value="0" />

etc.

Standard 16-bit digital audio data is represented by integers spanning the range between -32768 and +32767. The two extremes are often referred to "digital full-scale". Audio is very often mastered such that peak sounds hit just below the two extrema. Any amplification of these sounds will invariably result in (absolute) numbers greater than 32768. To be able to play them back using standard audio codecs those peaks that exceed 32768 need to be capped (clipped). This clipping leads to non-linear distortion which given sufficient amplification will become very audible.

Android by default does not add any amplification to the sound. The volume rocker tops out at an amplification factor of 1.0. In other words, Android only applies attenuation to the audio by default. Of course, third-party equalizers and sound processing libraries can and do introduce gain with associated distortions.

Now, moving to the Qualcomm codec: "RX1 Digital Gain" and "RX7 Digital Gain" can be used to apply (digital) gain. Any number greater than 84 (which corresponds to 0 dB) does add gain in one dB increments and potentially audible distortion.

Another stage where you are potentially adding gain (and distortion) is when you mix left and right channels to play back on the main speaker, especially at the two top-most Android volume settings. Imagine you have an audio signal at "full-scale" arriving at the codec. Now imagine that left and right channel contain the same audio signal, which is not uncommon for sounds coming from dead-center in a stereo image. Mixing essentially adds them together, i.e. 32767+32767 which leads to a combined signal that is 6 dB beyond full-scale. For it to be played back it needs to be clipped at 32767, with the resulting distortions. I've generated a spectrum of this particular example (full-scale mixing) using a full-scale 100 Hz sine wave. Not pretty...

[IMG="Effects of signal clipping"]https://drive.google.com/thumbnail?id=0B7RMgh4cfbtsQklMbzVuaGlqZ1E&authuser=0&v=1462300814759&sz=w1416-h642[/IMG]

I'd wait until you or others find problems. Let's cross the bridge once we get there.

Welcome to development...;)
[Nexus 5X Themes and Apps] Jose-MXL:
[MENTION=2760454]chdloc[/MENTION]

First of all thanks a lot for the walkthrough. I appreciate it, I fully understand the issues when mixing and splitting channels. Software does horrible things to our precious media.

I have fixed some stuff (and working on filter testing) based on the recommendations that you provided.

The question to be made now, and that would most likely be the gate to continue development of this mod or not, is:

-When mixing channels to the main speaker, would there be a way to avoid distortion coming from frequencies summed up in amplitude?

-I.e. do I need to sink down a little bit the right channel where the left channel is not attenuated, in other words make a mirror of the filter to the left channel but on the right channel? This could prevent (in my imagination lol) amplitudes stacking up all the way to +6dB, see attached file.
[Nexus 5X Themes and Apps] aamadorj:
Thanks a lot for your work [MENTION=5940484]Jose-MXL[/MENTION].

I'm using your latest mod on my N5X running latest PureNexus and I really like the sound with this mod. I'm very far from expert on this matter, but according to my ears the sound quality is pretty good with music and system and apps sounds.

I'll try your next version, definitely.
[Nexus 5X Themes and Apps] chdloc:
I'm following my own recommendations to avoid any type of distortion like the plague only for headphone playback. Due to the small physical dimensions of the built-in loudspeakers some level of distortion cannot be avoided. It is just physics: a small diaphragm simply cannot move a sufficient amount of air to reproduce low frequencies at appreciable levels. It all depends on how much distortion you are willing to tolerate.

That being said, it is definitely a good idea to remove frequencies that a given loudspeaker cannot reproduce without significant distortion. This corner frequency is given by the loudspeaker's resonance frequency, typically spelled out in spec sheets. The resonance frequency can also be measured where the frequency response falls off sharply. For example, I filtered all frequencies below 300 Hz on my Nexus 5. Long story short: Don't worry about some level of distortion when dealing with smartphone loudspeakers.

One last point, I did notice that the filters you propose are extremely "modest". What I mean by modest is that the +/- 1.5 dB of the filter frequency response variation you designed probably don't make an appreciable difference.
[Nexus 5X Themes and Apps] peikojose:
Tried your new mod, works MUCH better...

Sound is deep! But if I raise it above 80% it starts to distorts.. Maybe 140% is too much? a 120% version I think would be better!
[Nexus 5X Themes and Apps] Jose-MXL:
[MENTION=4640470]peikojose[/MENTION] [MENTION=2280111]aaamador[/MENTION] [MENTION=2760454]chdloc[/MENTION]

Guys, thanks a lot for testing and positive feedback. I'm testing a new set of filters that are a bit more aggressive plus a few changes recommended by chdloc.

I'm working on it but it's a lengthy process to design a filter, apply it, test music, listen to other media and see how it reacts, etc.

I was busy today, got out of work late and my toddler hasn't given me a break in the whole evening and it's 10:32PM here already.

Long story short, I have a new version coming and it should be a significant improvement to distortion and not just an iterative change (at least for me, please don't skyrocket your expectations), and I need you guys to test it (when ready) and let me know how it reacted to your phones.

peikojose, I am well aware of your requests to lower the volume at earpiece a little bit to avoid distortion, so I'm doing a loud version and a stable version to try out.

I'm also going to start naming my files with a nomenclature to keep control of changes starting next version.
[Nexus 5X Themes and Apps] parthabhatta:
Great to see the audiophile discussions for betterment of sound. Will test the version with N.
[Nexus 5X Themes and Apps] poondog:
Hey guys, this is absolutely fascinating reading. Great to see this stuff, keep it up :)

Just wanted to let you know that your work isn't going unnoticed
[Nexus 5X Themes and Apps] gpvecchi:
When I worked in hi-fi sector, we used to make 12 dB/oct crossover at the double of resonance frequency to prevent clipping; I'd say that (to be safe) every speaker should be cut at the right frequency; then I'd lower the volume for principal speaker to match the level of the ear-plug one; total SPL should be around the same as stock, since you have 2 transductors...

Oh, one question: I usually rotate phone counterclockwise, so speaker result swapped. Do you flip this way?
[Nexus 5X Themes and Apps] coololly:
it says the zip files are corrupt in twrp. ive re downloaded them multiple times and still, it says they are corrupt
[Nexus 5X Themes and Apps] szucsgf:
Download from a PC and transfer it to your phone.
[Nexus 5X Themes and Apps] coololly:
Thanks. That worked
[Nexus 5X Themes and Apps] Jose-MXL:
TweetmodV2.1 changes/comments

- Users reported main speaker to be have too much gain and distortion before 90%. This isn't happening to my phone and/or use scenarios, but I created a V2.1 set of files with digital volume of 82 instead of the stock value of 84.

- Created 3 files again to test different volumes of earpiece.
[Nexus 5X Themes and Apps] CerB:
Thx, will test

Sendt fra min Nexus 5X med Tapatalk
[Nexus 5X Themes and Apps] suku_patel_22:
I am using the same v2.1_vol87 and quite like how it sounds for me