LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-23-2019, 07:48 PM   #1
jamesd1
LQ Newbie
 
Registered: May 2019
Posts: 24

Rep: Reputation: Disabled
How do I toggle the microphone with a command or with Autokey


How do I toggle the microphone with a keyboard short cut, a command or with Autokey

Desktop: MATE 1.20.1 Distro: Linux Mint 19.1 Tessa
 
Old 05-23-2019, 08:12 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

assuming that it is the first microphone and that you are using pulse audio
Code:
pactl set-source-mute 1 toggle
Run pavucontrol and look at the "Input Devices" tab, and also run "pactl subscribe" in another to confirm what is happening.

Cheers,

Evo2.
 
1 members found this post helpful.
Old 05-23-2019, 09:00 PM   #3
jamesd1
LQ Newbie
 
Registered: May 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
Under hardware/sound I found:
Choose a device for sound input:
© AK5370 I/F A/D Converter Analog Mono
©) Built-in Audio Analog Stereo

The above has a radio box that toggles the Microphone

--------------------------


pactl set-source-mute 1 toggle

nothing happend and no feedback and no toggle of microphone.


james@james-desktop:~$ pactl subscribe
Event 'change' on source-output #2224
Event 'remove' on source-output #2224
Event 'new' on source-output #2225
Event 'change' on source-output #2225
Event 'change' on source-output #2225
Event 'remove' on source-output #2225
Event 'new' on source-output #2226
Event 'change' on source-output #2226
Event 'change' on source-output #2226
Event 'remove' on source-output #2226
Event 'new' on source-output #2227
Event 'change' on source-output #2227
Event 'change' on source-output #2227
Event 'remove' on source-output #2227
Event 'new' on source-output #2228
Event 'change' on source-output #2228
Event 'change' on source-output #2228
Event 'remove' on source-output #2228
Event 'new' on source-output #2229
Event 'change' on source-output #2229
Event 'change' on source-output #2229
Event 'remove' on source-output #2229
Event 'new' on source-output #2230
Event 'change' on source-output #2230

Last edited by jamesd1; 05-23-2019 at 09:09 PM.
 
Old 05-23-2019, 09:24 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

qhat do you see from "pactl subscribe" when you toggle the microphone using pavucontrol (or some other gui tool)? You should see something like:
Code:
Event 'change' on source #1
I this case "1" is index for source (microphone). Presumably for you it is something else. Maybe 0, maybe 2 etc. Once you know that index you should be able to use:
Code:
pactl set-source-mute N toggle
Where N is the index for your microphone.

Evo2.
 
Old 05-23-2019, 09:34 PM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Do you mean like a hardware toggle? Cause many apps have built in toggles. Skype, mumble, and things have keys you can set to USE the microphone, otherwise it's muted. And probably settings to avoid the hassle as well. If it's not in use you can modprobe -r the module for the sound card. I have a headphone preamp for my output that has a mute (and mono) toggle button. In terms of microphones (external) you can just unplug them. The advantage of an XLR connection is that it doesn't pop when you plug/unplug it. Versus TRS that does pop. A lot of interfaces have gain knobs, not technically muted, but you can turn those down to inaudible levels.
 
Old 05-23-2019, 09:57 PM   #6
jamesd1
LQ Newbie
 
Registered: May 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
james@james-desktop:~$ pactl subscribe
Event 'change' on sink #0

but:

james@james-desktop:~$ pactl set-source-mute 0 toggle
james@james-desktop:~$

Gives no feedback and there is no change in microphone state.
 
Old 05-23-2019, 10:18 PM   #7
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hmm, strange.

Do you see anything change in "Input Devices" tab (with "All Input Devices" selected) in pavucontrol when you run "pactl set-source-mute 0 toggle"?

Evo2.
 
Old 05-23-2019, 10:37 PM   #8
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Just to confirm that evo2's command:

Code:
pactl set-source-mute 1 toggle
works perfectly in muting my internal microphone, tested by recording my voice in Audacity and running the command twice in the middle of the recording to mute my microphone and then unmute it again.

Mint 19.1 MATE.
 
Old 05-24-2019, 07:44 AM   #9
jamesd1
LQ Newbie
 
Registered: May 2019
Posts: 24

Original Poster
Rep: Reputation: Disabled
SOLVED

Not sure what I did wrong yesterday but this moring:

pactl set-source-mute 0 toggle

Worked to toggle my microphone.

Thanks.


Quote:
Originally Posted by hydrurga View Post
Just to confirm that evo2's command:

Code:
pactl set-source-mute 1 toggle
works perfectly in muting my internal microphone, tested by recording my voice in Audacity and running the command twice in the middle of the recording to mute my microphone and then unmute it again.

Mint 19.1 MATE.
 
Old 05-24-2019, 09:08 AM   #10
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by jamesd1 View Post
Not sure what I did wrong yesterday but this moring:

pactl set-source-mute 0 toggle

Worked to toggle my microphone.

Thanks.
Great to hear. You can also connect this command to a keystroke sequence:

Control Centre->Hardware->Keyboard Shortcuts->Add->Name:Toggle Microphone, Command: pactl set-source-mute 0 toggle->Apply.

Then click on "Disabled" beside the command & press Ctrl+Shift+Esc (or whichever key sequence you require).

Close that window and try it out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Automate your common tasks on Linux with AutoKey LXer Syndicated Linux News 0 08-20-2013 02:52 AM
LXer: Using Autokey Scripts to Automate Your Linux Desktop LXer Syndicated Linux News 0 05-12-2013 01:11 PM
LXer: Autokey: Make Your Own Keyboard Shortcuts In Linux LXer Syndicated Linux News 0 09-30-2010 02:30 AM
Autokey and current64 charlie_lab Slackware 4 03-20-2010 03:56 PM
LXer: Avoid Typing with Autokey LXer Syndicated Linux News 0 03-27-2009 05:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 08:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration