samplerate=44100; Tmax=10; sampledata=wavrecord(Tmax*samplerate,samplerate); wavwrite(sampledata,samplerate,'sample.wav');