Hi,

I want to record some audio on my laptop, but I can't get it to work,
What am I doing wrong here.

Thanks in advance

Dexter.

import ossaudiodev
> import wave
>
>
> SAMPLE_RATE = 8000
> SAMPLE_WIDTH = 2
> BLOCK_TIME = 5
>
>
> mic = ossaudiodev.open('r') # open a mic
> f = wave.open("sound.wav", "w") # open a wave file
>
> mic.setfmt(ossaudiodev.AFMT_S16_LE)
> mic.channels(1)
> mic.speed(SAMPLE_RATE)
>
>
> f.setparams((1, SAMPLE_WIDTH, SAMPLE_RATE, SAMPLE_RATE*BLOCK_TIME, "NONE",
> "NONE")) #(nchannels, sampwidth, framerate, nframes, comptype, compname)
>
> block = mic.read(SAMPLE_RATE*BLOCK_TIME*SAMPLE_WIDTH)
> mic.close()
>
> print set(block)
>
> f.writeframes(block)
> f.close()
>
_______________________________________________
Python-nl mailing list
Python-nl@python.org
http://mail.python.org/mailman/listinfo/python-nl

Antwoord per e-mail aan