数学建模社区-数学中国

标题: MATLAB还能发出声音!!!请看这里~ [打印本页]

作者: 青年梦想家    时间: 2015-10-10 22:51
标题: MATLAB还能发出声音!!!请看这里~



t0152eb6f12b77da9cc.jpg


有时候我们需要用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));

t01bdb3ab83fd0bd016.jpg



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