V_UV_detect - en = sum(spf.^2)/fr_sz; if en <=...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%this script detects voice speecj in an utterance %need a wave file called shout in current dir. clear all; close all; clc; [sp, fs] = wavread('Clean'); %reqad the speech file sp = sp(1:20000); sp = sp/max(sp); % normalizing the speech the speech signal sp = AddNoise(sp, 5); %Segment speech into frames fr_sz = floor(10/1000*fs); %frame size of 10ms len = length(sp); %length of the speech n_fr = floor(len/fr_sz); %number of frames n beg = 1; enn = fr_sz; %initializing frames b % sil_thresh = .0005; % uv_thresh = .005; sil_thresh = .005; uv_thresh = .05; u for i = 1:n_fr, spf = sp(beg:enn);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: en = sum(spf.^2)/fr_sz; if en <= sil_thresh, mrkr(beg:enn) = 0;%marker for silence elseif en <=uv_thresh, mrkr(beg:enn) = 0.5; %marker for unvoiced else mrkr(beg:enn) = 1; %marker for voiced end beg = enn + 1; enn = enn + fr_sz; end e figure; plot(sp); hold on; plot(mrkr, 'r'); title('Speech and scaled energy: 0 = sil: 0.5 = UV: 1 = voiced'); xlabel('Sample'); ylabel('Amplitude'); legend('Speech', 'marker'); grid; g sil_ind = find(mrkr == 0); uv_ind = find(mrkr == 0.5); v_ind =find(mrkr == 1); pause soundsc(sp(v_ind), fs);...
View Full Document

Ask a homework question - tutors are online