在MATLAB中播放连续音高

时间:2014-01-25 04:46:04

标签: audio matlab matlab-figure

所以我一直在努力解决这个问题。我应该只用一个soundsc(wave,fs)调用来播放一系列音调,但是当我尝试将音调波放在一个数组中时,它只是同时播放它们而不是连续播放它们。例如:

pitch1 =  sin(2*pi*freq1*t); 
pitch2 =  sin(2*pi*freq2*t);
pitch3 =  sin(2*pi*freq3*t);

concat_pitch = [pitch1; pitch2; pitch3]; % I want them to play in order, not together

soundsc(concat_pitch, fs); % this just plays them all together

任何人都可以帮助我吗?感谢。

1 个答案:

答案 0 :(得分:2)

更改连接以形成单行向量:

concat_pitch = [pitch1, pitch2, pitch3];

或者,如果您指定的串联很重要并且必须保持原样,那么您可以循环遍历2-d矩阵的行:

for ind=1:length(concat_pitch)
    soundsc(concat_pitch(ind,:), fs);
end