10

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.

John La Rooy
  • 281,034
  • 50
  • 354
  • 495
UnkwnTech
  • 83,811
  • 65
  • 181
  • 226

3 Answers3

17

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.

Jeffrey Martinez
  • 4,224
  • 2
  • 29
  • 36
  • 1
    "Note that PyAudio currently only supports blocking-mode audio I/O. PyAudio is still super-duper alpha quality." from website – Dustin Getz Jul 23 '09 at 18:20
4

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.

Serafina Brocious
  • 30,005
  • 11
  • 87
  • 112
  • 3
    Do you think you can provide some sample code for this? I can call mixerGetNumDevs but i'm not sure how to get from there to mixerOpen or for reading levels. TIA – Jared Apr 10 '09 at 04:51
2

You might try SWMixer.

Bill Barksdale
  • 2,456
  • 1
  • 14
  • 6