Filter löschen
Filter löschen

How to create an envelope on a specific signal

25 Ansichten (letzte 30 Tage)
maryam
maryam am 29 Jan. 2015
Kommentiert: Scott MacKenzie am 9 Jul. 2021
could anybody please guide me how i can find the lower & upper envelope on a signal? would you give me a simple example?thank you

Akzeptierte Antwort

Star Strider
Star Strider am 29 Jan. 2015
Use the hilbert function:
t = linspace(0,5*pi,1000);
s = sin(t) .* cos(15*t);
hs = hilbert(s);
figure(1)
plot(t, s)
plot(t,-abs(hs),'r-', t,abs(hs),'-r', 'LineWidth',1.5)
hold off
grid
produces:
  6 Kommentare
Saeed Haidar
Saeed Haidar am 23 Jul. 2020
hello guys,
can someone help me create an envelope to my signal, here's the code:
fs = 44100;
c5=key(52,8,fs);
a4=key(49,8,fs);
b4=key(51,8,fs);
e4=key(44,8,fs);
e5=key(56,8,fs);
d5=key(54,8,fs);
f5=key(57,8,fs);
line1= [ e4 a4 b4 c5 a4 ];
line2= [ e4 a4 b4 c5 a4 ];
line3= [ e4 a4 b4 c5 b4 a4 c5 b4 a4 e5 e5 e5 d5 e5 f5 f5];
song=[line1 line2 line3];
sound(song,fs,24);
function wave= key(p,n,fs)
t=0:1/fs:4/n;
idx=440*2^((p-49)/12);
tt=4/n:1/fs:0;
wave=(sin(2*pi*idx*t)).*exp(tt);
wave=wave./max(wave);
end
Scott MacKenzie
Scott MacKenzie am 9 Jul. 2021
@Saeed Haidar. You comment is about something quite different -- adding an envelope (attack, sustain, decay) to the notes in a melody. If you are still interested in this, please post as a separate question.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by