extract the words from audio file

4 visualizaciones (últimos 30 días)
Rasha Ahmad
Rasha Ahmad el 16 de Dic. de 2019
Comentada: Walter Roberson el 16 de Dic. de 2019
i want to extract the words from audio recorded in matlab and save each word in seperate audio file, i have problem, i extract the first word but the middle word cannot extracted here is my code:
Fs = 44100 ;
nBits = 16 ;
nChannels = 2 ;
ID = -1; % default audio input device
recObj = audiorecorder(Fs,nBits,nChannels,ID);
disp('Start speaking.')
recordblocking(recObj,5);
disp('End of Recording.');
play(recObj);
audiosaved=getaudiodata(recObj);
audiowrite('C:\Users\rasha\Desktop\slide\mms\MMS\hw\recoder.wav',audiosaved,Fs);
[p1,Fs]=audioread('C:\Users\rasha\Desktop\slide\mms\MMS\hw\recoder.wav');
q=44100;
part1=p1(1:q*1.5,:);
part2=p1(1.5:q*2.5, :);
part3=p1(2.5:q*3,end, :);
audiowrite('C:\Users\rasha\Desktop\slide\mms\MMS\hw\part1.wav',part1,Fs);
audiowrite('C:\Users\rasha\Desktop\slide\mms\MMS\hw\part2.wav',part2,Fs);
audiowrite('C:\Users\rasha\Desktop\slide\mms\MMS\hw\part3.wav',part3,Fs);

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Dic. de 2019
part1=p1(1:floor(q*1.5),:);
part2=p1(ceil(1.5*q):floor(q*2.5), :);
part3=p1(ceil(2.5*q):floor(q*3),end, :);
  3 comentarios
Walter Roberson
Walter Roberson el 16 de Dic. de 2019
floor(x) returns the greatest integer less than or equal to x. ceil(x) returns the least integer greater than or equal to x.
In other words floor "rounds down" and ceil "rounds up".
Walter Roberson
Walter Roberson el 16 de Dic. de 2019
I realized that there is a subtle boundary condition problem with what I posted. Repaired would be
part1=p1(1:floor(q*1.5),:);
part2=p1(floor(1.5*q)+1:floor(q*2.5),:);
part3=p1(floor(2.5*q)+1:floor(q*3),:);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multichannel Audio Input and Output en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by