I need to get some numbers so I can generate random numbers using ambient sound.
I want something on this level pseudo code:
import microphone
p = pitch.get()
print p
Edit:
This is in Windows 7, BTW
Let’s get started. To work with the microphone or audio input device in your Python program, you have to enter the device name or index to specify which device you want to use. To find the mic device attached to your computer you will need to have the following packages installed on your python.
To know your device index follow the tutorial: Find all the microphone names and device index in Python using PyAudio To recognize input from the microphone you have to use a recognizer class. Let’s just create one. So our program will be like this till now:
Take voice input from the user in Python using PyAudio – speech_recognizer. What we gonna do in simple steps: Take input from the mic. Convert the voice or speech to text. Store the text in a variable/or you can directly take it as user input.
For windows, we have PyAudio and there is also a library called SoundAnalyse. I found an example for Linux here: #!/usr/bin/python ## This is an example of a simple sound capture script.
Depends on the platform. On Windows, this SO question has some answers; for Linux, try this one instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With