数学建模社区-数学中国
标题:
MATLAB还能发出声音!!!请看这里~
[打印本页]
作者:
青年梦想家
时间:
2015-10-10 22:51
标题:
MATLAB还能发出声音!!!请看这里~
2015-10-10 22:48 上传
下载附件
(37.74 KB)
有时候我们需要用matlab发出提示音,怎么办呢?
可以用matlab函数sound实现。该函数的输入参量是音频数据向量、采样频率和转换位数。
我们可以自己写些声音数据。下面的声音声调和频率有关,长度和数据长度有关:
例如:
sound(sin(2*pi*25*(1:4000)/100));
响两声就是:
sound(sin(2*pi*25*(1:4000)/100));
sleep(1);
sound(sin(2*pi*25*(1:4000)/100));
2015-10-10 22:50 上传
下载附件
(48.43 KB)
MATLAB也自带了很多声音:
%鸟声
load chirp
sound(y,Fs)
%锣声
load gong
sound(y,Fs)
%哈里路亚
load handel
sound(y,Fs)
%笑声
load laughter
sound(y,Fs)
%啪哒声
load splat
sound(y,Fs)
%火车
load train
sound(y,Fs)
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/)
Powered by Discuz! X2.5