Borrar filtros
Borrar filtros

How to create an envelope on a specific signal

25 visualizaciones (últimos 30 días)
maryam
maryam el 29 de En. de 2015
Comentada: Scott MacKenzie el 9 de Jul. de 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

Respuesta aceptada

Star Strider
Star Strider el 29 de En. de 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 comentarios
Saeed Haidar
Saeed Haidar el 23 de Jul. de 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 el 9 de Jul. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by