Earphone remote in sound jack as X inputWhere can I find the Linux driver for headphones in the kernel...
Not been paid even after reminding the Treasurer; what should I do?
Is an "are" omitted in this sentence
Why do proponents of guns oppose gun competency tests?
Why does putting a dot after the URL remove login information?
New workplace asking for bank pin and account number
Why should I "believe in" weak solutions to PDEs?
Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?
Can you take actions after being healed at 0hp?
How to realistically deal with a shield user?
How to sort List<T> in c#
…down the primrose path
What could prevent players from leaving an island?
Premier League simulation
How does LIDAR avoid getting confused in an environment being scanned by hundreds of other LIDAR?
Should I take out a personal loan to pay off credit card debt?
Changing Row Keys into Normal Rows
Purchased new computer from DELL with pre-installed Ubuntu. Won't boot. Should assume its an error from DELL?
Is there a way to say "double + any number" in German?
How important is it to have a spot meter on the light meter?
Non-small objects in categories
Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?
If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?
Write The Shortest Program To Check If A Binary Tree Is Balanced
Traveling from Germany to other countries by train?
Earphone remote in sound jack as X input
Where can I find the Linux driver for headphones in the kernel tree?External tablet input devices for Linux (Inkscape/Gimp)?Easy/simple input method package that works with minimal window manager?Disable Keyboard & Mouse input on unix (under X)barcode scanner input when running xorg and evdevDirecting Xorg input to selected applicationinput, evdev alternatives?Make X11 react on “dev/input/eventx”?setting up Xorg input devices without udevWhy are there two entries per device on /dev/input/by-pathDirectly play input sound (Mint)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have got new earphones, the AKG K318's to be exact and they have one of those remotes. On a smartphone, such as an Android phone or iPhone, the buttons map to actions on the music player such as play/pause, volume up/down, skip, previous, you get the idea.
I was wondering how I could replicate the same function on my computer.
I imagine the process consists of getting X to recognize the input, and then somehow mapping those inputs for an application to use.
The "device" (which would connect via sound jack) isn't listed in xinput
, nor do the buttons trigger regular keyboard events.
How can I use the earphones plugged in the output sound jack as X key inputs?
xorg input input-method
add a comment |
I have got new earphones, the AKG K318's to be exact and they have one of those remotes. On a smartphone, such as an Android phone or iPhone, the buttons map to actions on the music player such as play/pause, volume up/down, skip, previous, you get the idea.
I was wondering how I could replicate the same function on my computer.
I imagine the process consists of getting X to recognize the input, and then somehow mapping those inputs for an application to use.
The "device" (which would connect via sound jack) isn't listed in xinput
, nor do the buttons trigger regular keyboard events.
How can I use the earphones plugged in the output sound jack as X key inputs?
xorg input input-method
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
1
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03
add a comment |
I have got new earphones, the AKG K318's to be exact and they have one of those remotes. On a smartphone, such as an Android phone or iPhone, the buttons map to actions on the music player such as play/pause, volume up/down, skip, previous, you get the idea.
I was wondering how I could replicate the same function on my computer.
I imagine the process consists of getting X to recognize the input, and then somehow mapping those inputs for an application to use.
The "device" (which would connect via sound jack) isn't listed in xinput
, nor do the buttons trigger regular keyboard events.
How can I use the earphones plugged in the output sound jack as X key inputs?
xorg input input-method
I have got new earphones, the AKG K318's to be exact and they have one of those remotes. On a smartphone, such as an Android phone or iPhone, the buttons map to actions on the music player such as play/pause, volume up/down, skip, previous, you get the idea.
I was wondering how I could replicate the same function on my computer.
I imagine the process consists of getting X to recognize the input, and then somehow mapping those inputs for an application to use.
The "device" (which would connect via sound jack) isn't listed in xinput
, nor do the buttons trigger regular keyboard events.
How can I use the earphones plugged in the output sound jack as X key inputs?
xorg input input-method
xorg input input-method
asked Jun 29 '12 at 17:04
jonallardjonallard
6863 gold badges8 silver badges13 bronze badges
6863 gold badges8 silver badges13 bronze badges
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
1
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03
add a comment |
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
1
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
1
1
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03
add a comment |
3 Answers
3
active
oldest
votes
Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.
The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).
Four buttons might use four resistances (of any unit):
volume up: 1 ohm
volume down: 2 ohms
stop: 4 ohms
play: 8 ohms
If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!
Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.
But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
|
show 1 more comment
There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.
add a comment |
Not a solution for everyone, but my earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven't tried screaming!). Looking around the internet, I came up with the following solution using sox's rec
:
#!/usr/bin/sh
while true; do
rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && playerctl play-pause
done
playerctl
is a program that controls media playback. The .5
in the code indicates the mic pol resolution. You can play around with this value if you want to implement double tapping. 0.89
indicates the threshold for the button being pushed. (mine is basically equal to 1 when pushed)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f41954%2fearphone-remote-in-sound-jack-as-x-input%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.
The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).
Four buttons might use four resistances (of any unit):
volume up: 1 ohm
volume down: 2 ohms
stop: 4 ohms
play: 8 ohms
If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!
Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.
But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
|
show 1 more comment
Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.
The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).
Four buttons might use four resistances (of any unit):
volume up: 1 ohm
volume down: 2 ohms
stop: 4 ohms
play: 8 ohms
If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!
Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.
But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
|
show 1 more comment
Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.
The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).
Four buttons might use four resistances (of any unit):
volume up: 1 ohm
volume down: 2 ohms
stop: 4 ohms
play: 8 ohms
If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!
Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.
But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)
Those 'special' headphones or earphones which can be used on specialized devices to control media players, volume and mute usually have FOUR connections on the plug, versus the typical THREE a normal headphone output jack has.
The usual three are Left Channel, Right Channel and Ground (common), while the fourth is often set up as a multi-value resistance, each button when pressed presents a particular resistance on the fourth wire (+ ground), which the media device can sense and from that determine what function is needed. Pretty slick method of getting several buttons to work off one wire without resorting to expensive digital signal generators and stuff (all packed in that little blob on the wires!).
Four buttons might use four resistances (of any unit):
volume up: 1 ohm
volume down: 2 ohms
stop: 4 ohms
play: 8 ohms
If this looks suspiciously like a binary encoding scheme... it is!! (You're so smart!!) Using values similarly ratio'd, you can sense 16 different outputs, even handling multiple keys pressed at the same time. Taa Daa!
Old people might remember the first iPods, which had a little 4connector jack next to the audio out plug, which many devices plugged into alongside their audio plug which enabled control signals to be sent back and forth. This was phased out in favor of the (imho cooler!) fourth wire system... standard headphones will work as expected, and headphones set up to interface with the fourth wire method are accepted too.
But to answer your question (finally!!)... no, there is no 'standard' way to enable the functionality you're looking for. Bluetooth headsets would be your best solution. (mine are COOL!)
answered Jun 30 '12 at 8:17
lornixlornix
3,04213 silver badges25 bronze badges
3,04213 silver badges25 bronze badges
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
|
show 1 more comment
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
8
8
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
and yes, I take ALL my toys apart...
– lornix
Jun 30 '12 at 8:21
5
5
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
"... even handling multiple keys pressed at the same time." Except that it doesn't follow the binary scheme at that point, e.g. pressing play and Vdown gives (8*2)/(8+2) or 1.6 ohms.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:14
2
2
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
There will be 16 different values, not necessarily in an ascending or descending value... the various values can be sensed. It's only 'binary' in the sense that it's a matrix of 4 buttons with either on/off positions. Nice to know someone is checking on me.
– lornix
Jun 30 '12 at 9:23
1
1
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
Just keeping answers honest is all.
– Ignacio Vazquez-Abrams
Jun 30 '12 at 9:24
1
1
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
If you're "lucky" enough to have a notebook/netbook with a combined headphone and mic jack then it might be possible to write a script that listens for the different noise patterns on the incoming mic signal that each button press produces, and react appropriately to them.
– Poundex
Jul 1 '12 at 22:59
|
show 1 more comment
There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.
add a comment |
There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.
add a comment |
There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.
There is currently no standardized way to use your wired headset as input with Linux as far as i know. This means you won't be able to use your headset to control your music player - Bluetooth headsets on the other should work out of the box.
answered Jun 29 '12 at 19:03
Ulrich DangelUlrich Dangel
21.2k2 gold badges61 silver badges72 bronze badges
21.2k2 gold badges61 silver badges72 bronze badges
add a comment |
add a comment |
Not a solution for everyone, but my earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven't tried screaming!). Looking around the internet, I came up with the following solution using sox's rec
:
#!/usr/bin/sh
while true; do
rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && playerctl play-pause
done
playerctl
is a program that controls media playback. The .5
in the code indicates the mic pol resolution. You can play around with this value if you want to implement double tapping. 0.89
indicates the threshold for the button being pushed. (mine is basically equal to 1 when pushed)
add a comment |
Not a solution for everyone, but my earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven't tried screaming!). Looking around the internet, I came up with the following solution using sox's rec
:
#!/usr/bin/sh
while true; do
rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && playerctl play-pause
done
playerctl
is a program that controls media playback. The .5
in the code indicates the mic pol resolution. You can play around with this value if you want to implement double tapping. 0.89
indicates the threshold for the button being pushed. (mine is basically equal to 1 when pushed)
add a comment |
Not a solution for everyone, but my earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven't tried screaming!). Looking around the internet, I came up with the following solution using sox's rec
:
#!/usr/bin/sh
while true; do
rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && playerctl play-pause
done
playerctl
is a program that controls media playback. The .5
in the code indicates the mic pol resolution. You can play around with this value if you want to implement double tapping. 0.89
indicates the threshold for the button being pushed. (mine is basically equal to 1 when pushed)
Not a solution for everyone, but my earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven't tried screaming!). Looking around the internet, I came up with the following solution using sox's rec
:
#!/usr/bin/sh
while true; do
rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && playerctl play-pause
done
playerctl
is a program that controls media playback. The .5
in the code indicates the mic pol resolution. You can play around with this value if you want to implement double tapping. 0.89
indicates the threshold for the button being pushed. (mine is basically equal to 1 when pushed)
answered 1 hour ago
rien333rien333
3071 silver badge14 bronze badges
3071 silver badge14 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f41954%2fearphone-remote-in-sound-jack-as-x-input%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
possible duplicate of Where can I find the Linux driver for headphones in the kernel tree?
– Ignacio Vazquez-Abrams
Jun 29 '12 at 17:11
1
Is the accepted answer ("can't be done") still correct, 3 years on? My Bose headphones come with different cables for iPhone and for Android (specifically Samsung); I have the Android cable, and wondering if I can get it to work with Linux.
– Darren Cook
May 22 '15 at 20:35
My feeling is that this is more of a feature request and the functionality is unsupported for the moment.
– jonallard
May 26 '15 at 19:03