comparison Code/Descriptors/Matlab/Common/detect_Silence.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents ea0c737c6323
children
comparison
equal deleted inserted replaced
3:e1cfa7765647 4:92ca03a8fa99
1 function [ silenceSegments ] = detect_Silence( currentSampleName, OVERWRITE ); 1 function [ silenceSegments ] = detect_Silence( sampleWavFileName, OVERWRITE );
2 2
3 %returns an array containing the start and end frames for non-silent segments 3 %returns an array containing the start and end frames for non-silent segments
4 4
5 % open original silence calculation 5 % open original silence calculation
6 fileName = [ currentSampleName '_silence.txt']; 6 sampleFileName = sampleWavFileName( 1 : length( sampleWavFileName ) - 4 );
7 fileName = [ sampleFileName '_silence.txt'];
7 % read pitch metrics from file 8 % read pitch metrics from file
8 fileID = fopen( fileName ); 9 fileID = fopen( fileName );
9 10
10 if( (fileID <= 0) || (OVERWRITE) ) %does the file exist? 11 if( (fileID <= 0) || (OVERWRITE) ) %does the file exist?
11 % no 12 % no
12 disp('WARNING: MISSING SILENCE FILE'); 13 disp('WARNING: MISSING SILENCE FILE');
13 %calculate it 14 %calculate it
14 [x, fs, frameLength, noOfFrames] = openFile( [ sampleFileName '.wav' ] ); 15 [x, fs, frameLength, noOfFrames] = openFile( sampleWavFileName );
15 limits = calculate_Silence( x, fs, frameLength ); 16 limits = calculate_Silence( x, fs, frameLength );
16 % create voicing metrics file 17 % create voicing metrics file
17 fileID = fopen( fileName, 'w'); 18 fileID = fopen( fileName, 'w');
18 fprintf( fileID, 'non-silent start frame \t non-silent end frame \n '); 19 fprintf( fileID, 'non-silent start frame \t non-silent end frame \n ');
19 rowNum = size(limits); 20 rowNum = size(limits);