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!