In this article, we are going to get the List ID and index of the microphones attached to the system. One should have knowledge about microphone ID while dealing with microphones in the Python programs. So in order to get the list of microphones attached to the system we need the following Libraries.
- SpeechRecognition: This module does not comes built-in with Python. There are two ways to install this module.
1) Type the below command in the terminal.
pip install SpeechRecognition
2) Download resources from PyPI and extract it in a folder and then run following command in cmd or terminal.
python setup.py install
1) Windows: Run the following command in the CMD.
pip install pyaudio
2) Linux: Run the following command in the terminal.
sudo apt-get install python-pyaudio python3-pyaudio
Listing all the microphones connected
First of all import speechrecognition instance as ‘sr’
import speech_recognition as sr
list_microphone_names() method will return a array/list of the connected microphones to the system.
[‘HDA Intel PCH: ALC255 Analog (hw:0, 0)’, ‘HDA Intel PCH: HDMI 0 (hw:0, 3)’, ‘HDA Intel PCH: HDMI 1 (hw:0, 7)’, ‘HDA Intel PCH: HDMI 2 (hw:0, 8)’, ‘HDA Intel PCH: HDMI 3 (hw:0, 9)’, ‘HDA Intel PCH: HDMI 4 (hw:0, 10)’, ‘sysdefault’, ‘front’, ‘surround40’, ‘surround51’, ‘surround71’, ‘hdmi’, ‘pulse’, ‘dmix’, ‘default’]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Audio processing using Pydub and Google speechRecognition API
- Introduction and Installation of Uberi/Speechrecognition in Python
- Python - Getting all the Wifi Devices the system has connected
- PyQt5 QCalendarWidget - Mapping Co-ordinate system to Calendar co-ordinate system
- PyQt5 QCalendarWidget - Mapping co-ordinate system from Calendar co-ordinate system
- Python | Convert list of string to list of list
- Python | Convert list of tuples to list of list
- Python | Convert List of String List to String List
- Python | Remove all values from a list present in other list
- Sort the values of first list using second list in Python
- Python | Update a list of tuples using another list
- Python | System hardening and compliance reports using Lynis
- Python - Get Hardware and System information using platform module
- Move all zeroes to end of array using List Comprehension in Python
- Python List Comprehension | Segregate 0's and 1's in an array list
- Python | Pair and combine nested list to tuple list
- Python program to create a list of tuples from given list having number and its cube in each tuple
- Python | Convert list of strings and characters to list of characters
- Python | Ways to sum list of lists and return sum list
- Get Your System Information - Using Python Script
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.