4.5

4.5 | 4 ratings Rate this file 74 Downloads (last 30 days) File Size: 87.99 KB File ID: #19236
image thumbnail

Some Basic Audio Features

by Theodoros Giannakopoulos

 

16 Mar 2008 (Updated 21 Apr 2008)

Use the provided m-files for computing the features of an audio classification problem

| Watch this File

File Information
Description

---------------------------------------
Theodoros Giannakopoulos
http:/www.di.uoa.gr/~tyiannak
---------------------------------------

Feature extraction (as in most pattern recognition problems) is maybe the most important step in audio classification tasks. The provided Matlab code computes some of the basic audio features for groups of sounds stored in WAV files. Furthermore, a simple class separability measure, based on feature histograms is used for measuring the ability of each feature to be used for classifying the given classes. Therefore, you can use the provided m-files for computing the features of an audio classification problem (i.e. specific audio classes) and understanding "how good" those features are for the specific classification task.

The features are calculated in a two-step way:

In particular, the following audio features and respective statistics are extracted for each audio segment:
Features Statistics
Energy Entropy Standard Deviation (std)
Signal Energy Std by Mean (average) Ratio
Zero Crossing Rate Std
Spectral Rolloff Std
Spectral Centroid Std
Spectral Flux Std by Mean Ratio

In order to compute the 6 feature statistics for a specific .wav file, you can use the computeAllStatistics(fileName, win, step).

After the features are calculated,

a) the histograms of each feature for all classes are estimated

b) a simple algorithm is used for estimating the separability of the audio classes. In other words, a measure that describes how "easily" the features will be classified. In the case of a multi-class classification problem, the measure is calculated for EACH CLASS opposed to ALL OTHER CLASSES, i.e. a measure value FOR EACH CLASS is computed. The algorithm is described in detail in http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=18791&objectType=FILE#.

EXAMPLE:

The main function of this demo is computeFeaturesDirectory(). The only recuired argument is a cell array with the names of the directories in which the .wav files of the respective classes are stored. For example, suppose you have three folders named MUSIC, SPEECH and NOISE, each one containing wav files with relevant audio content (i.e. wav files of segments containing music, speech and noise). In order to compute the audio features of those files simply write:

>> F = computeFeaturesDirectory({'music','speech','noise'});

---------------------------------------
Theodoros Giannakopoulos
http:/www.di.uoa.gr/~tyiannak
---------------------------------------

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
06 May 2008 walid hussein  
14 May 2008 daniel kong

it would be much better if each input and output were clearly noted and explained in each .m file.

12 Jun 2008 K. Idrank  
31 Jul 2008 Heri Firmansyah  
16 Feb 2010 Gökhan Vural

I've run the code as "F=computeFeaturesDirectory({'Hard','Jazz','Pop'});"
just to see outputs. However, it gave me a number of Warnings and 2 Errors .. Here thm all ..

***
Warning: Integer operands are required for colon operator when used as index
> In Energy_Entropy_Block at 18
  In computeAllStatistics at 22
  In computeFeaturesDirectory at 36
**
??? Operands to the || and && operators must be convertible to logical scalar values.

Error in ==> myHist at 20
while ((i1>=1) || (i2<=length(X)))

Error in ==> computeFeaturesDirectory at 68
        [H,X] = myHist(tempF);

The output is an Empty Graphic, not like your sample jpg.
Should i do something different to run your code ?

Thx for sharing and help, Regards.

02 Dec 2010 Theodoros Giannakopoulos

Thank you for your feedback.
The first is simply a warning, you can get rid of it by rounding the integer index in the respective line of code in file Energy_Entropy_Block.
As far as the error is concerned, please use single & and | instead of && and ||. Sorry for that (it works on my version of Matlab though). I will repair it in a later update.

12 Apr 2011 sunshinechina

thanks for sharing with us,^_^

16 Nov 2011 f

fatemeh

I've run the code as "F=computeFeaturesDirectory({'H'});"
,it gave me a number of Warnings and 3 Errors .. Here them all ..

>Warning: Integer operands are required for colon operator when used as index
 
> In SpectralRollOff at 9
  In computeAllStatistics at 25
  In computeFeaturesDirectory at 36
Warning: Rounding order to nearest integer.
> In signal\private\check_order at 28
  In signal\private\gencoswin at 18
  In hamming at 17
  In SpectralCentroid at 6
  In computeAllStatistics at 26
  In computeFeaturesDirectory at 36
Warning: Integer operands are required for colon operator when used as index
> In SpectralCentroid at 8
  In computeAllStatistics at 26
  In computeFeaturesDirectory at 36
??? Error using ==> times
Matrix dimensions must agree.

Error in ==> SpectralCentroid at 10
    window = H.*(signal(curPos:curPos+windowLength-1));

Error in ==> computeAllStatistics at 26
C = SpectralCentroid(x, win*fs, step*fs, fs);

Error in ==> computeFeaturesDirectory at 36
        F = computeAllStatistics([classNames{c} '//' D(i).name], win, step);

by changing && to & it didn't correct.
window = H.*(signal(curPos:curPos+windowLength-1));

thanks for sharing the code.

29 Nov 2011 f

These errors occurred in result of difference between sampling rate and bit rates of the input files. Also number of files should be more than 15. Provided this two condition, the code runs completely without error in MATLAB 7.8.0 (R2009a). Thank you Theodoros.

Please login to add a comment or rating.
Updates
24 Mar 2008

Link Added

21 Apr 2008

Summary changed

Tag Activity for this File
Tag Applied By Date/Time
audio processing Theodoros Giannakopoulos 22 Oct 2008 09:53:52
video processing Theodoros Giannakopoulos 22 Oct 2008 09:53:52
audio feature calculation Theodoros Giannakopoulos 22 Oct 2008 09:53:52
audio classification Theodoros Giannakopoulos 22 Oct 2008 09:53:52
audio segmentation Theodoros Giannakopoulos 22 Oct 2008 09:53:52
audio segmentation a 27 Oct 2008 11:56:44
audio classification anurag dwivedi 01 Apr 2011 03:41:31
audio feature calculation yassir z 05 Oct 2011 09:54:11

Contact us at files@mathworks.com