Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microphone access in Python

Can I access a users microphone in Python?

Sorry I forgot not everyone is a mind reader: Windows at minimum XP but Vista support would be VERY good.

like image 316
UnkwnTech Avatar asked Oct 11 '08 07:10

UnkwnTech


People also ask

How do I get voice input from user in Python?

Recognition of Spoken Words Google-Speech-API − It can be installed by using the command pip install google-api-python-client. Pyaudio − It can be installed by using pip install Pyaudio command. SpeechRecognition − This package can be installed by using pip install SpeechRecognition.

How do I mute my mic in Python?

The way 0x180000 is generated is by doing (0xFFFF + 1) * 24 . So for all the keycodes there you must do (0xFFFF + 1) * keycode to get that number. For some reason the win32 devs believe mute means toggle. This happens also with APPCOMMAND_VOLUME_MUTE which toggles sound instead of muting.


3 Answers

I got the job done with pyaudio

It comes with a binary installer for windows and there's even an example on how to record through the microphone and save to a wave file. Nice! I used it on Windows XP, not sure how it will do on Vista though, sorry.

like image 118
Jeffrey Martinez Avatar answered Oct 18 '22 12:10

Jeffrey Martinez


Best way to go about it would be to use the ctypes library and use WinMM from that. mixerOpen will open a microphone device and you can read the data easily from there. Should be very straightforward.

like image 21
Serafina Brocious Avatar answered Oct 18 '22 14:10

Serafina Brocious


You might try SWMixer.

like image 31
Bill Barksdale Avatar answered Oct 18 '22 12:10

Bill Barksdale