How to make speech content conversion by a word replacement?
Show older comments
I am working on a project to record an audio file(a sentence with 10-15 words) and sound it. Then I needed to write a code to seperate the words and save them as individual .wav files.
[speech,fs]=audioread('tenwords.wav');
sp=100;
threshold=1;
k_s=0;
window= sp*fs/1000;
speech2 = speech(1:(length(speech)-mod(length(speech), window)),1);
samples = reshape(speech2,window,length(speech2)/window);
energies = sqrt(sum(samples.*samples))';
vuv = energies > threshold;
z=length(energies);
a=1;
t=1;
j;
for j=1:z
if((vuv(j)==1) && (vuv(j+1)==0))
k_s=k_s+1;
end
end
bas=zeros(1,k_s);
for i=1:k_s
for k=a:z
if((vuv(k)==0) && (vuv(k+1)==1)); break;
end
end
a=k+1;
bas(i)=k*4800;
end
son=zeros(1,k_s);
for e=1:k_s
for r=t:z
if((vuv(r)==1) && (vuv(r+1)==0)); break;
end
end
t=r+1;
son(e)=r*4800;
end
for x=1:k_s
kelime=bas(x):son(x);
filename = ['C:\Users\hp\Desktop\Words\d' ,x+48, '.wav'];
audiowrite(filename, speech(kelime),fs);
end
But when I try to listen the output audio files, there is 10 .wav files, it is ok, but their speech content(the word that they stored) is not understandable. I don't have any idea what is the problem in my project. Can anyone help me to fix this?
(I also need to create random sentences with that 10 words as a next step.)
Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!