Record sound: Difference between revisions

From Rosetta Code
Content deleted Content added
Created page with "{{task}} Record sound (mono 16-bit PCM) into an integer array. =={{header|Python}}== <lang python>import pyaudio chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 4410..."
 
Line 10:
CHANNELS = 1
RATE = 44100
 
p = pyaudio.PyAudio()
 
stream = p.open(format = FORMAT,

Revision as of 01:38, 30 December 2010

Task
Record sound
You are encouraged to solve this task according to the task description, using any language you may know.

Record sound (mono 16-bit PCM) into an integer array.

Python

<lang python>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]</lang>