Created
November 5, 2015 22:12
-
-
Save Uberi/4bb42f0b9fd6251984e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyaudio, audioop | |
CHANNELS = 2 | |
RATE = 44100 | |
CHUNK = 4096 | |
FORMAT = pyaudio.paInt16 | |
p = pyaudio.PyAudio() | |
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) | |
sample_size = pyaudio.get_sample_size(FORMAT) | |
try: | |
while True: | |
buffer = stream.read(CHUNK) | |
left_frames, right_frames = audioop.tomono(buffer, sample_size, 1, 0), audioop.tomono(buffer, sample_size, 0, 1) | |
except KeyboardInterrupt: pass | |
stream.stop_stream() | |
stream.close() | |
p.terminate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is giving nothing result with this script if interrupt occurred with specified speech word like "xioan" then can i call my other script.
the out put shows bellow.