Closed jgvictores closed 2 years ago
Better:
amixer -c 1 sset Mic nocap
amixer -c 1 sset Mic cap
Ref:
I've been checking this lines but it doesn't work. When I put this line, it shows:
amixer: Unable to find simple control 'Mic',0
So, I've tried to put my control, checking first with amixer scontrols
Simple mixer control 'IEC958',0
but it doesn't recognize nocap
or cap
command:
amixer: Invalid command!
Other option is using alsamixer
but as indicated in this discussion it's not working when we try to muting/turning down the mic. The only way that I found for mute it is changing the Input Source
to another that is not connected (for example Rear Mic
)
Okay, maybe this is pretty platform-specific and on future comments we should document on which system (PC, distro, version) each specific command was working. :sweat_smile:
From tiago-main t1-barcelona-microphone
branch:
res = system ("amixer -c 1 sset Mic cap");
cout << "--Microphone ON--" << endl;
while (!speechRecognitionPort.read(bot, false));
res = system ("amixer -c 1 sset Mic nocap");
cout << "--Microphone OFF--" << endl;
Project https://github.com/larsimmisch/pyalsaaudio looks interesting for speechRecognition.py
. Can be installed easily:
sudo apt install libasound2-dev
pip install pyalsaaudio --user
And run example mixertest.py
.
Possible idea for mute the microphone:
* [terminal 1] speechRecognition.py
* [terminal 2] yarp rpc /speechRecognition/rpc:s
>> setMic mute
>> setMic unmute
using this port allow us to mute the microphone running the demostration (follow-me, waiter...) when it is necessary, e.g when the robot is speaking or doing some action and we want to avoid the noise.
implemented and working at (#18)
ToDo: to adapt the demostrations with this functionality (follow-me and teo-waiter)
Problem fixed and interesting to document: I've been installing the bluetooth microphone and I found some problems to see the device once it was paired in sound settings->input.
In that case, I put this command: sudo -H pactl load-module module-bluetooth-discover
trying to load the pulseaudio module. If you see this error:
Failure: Module initialization failed
Solution:
sudo apt-get install pulseaudio-module-bluetooth
summary to do:
teo-head
to use microphone bluetoothpyalsaaudio
packets
- [ ] Prepare
teo-head
to use microphone bluetooth
At this point, I found that teo-head
include a internal bluetooth receiver. This is recognized and automatically activated by the O.S but it has a very poor coverage. So, I want to add the usb-bluetooth
. I need to know how to disable the internal bluetooth and enable only the usb-bluetooth
detection.
To show a list of this devices:
rfkill list all
- [x] Prepare
teo-head
to use microphone bluetoothAt this point, I found that
teo-head
include a internal bluetooth receiver. This is recognized and automatically activated by the O.S but it has a very poor coverage. So, I want to add theusb-bluetooth
. I need to know how to disable the internal bluetooth and enable only theusb-bluetooth
detection.
I resolved this problem. I'll put here the steps:
lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 046a:0010 Cherry GmbH SmartBoard XX44
Bus 003 Device 003: ID 8087:07da Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
sudo nano /etc/udev/rules.d/81-bluetooth-hci.rules
and pasting this
SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="07da", ATTR{authorized}="0"
Save, exit nano and reboot
Once all the above is done, a new error found... it shows:
sudo -H pactl load-module module-bluetooth-discover
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
No input sound device found :(
- [x] Prepare demostrations to use mute/unmute functionality
Here we've a limitation. We can mute or unmute the microphone by software automatically, sending the demonstration commands to speechRecognition
when the robot is speaking or in a moments when we know for sure we're not going to talk. But, the problem here is what happen when the robot is waiting for an order and at the same time is doing something.
E.g: Teo is following you but it's checking all the time if you are going to say "stop". Here, we can take the option to mute all the time the microphone, but we can't stop him by command voice. If we don't mute the microphone, Teo will receive to much noise and false orders.
At this point, any possible idea of how to resolve that with the work done ?
One thing I can come up with are acknowledgements. That is, make TEO send an Are you sure? notice back to you, and await confirmation. Is it feasible in your demo workflow?
One thing I can come up with are acknowledgements. That is, make TEO send an Are you sure? notice back to you, and await confirmation. Is it feasible in your demo workflow?
Yes, it's feasible but in practice, Teo would be all the time trying to await confirmation or receiving wrong inputs.
Other possible idea is to filter the noise with greater concatenation of words: E.g please stop TEO
instead of stop
but I want to get a solution to avoid modifying the dictionaries...
Note: to restart audio devices sudo /etc/init.d/pulseaudio restart
@rsantos88 What should be do with this issue?
Another take on this through Python's sounddevice package: 2dd945939c7142d374912b4a5a5dee130724872c.
Research on muting microphone. Several Python multiplatform solutions, but right now need c++ on Ubuntu. Here are some references. I believe we are using ALSA, not pulseaudio, so will check first option.