extracting speech from audio
이전 댓글 표시
i want to extract 10 sections of a speech signal having spelled 1 to 10.in section i just get the 10th value i need all the values of all the spoken words. please help..
file = wavread( 'C:\Users\Desktop\samples\A');
%sound(file,11025);
totaltime = linspace(0,8,length(file));
i=0;
x=0;
y=0.8;
a=1;
b=8820;
section=(0);
while i<=9
time = linspace(x,y,8820);
%fourier = fft(file);
section1 = file(a:b,:);
section(i)=section1;
sound(section(i), 11025);
plot(time,section(i));
x=x+0.8;
y=y+0.8;
a = a + 8820;
b=b+8820;
i=i+1;
end
this is my project task.im new here. help needed.
답변 (2개)
Walter Roberson
2012년 4월 12일
편집: Walter Roberson
2017년 10월 4일
0 개 추천
That code should not run at all.
section1 is set to a slice of 8820 samples (in each channel). You then try to store that entire array into a single entry of a numeric array, section(i) . You cannot store 8820 (or 8820 by 2) numeric values into a single numeric location. Your code should exit.
Also, on the first iteration of the while, i is 0, and you are trying to store into section(i) which would be section(0) and that would crash because there is no element #0 in MATLAB arrays.
댓글 수: 6
faiza khan
2012년 4월 12일
Walter Roberson
2012년 4월 12일
I suggest you use
for i = 1 : 10
rather than the while loop.
Are the 10 sections each exactly 1/10th of the file? Or are they varying length and you need to figure out where the silence is? If you need to detect the silence, you will need to use a different structure for the code.
Walter Roberson
2012년 4월 12일
If the sections are of varying length then consider using cell arrays to hold them.
faiza khan
2012년 4월 13일
Walter Roberson
2012년 4월 13일
For any one file, permute() and reshape() and permute() again, and store the result into a 4 dimensional array indexed by segment number, sample within segment, channel, and file number.
faiza khan
2012년 4월 13일
Image Analyst
2012년 4월 12일
0 개 추천
That (if done right) only crops out chunks of the wavefile. It does not extract speech from an audio file -- like you asked for in your subject -- that has speech plus other unwanted sounds. I'm no audio expert but if you want to do that, you might try ICA to do blind source separation, as discussed in these web sites:
Even if you did Fourier analysis, like you hinted at in your comment, this would simply do frequency filtering and wouldn't necessarily extract out speech from other sounds occupying that frequency range.
댓글 수: 2
faiza khan
2012년 4월 13일
Image Analyst
2012년 4월 13일
You mean the extracted output files, right - they are all the same? Try this:
Delete this line:
section=(0);
and change these lines from this:
section1 = file(a:b,:);
section(i)=section1;
sound(section(i), 11025);
plot(time,section(i));
to this:
thisSection = file(a:b,:);
sound(thisSection , 11025);
plot(time, thisSection);
카테고리
도움말 센터 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!