How to play a variation of frequency?

4 次查看(过去 30 天)
Hi,
1)Starting from a pure wave of a given frequency (4000 Hz) I can not implement this pseudo code to play a sound (pure wave) whose frequency decreases continuously from 4000 to 200:
demo matlab
t = (0:0.001:100)';
for n = 4000:-1:200
y = sin(2*pi*n*t)
sound(y,Fs);
end
How to implement this correctly?
2)same question but starting from an very short audio file or an sound sample
thanks
  3 个评论
jérôme TAÏEB
jérôme TAÏEB 2018-10-2
编辑:Walter Roberson 2018-10-3
corrected script:
t=0:0.001:100;
for n=200:1:4000
y=sin(2*pi*n*t);
sound(y,n);
end
Now:
How to create in format.wav the obtained result by adding and scripting ?
thanks
Walter Roberson
Walter Roberson 2018-10-3
That code changes frequency in two different ways simultaneously. You should not do that. Either change the n used in the construction of y or else change the frequency used for playback, but do not do both.
Hint: changing the n used in the construction of y is much easier to put together into a single .wav file than if you change the playback frequency.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by