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
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 个评论

yes thats right.i dont know how to correct the looping.
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.
If the sections are of varying length then consider using cell arrays to hold them.
one speech file has 10 words spoken each word is spoken for 0.8 sec.lets say i have samples of 10 ppl.i need to make an array of all ppl's 1st word ,another array whose elements are the 2nd spoken word of all the ppl and so on..
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.
by any one file u mean the file having 10 spoken words from one person only.?

请先登录,再进行评论。

Image Analyst
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 个评论

im loading 10 speech wav files into matlab..the first one loads correctly..in the other files the data duplicates.
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);

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by