How to play a variation of frequency?

조회 수: 1 (최근 30일)
jérôme TAÏEB
jérôme TAÏEB 2018년 9월 29일
댓글: Walter Roberson 2018년 10월 3일
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