Author Topic: speakers out of phase?  (Read 7384 times)

zevv

  • Newbie
  • *
  • Posts: 45
    • View Profile
speakers out of phase?
« Reply #15 on: July 19, 2018, 10:16:35 am »
Quote from: Anonymous_
zevv: does this mean L and R channels get separated with your fix? As before L channel has been played in both speakers as well as R channel.

No, it merely corrects the phase of the speakers.

I must admit that I was not aware that only the left channel was played. The fact that I'm able to flip the phase of one output indicates that the hardware is actually able to play stereo, so if only one channel ends up in the driver there must be a software issue somewhere down the line. I'll see if I can find some time to investigate.

zevv

  • Newbie
  • *
  • Posts: 45
    • View Profile
speakers out of phase?
« Reply #16 on: July 19, 2018, 03:32:44 pm »
No, still mono. It seems that at the driver and alsa level the device is perfectly capable of playing stereo sound. Both left and right channels are mixed to mono.

In logcat there are some messages coming up when switching from headphones to speaker indicating this is a deliberate action:

07-19 20:27:16.946   482   838 D AudioFlinger_Threads: SetStereoToMonoFlag, mSteroToMono 1

This is a likely leftover from the original design the Gemini is based on which probably had a single speaker, in which case mixing to mono makes sense.

(Note the typo in there, it says 'Stero' instead of 'Stereo', likely this happens somewhere in propriatary MT code)

There is nothing I can do about this on the kernel level I'm afraid. I found some audio configuration in /system/etc/audio_policy_configuration.xml where the various audio channels are configured, but everything seems to be setup ok here. I'm not sure where to go from here, I have no experience at all going deeper into Android...
« Last Edit: July 19, 2018, 03:35:08 pm by zevv »

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3686
    • View Profile
speakers out of phase?
« Reply #17 on: July 19, 2018, 04:48:01 pm »
Thanks zevv for the analysis, very useful.

I was just pondering why we get crackling on headphones but not the speakers.
Surely Planet tested the headphone jack? Did they change the analogue design very late?
I'm sure they must have contemplated stereo speakers, did they switch to mono so you can use the G either way round?

This is when having a schematic circuit diagram would really help.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3686
    • View Profile
speakers out of phase?
« Reply #18 on: August 23, 2018, 05:34:12 pm »
given it's possible to build, and indeed people have, kernels for Debian, do you think we can at least have sound fixed when running linux and not using the Planet-built kernel?
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

zevv

  • Newbie
  • *
  • Posts: 45
    • View Profile
speakers out of phase?
« Reply #19 on: August 26, 2018, 06:47:51 am »
Quote from: speculatrix
given it's possible to build, and indeed people have, kernels for Debian, do you think we can at least have sound fixed when running linux and not using the Planet-built kernel?

Here is an Android kernel: https://github.com/zevv/gemini-android-kern...nux_boot-v1.img

This is a build of the stock Gemini kernel from Planet with two fixes: audio phase and keyboard ghosting. You could ask the Gemini maintainers if they are willing to pull in the speaker fix patch into the Debian kernel as well?

I've been running this for about a month without problems.
« Last Edit: August 26, 2018, 06:50:08 am by zevv »

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3686
    • View Profile
speakers out of phase?
« Reply #20 on: August 26, 2018, 07:14:34 am »
Quote from: zevv
Quote from: speculatrix
given it's possible to build, and indeed people have, kernels for Debian, do you think we can at least have sound fixed when running linux and not using the Planet-built kernel?

Here is an Android kernel: https://github.com/zevv/gemini-android-kern...nux_boot-v1.img

This is a build of the stock Gemini kernel from Planet with two fixes: audio phase and keyboard ghosting. You could ask the Gemini maintainers if they are willing to pull in the speaker fix patch into the Debian kernel as well?

I've been running this for about a month without problems.


cool! does it flip the phase only on speaker?
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

zevv

  • Newbie
  • *
  • Posts: 45
    • View Profile
speakers out of phase?
« Reply #21 on: August 27, 2018, 08:45:22 am »
Quote from: speculatrix
cool! does it flip the phase only on speaker?

Yes, it peeks into the accessory state and only fixes the phase when no headset is attached.

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3686
    • View Profile
speakers out of phase?
« Reply #22 on: September 19, 2018, 03:34:37 am »
Is it possible to produce a similarly patched kernel for android?

Thanks!
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

mithrandir

  • Full Member
  • ***
  • Posts: 180
    • View Profile
    • http://www.mygnu.de
speakers out of phase?
« Reply #23 on: September 21, 2018, 04:29:23 pm »
@zevv: Thanks for the fix. Would you mind to create a pull request for this fix like you did for the keyboard ghosting? For a short moment I have been thinking about creating the request myself, but then I have been unsure if this were "politically correct".  I think it would be nice to see the fix upstream (debian+android). Or do you have any doubts why it should not get merged?

mith
« Last Edit: September 21, 2018, 04:29:54 pm by mithrandir »

gymbo

  • Full Member
  • ***
  • Posts: 221
    • View Profile
speakers out of phase?
« Reply #24 on: October 05, 2018, 01:39:59 pm »
Quote from: zevv
Quote from: speculatrix
cool! does it flip the phase only on speaker?

Yes, it peeks into the accessory state and only fixes the phase when no headset is attached.
Don't know if it could be any help (and I must admit I haven't figured out how to configure it either, don't really use the speakers on the Gemini a lot...), but apparently Neutron (a music player) has a gotten a setting for phase switching...

So could be possible to get the music to play "correctly"? But you would have to change it every time going from headphones to speaker-mode... (and vice-versa).

covex

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • http://
speakers out of phase?
« Reply #25 on: October 13, 2018, 04:22:29 pm »
Quote from: gymbo
Quote from: zevv
Quote from: speculatrix
cool! does it flip the phase only on speaker?

Yes, it peeks into the accessory state and only fixes the phase when no headset is attached.
Don't know if it could be any help (and I must admit I haven't figured out how to configure it either, don't really use the speakers on the Gemini a lot...), but apparently Neutron (a music player) has a gotten a setting for phase switching...

So could be possible to get the music to play "correctly"? But you would have to change it every time going from headphones to speaker-mode... (and vice-versa).

I am new to gemini having a unit build cca 05/2018 with latest android and the sound is for sure stereo - tested with some stereo test videos on youtube. Not sure about the phase.
Gemini PDA 4G, MTK Helio x27, keyboard layout CZ, Gemini-7.1-Planet-08102018-V2

Daniel W

  • Full Member
  • ***
  • Posts: 246
    • View Profile
speakers out of phase?
« Reply #26 on: January 10, 2020, 01:00:25 pm »
Quote from: covex
I am new to gemini having a unit build cca 05/2018 with latest android and the sound is for sure stereo - tested with some stereo test videos on youtube. Not sure about the phase.
I know this is an old topic, but it seems to still be a valid concern, perhaps also for the Cosmo (still haven't got mine). My Gemini is an older x25 unit, but the speaker hardware should be identical. Below are two test tones I made. Beyond making the files about 35 times smaller, the heavy mp3-compression shouldn't affected them in any way that matters for these purposes. Btw. why does this forum still not support the FOSS formats Ogg Vorbis (from 2002) or Opus (from 2012)?

This is a 10-second in phase ~523Hz (C5) stereo sine wave at ~-6dBFS.
 [ You are not allowed to view attachments ] In an audio editor, both the left and right channel should look the same (except minor mp3 damage).
Via correctly wired speakers, it appears to come from a point between my speakers.
Via correctly wired headphones, the sound appears to be inside the center of my head, much like a mono file.

This is a 10-second out of phase ~523Hz (C5) stereo sine wave at ~-6dBFS.
 [ You are not allowed to view attachments ] In an audio editor, each channel should look like the other flipped upside down (plus minor mp3 damage).
Via correctly wired speakers, it sounds more like coming from each of my speakers.
Due to cancellation, it appears quieter than the in-phase file, when played at the same volume.
The volume may also appear to change more when moving my head, compared to the in-phase file.
Via correctly wired headphones, it sounds more as if I had one sound source on each side of my head.
(cancellation only happens via speakers, as the two sounds needs to physically interact in the air).

On my Gemini, when using the built-in speakers, my experience is other way around.
To me, on the built-in speakers, the apparent volume difference is very noticeable. I'd guess the short distance between them "helps" cancellation. But it's the in-phase file that sounds quieter, which suggests the speakers themselves are out of phase.
« Last Edit: January 10, 2020, 01:02:28 pm by Daniel W »

Pete G.

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • http://www.GoodeveCA.net
speakers out of phase?
« Reply #27 on: January 17, 2020, 09:55:58 pm »
Quote from: Daniel W
Quote from: covex
I am new to gemini having a unit build cca 05/2018 with latest android and the sound is for sure stereo - tested with some stereo test videos on youtube. Not sure about the phase.
I know this is an old topic, but it seems to still be a valid concern, perhaps also for the Cosmo (still haven't got mine). My Gemini is an older x25 unit, but the speaker hardware should be identical. Below are two test tones I made.

On my Gemini, when using the built-in speakers, my experience is other way around.
To me, on the built-in speakers, the apparent volume difference is very noticeable. I'd guess the short distance between them "helps" cancellation. But it's the in-phase file that sounds quieter, which suggests the speakers themselves are out of phase.

Have to admit, after reading this thread, and doing my own tests, I'm pretty confused!  I've never updated my Android, and my speakers seem to be solidly mono.  (I had never looked into this before)  I made my own test audio files (as I have Csound handy) -- 440Hz, one in phase and one inverted.  The in-phase one sounds normal; the inverted one is completely silent!  Indicating that the channels are added before passing to  the speakers as mono.  I made a third file that does first one channel then the other, and you can't hear the switch through the speakers.

Earbuds -- both via the jack and Blutooth ones -- have proper stereo that seems to be in proper phasing.

So is it later versions of  the OS that actually have stereo speakers?  (Not sure I'm concerned.  I expect I'll always use earbuds (Bluetooth ones new for Christmas! )   when sound is important.)

Daniel W

  • Full Member
  • ***
  • Posts: 246
    • View Profile
speakers out of phase?
« Reply #28 on: January 21, 2020, 05:44:20 pm »
Quote from: Pete G.
So is it later versions of  the OS that actually have stereo speakers?
If I remember correctly, yes. My Gemini is on Android 8.1.

Well, the physical speakers were, technically speaking, of course, stereo, even with older firmwares, but the two channels were summed to mono and the played through both speakers. I seem to recall this was a remnant from a prototype that had only one speaker, in which such summing made sense. Not sure though, why the second speaker, once added, ended up having the wrong polarity.
« Last Edit: January 21, 2020, 05:53:12 pm by Daniel W »