RosettaCodeData/Task/Record-sound/Python/record-sound.py

18 lines
332 B
Python
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
import pyaudio
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
p = pyaudio.PyAudio()
stream = p.open(format = FORMAT,
channels = CHANNELS,
rate = RATE,
input = True,
frames_per_buffer = chunk)
data = stream.read(chunk)
print [ord(i) for i in data]