About how to extract a speech signal's envelope

조회 수: 4 (최근 30일)
Eason
Eason 2013년 2월 18일
Hello,
I had a question about extract a speech signal's envelope.
y=wavread('test.wav');
x=hilbert(y);
x1=abs(x);
x2=sqrt(x.*conj(x));
x1 and x2 are two different way that I had found on Google. Looks very similar but not equal (isequal(x1,x2)=0)
I don't know which one was right. and I had try some code about envelope detector on MATLAB file center, but the result seems not correct...
Thanks

채택된 답변

Wayne King
Wayne King 2013년 2월 18일
편집: Wayne King 2013년 2월 18일
Using the Hilbert transform is a better way to proceed than your
x2 = sqrt(x.*conj(x));
The above just gives the magnitude squared of each of the waveform values and that is not the envelope. At least probably not in the sense you mean envelope. To illustrate how the Hilbert transform does indeed extract the envelope, I'll give you a simple example with an AM-modulated wave.
Fs = 1000;
t = 0:0.001:1-0.001;
% 250-Hz sine wave modulated at 10 Hz
x = [1+cos(2*pi*10*t)].*cos(2*pi*250*t);
y = hilbert(x);
plot(t,x,'k'); hold on;
plot(t,abs(y),'b','linewidth',2);
plot(t,-abs(y),'b','linewidth',2);
If you know zoom in on parts of the waveform, you'll clearly see how the modulus of the analytic signal yields the envelope. Specifically, you see that the envelope oscillates at 10 Hz.
set(gca,'xlim',[0.05 0.35]);
set(gca,'ylim',[-2 2])
  댓글 수: 1
Eason
Eason 2013년 2월 18일
Hi King,
Thanks for your answer, I use the code
>> y=wavread('h_006.wav');
>> x=hilbert(y);
>> upenv=abs(x);
>> lowenv=-abs(x);
>> plot(y);hold on;plot(upenv,'r');plot(lowenv,'r');
The result as figure.
And then there has another question, I need to create a 500 Hz sine wave which has same length and sampling rate as my speech file. And it also need to has same envelope of my speech file.
Fs=44100;%the sampling rate of speech file
dur=2.5;%the length of speech file
t=[0:1/Fs:dur-1/Fs];%time vector
freq=500;%sine wave's frequency
sin_wave=0.5*sin(2*pi*freq*t);%create sine wave
The code above was used to create a 500 Hz sine wave which has 2.5 sec long, sampling rate 44100 Hz, is that correct?
And how can I modulation sin_wave's envelope that was same as speech?
Thanks

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

추가 답변 (1개)

Wayne King
Wayne King 2013년 2월 18일
Yes, basically, although, I'm not sure why you set the amplitude equal to 0.5
For example:
load mtlb;
analmtlb = hilbert(mtlb);
t = 0:1/Fs:length(mtlb)*(1/Fs)-1/Fs;
x = cos(2*pi*500*t);
y = abs(analmtlb).*x';
soundsc(y,Fs)
  댓글 수: 2
Eason
Eason 2013년 2월 18일
Very appreciate for your help.
The amplitude equal to 0.5 was a mistake.
Here is a little question about y=abs(analmtlb).*x';
y=envelope.*sine wave; is same as y=sine wave.*envelope?
or the latrer was incorrect way?
Thanks again.
Wayne King
Wayne King 2013년 2월 18일
yes, in my example, analmtlb was the analytic signal, so the absolute value is the envelope.

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

카테고리

Help CenterFile Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by