Separate words in audio file

6 views (last 30 days)
Hello, I am trying to separate words in an audio file, leaving only samples between red lines, with also having a variable with a border of each word:
I understand I can remove the silence between words using
envelope = imdilate(abs(y), true(1500, 1));
quietParts = envelope < 0.05;
y(quietParts) = [];
but this does leave me without knowing the boundary between each of these words.
  2 Comments
Arthur Goodhart
Arthur Goodhart on 2 Nov 2018
Did you ever work out how to do this?
Michael Saniuk
Michael Saniuk on 3 Nov 2018
I posted this question 1.5 year ago but yes, I managed to do it myself.
[y, fs] = audioread(sprintf('test%d.wav', i));
envelope = imdilate(abs(y), true(1500, 1));
quietParts = envelope > 0.01;
beginning = strfind(quietParts',[0 1]);
ending = strfind(quietParts', [1 0]);
With this code you can get boundaries between words but also between noises and sometimes the word gets separated.
In order to concatenate fragments of word into one full word, I had to detect parts where where is a very small distance between them and remove their corresponding endings/begginings:
eg. [b1 e1] [b2 e2] [b3 e3] are from the same word,
distances between them are very small.
I concatenate them and now I have a full word [b1 e3]
The last thing that might annoy us are the boundaries of noise that we do not want to be treated as a word! In order to get rid of them I calculated minimal length of a word in my dictionary and counted it as a minimal length for a detected word to be counted as a word.

Sign in to comment.

Accepted Answer

Michael Saniuk
Michael Saniuk on 5 Nov 2018
Copying my comment to post it as an answer:
I posted this question 1.5 year ago but yes, I managed to do it myself.
[y, fs] = audioread(sprintf('test%d.wav', i));
envelope = imdilate(abs(y), true(1500, 1));
quietParts = envelope > 0.01;
beginning = strfind(quietParts',[0 1]);
ending = strfind(quietParts', [1 0]);
With this code you can get boundaries between words but also between noises and sometimes the word gets separated.
In order to concatenate fragments of word into one full word, I had to detect parts where where is a very small distance between them and remove their corresponding endings/begginings:
eg. [b1 e1] [b2 e2] [b3 e3] are from the same word,
distances between them are very small.
I concatenate them and now I have a full word [b1 e3]
The last thing that might annoy us are the boundaries of noise that we do not want to be treated as a word! In order to get rid of them I calculated minimal length of a word in my dictionary and counted it as a minimal length for a detected word to be counted as a word.

More Answers (1)

huda farooqui
huda farooqui on 1 Nov 2018
I am facing the same problem .kindly help

Community Treasure Hunt

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

Start Hunting!