AndroidMediaControlsWindows icon indicating copy to clipboard operation
AndroidMediaControlsWindows copied to clipboard

Add support for B-D buttons

Open vmikhav opened this issue 7 years ago • 6 comments
trafficstars

  • [ ] Experimentally determine the amplitude of the signal when you press buttons B-D.
  • [ ] Add the definition of the receipt of a signal of such amplitude on the audio input.
  • [ ] Add event handlers for additional buttons.

Headset circuit

vmikhav avatar Jul 16 '18 15:07 vmikhav

Yup, was looking up how to have button support on pc/laptop. It worked on my bluetooth headset (although I can't do it when task manager is on for some reason), but it didn't work on my wired headset. Button is still recorded as sound, I think this has something to do with it.

ghost avatar Sep 30 '20 03:09 ghost

This is not possible by hardware. Although resistors between the buttons are different, the effect showed on waveform will be almost the same - pressing buttons cause unusually huge voltage difference compared to normal voice while our pc is designed to process normal voice only.

PaperStrike avatar Feb 05 '21 16:02 PaperStrike

Pretty sure it is indeed not possible to detect the different buttons using only the signal amplitude, but since I am not an electronics guy I am keeping this open until someone can give a good explanation why it is not. 🙂

roligheten avatar Feb 05 '21 17:02 roligheten

Somehow I found a distinguishable difference between normal voice and each buttons by the signal amplitudes today. 😅 What I said yesterday seems wrong.

By comparing the two channel of the mic, and draw a x-y graph: (Software I used here: Soundcard Oscilloscope)

  • the normal voice's graph is always like a y = x curve: (I have tried my best to make it bold, but it never reach -0.045 on the left.)

    Button0

While, each button's graph adds interference to the y = x with different amplitude. you may pay attention to the y-axis, especially values range [-0.045, -0.02].

  1. Button A's graph:

    ButtonA

  2. Button B's graph:

    ButtonB

  3. Button C's graph: (always above -0.045 on the left. I stress this to prove it is distinguishable from the normal voice.)

    ButtonC

My headset doesn't have a Button D. But I guess its graph is between Button A and B's, since its impedance is between theirs.

I'm not an expert in programming, hope these information does some help.

PaperStrike avatar Feb 06 '21 07:02 PaperStrike

Another finding by comparing the two channel of the mic: now we can easily tell a long press! 🎉

If we keep pressing a button, its graph would be like a ball:

ButtonPressing

We may check the the two channel continuously, counting the result of channel2 - channel1, and once the result becomes larger than a threshold, we can tell the press has start. when the absolute value of the result reach below the threshold for some time, the press has end. The largest result can tell which button is pressed, the duration can tell if it's a long press!

PaperStrike avatar Feb 06 '21 08:02 PaperStrike

@PaperFlu That's really cool! I haven't had time to look into this in detail but I will try to investigate it myself when I have time.

roligheten avatar Feb 08 '21 21:02 roligheten