
Technical discussion about Matlab and issues related to Digital Signal Processing.
|
Hi, I am doing a project in college at the moment on Music Synthesis in Matlab. How, using Matlab, could we obtain the envelope of our signals. Thanks Orla |
|
|
|
Hi Orla, First: Welcome to the exiting world of Music Synthesis. Second: Now, the bad news: Matlab is mathematics and using matlab without some mathematical background makes no sense. Is the signal processing toolbox available in your college? I'm sorry, this dosn't realy help you, mathematical backround is now needed also. But now the very bad news: Any toolbox dosn't realy free you from learning the underlying mathematics. Third: Hint Nr.1: Learn about hilbert-transform. Alternate hint Nr.2: In your system there are two timescales: a short time scale for the changes of your tone-signal, and a (i hope) longer time scale for the changes in the volume. The envelop is measuring the slowly changing volume, so in a FIRST try you may use a moving window on your data and after finding the min/max in this moving slice you get a rough estimate for the enverlop of your signal. You are interested in music and electronics ? Try to build a lowPass using matlab with a time-constant between the above mentioned time-scales. Have much fun. michael Orla schrieb: > > Hi, > I am doing a project in college at the moment on Music > Synthesis in Matlab. > > How, using Matlab, could we obtain the envelope of our > signals. > > Thanks > > Orla > _____________________________________ > /groups.php3 |
|
Hi, Few years ago I wrote script which takes modulated signal x and its envelope. You must also give as a parameter order of Hilbert filter. There is its listing below: function [y]=dem_am(x,P) %AM demodulation of signal x % y=dem_am(x,P); % % y - signal envelope % x - modulated signal % P - filter order for k=-P:P % Hilbert filter coefficients if round(k/2)*2==k d(k+P+1)=0; else d(k+P+1)= 2/(k*pi)*(0.54+0.46*cos(pi*k/P)); end end xh=conv(d,x); % filter xh=xh(P+1:length(x)+P); xh=xh/max(xh)*max(x); % scale y=sqrt(x.^2 + xh.^2); %--------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------- For example try this: t=0:0.01:20; x1=sin(2*pi*1*t); x2=sin(2*pi*0.1*t); y=x1.*x2; z=dem_am(y,10); figure(1) plot(y) figure(2) plot(z) %--------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------- But you have to know, that to understand this process you should read some signal processing theory !!!!!!!!!!!!!!!!! Best Regards, Michal |