How to use envelope function in Matlab?

The following Matlab code generate a sound but it contain tak tak like sound which can be easily heard.Can someone removes this noise by using envelope function.
Fs=44100;
T=1/Fs;
M=zeros(1,88);
for I=7:88
M(I)=round(36.8*(2^(1/12))^(I-6));
end
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)
x=FrTm(i,1);
y=FrTm(i,2);
F=M(x);
time=0:1/Fs:y/18;
sinewave=*sin(2*pi*10*F*time);
signal=[signal sinewave];
end
stem(signal)
sound(signal,Fs)

댓글 수: 5

Star Strider
Star Strider 2018년 1월 29일
The envelope function will not do what you want.
Tayyab Shinwari
Tayyab Shinwari 2018년 1월 29일
then what is your suggestion? how to solve this problem? i think altering the code will understand me in better way.
Jan
Jan 2018년 1월 29일
편집: Jan 2018년 1월 29일
Please fix your code: The line "sinewave=*sin(2*pi*10*F*time)" fails. If I insert "...= F * sin(..." the code runs (very slowly due to the forgotten pre-allocation). A funny sound is produced, but I do not have any idea, what the problem is. There is no "tak tak", therefore your "can be easily heard" is not a useful description. What exactly is the problem you want to solve?
Tayyab Shinwari
Tayyab Shinwari 2018년 1월 30일
sorry there is no* before sinewave just multiply 2 amplitude it resolve even if you add pi to start it completly remove it
Jan
Jan 2018년 1월 30일
Sorry, there is a * before the sin command. I can see it. If it is a typo, please edit the question instead of leaving this confusing crashing line for the readers. Thanks.
I do not understand the rest of the comment: "just multiply 2 amplitude it resolve even if you add pi to start it completly remove it". What does this mean?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sambit Behura
Sambit Behura 2018년 1월 30일

0 개 추천

Use envelope(x) check this link for details https://in.mathworks.com/help/signal/ref/envelope.html

카테고리

질문:

2018년 1월 29일

답변:

2018년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by