cogpy.Microphone()
Handler class for dealing with Microphone I/O.
record( path, duration )
Uses the computer's active microphone to record an audio sample of specified duration to the given path.
The following formats are accepted: 8svx, aif, aifc, aiff, aiffc, al, amb, au, avr, cdda, cdr, cvs, cvsd, cvu,
dat, dvms, f32, f4, f64, f8, fssd, gsm, gsrt, hcom, htk, ima, ircam, la, lpc, lpc10, lu, maud, nist, prc, raw,
s1, s16, s2, s24, s3, s32, s4, s8, sb, sf, sl, sln, smp, snd, sndr, sndt, sou, sox, sph, sw, txw, u1, u16,
u2, u24, u3, u32, u4, u8, ub, ul, uw, vms, voc, vox, wav, wavpcm, wve, xa.
stop()
Halts and discards any currently active microphone recording.
import cogpy
class Test(cogpy.Experiment):
mic = cogpy.Microphone()
def start(self):
mic.record("~/rec1.wav",10)
exp = Test()
exp.run()