我想从频率列表(Frtm)中逐个访问频率,并希望将它们存储在一个信号中,最后我想播放它们...... 我写了这段代码,但我不知道问题出在哪里,如果有人可以提供帮助,那么我们将不胜感激。
function Music3 ()
Fs = 44100;
T = 1 / Fs;
t = 0:1 / 18:5;
M = zeros (1, 88);
for I = 7:88
M (I) = round (36.8 * (2 ^ (1 / 12)) ^ (I - 6));
endfor
Signal = [];
FrTm = [50, 3; 50, 3; 52, 3; 54, 3; 50, 3; 54, 3; 52, 3; 45, 3; 50, 3; 50, 3; 52, 3; 54, 3; 50, 6; 49, 3; 1, 3; 50, 3; 50, 3; 52, 3; 54, 3; 55, 3; 54, 3; 52, 3; 50, 3; 49, 3; 45, 3; 47, 3; 49, 3; 50, 6; 50, 3; 1, 3; 47, 5; 49, 1; 47, 3; 45, 3; 47, 3; 49, 3; 50, 3; 1, 3; 45, 5; 47, 1; 45, 3; 43, 3; 42, 6; 45, 3; 1, 3; 47, 5; 49, 1; 47, 3; 45, 3; 47, 3; 49, 3; 50, 3; 47, 3; 45, 3; 50, 3; 49, 3; 52, 3; 50, 6; 50, 6];
for i = 1:length (FrTm)
M (i) = FrTm (i);
New = M (i);
data = sin (2 * pi * New / Fs * t);
Signal = [data; Signal];
endfor
stem(Signal);
sound(Signal,44100);
end
答案 0 :(得分:1)
这是你想要的:
echo poweroff| plink ...
我将频率乘以10,否则它们太低了。
clear; clc; close all;
Fs = 44100;
T = 1 / Fs;
sin_time_seconds = 1
t = 0:T:sin_time_seconds;
Signal = [];
FrTm = 10*[50, 3; 50, 3; 52, 3; 54, 3; 50, 3; 54, 3; 52, 3; 45, 3; 50, 3; 50, 3; 52, 3; 54, 3; 50, 6; 49, 3; 1, 3; 50, 3; 50, 3; 52, 3; 54, 3; 55, 3; 54, 3; 52, 3; 50, 3; 49, 3; 45, 3; 47, 3; 49, 3; 50, 6; 50, 3; 1, 3; 47, 5; 49, 1; 47, 3; 45, 3; 47, 3; 49, 3; 50, 3; 1, 3; 45, 5; 47, 1; 45, 3; 43, 3; 42, 6; 45, 3; 1, 3; 47, 5; 49, 1; 47, 3; 45, 3; 47, 3; 49, 3; 50, 3; 47, 3; 45, 3; 50, 3; 49, 3; 52, 3; 50, 6; 50, 6];
for i = 1:length (FrTm)
data = sin (2 * pi .* FrTm(i) .* t);
Signal = [Signal data];
end
plot(Signal);
sound(Signal,Fs);
是您希望每个声音显示的时间。您的脚本中存在许多错误,尤其是您创建的矢量的尺寸。