資源簡介
簡單的UI界面,點擊開始采集聲卡數據,并顯示波形。采集完后可以播放

代碼片段和文件信息
function?aa=?recorder(cfhandles)
%RECORDER?Summary?of?this?function?goes?here
%???Detailed?explanation?goes?here
%?h=figure(soundrec);
h=cf;
thehandles=handles;
setappdata(h‘isrecording‘1);
Ai=analoginput(‘winsound‘);?%?創建一個模擬信號輸入對象
%?添加通道
addchannel(Ai1);
Ai.SampleRate=5000;?%?采樣頻率
Ai.SamplesPerTrigger=Inf;?%?采樣數
????????start(Ai);?%?開啟采樣
????????warning?off?%?當采樣數據不夠時,取消警告
????????while?isrunning(Ai)?%?檢查對象是否仍在運行
????????????if?getappdata(h‘isrecording‘)
????????????????data=peekdata(AiAi.SampleRate/5);?%?獲取對象中的最后Ai.SampleRate個采樣數據
????????????????plot(thehandles.axes1data)?%?繪制最后Ai.SampleRate個采樣數據的圖形,因此表現出來就是實時的了
????????????????drawnow;?%?刷新圖像
????????????else
????????????????stop(Ai);
????????????????num=get(Ai‘SamplesAvailable‘);
????????????????aa=getdata(Ainum);
????????????????axes(thehandles.axes1);
????????????????plot(thehandles.axes1aa)?%?繪制最后Ai.SampleRate個采樣數據的圖形,因此表現出來就是實時的了
????????????????drawnow;?%?刷新圖像
????????????????setappdata(h‘sounds‘aa);
????????????end
????????end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1191??2014-01-21?03:44??sound?acq\recorder.m
?????文件???????4459??2014-01-21?03:54??sound?acq\soundrec.fig
?????文件???????3627??2014-01-21?03:44??sound?acq\soundrec.m
?????文件????????997??2014-01-21?03:04??sound?acq\wwlsound.m
?????文件??????????0??2014-03-11?23:28??sound?acq\新建文本文檔.txt
?????目錄??????????0??2014-03-11?23:28??sound?acq
-----------?---------??----------?-----??----
????????????????10274????????????????????6
評論
共有 條評論