Mercurial > hg > emotion-detection-top-level
diff Code/Descriptors/Matlab/MPEG7/detect_AudioPower.m @ 4:92ca03a8fa99 tip
Update to ICASSP 2013 benchmark
author | Dawn Black |
---|---|
date | Wed, 13 Feb 2013 11:02:39 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Code/Descriptors/Matlab/MPEG7/detect_AudioPower.m Wed Feb 13 11:02:39 2013 +0000 @@ -0,0 +1,28 @@ +function [ audioPower ] = detect_AudioPower( sampleWavFileName, OVERWRITE ) +% find the audio power + +% open original power calculation +sampleFileName = sampleWavFileName( 1 : length( sampleWavFileName ) - 4 ); +fileName = [ sampleFileName '_AP.txt']; +fileID = fopen( fileName ); + +if( (fileID <= 0) || (OVERWRITE) ) %does the file exist? + % no + disp('WARNING: MISSING AUDIO POWER FILE'); + %calculate it + [x, fs, frameLength, noOfFrames] = openFile( [ sampleFileName '.wav' ] ); + + audioPower = calculate_audioPower(x, fs, frameLength, noOfFrames); +% frameIndex = 1:1:length(AP); + fileID = fopen( fileName, 'w'); + for i = 1 : noOfFrames + fprintf( fileID, '%d %s \n' , i, num2str( audioPower(i,1)) ); + end + + fclose( fileID ); + fileID = fopen( fileName ); +end + +audioPower = fscanf( fileID, '%f', inf ); +audioPower = audioPower(2:2:end); +fclose( fileID ); \ No newline at end of file