Calculate descriptive statistics on Mel-frequency cepstral coefficients
Source:R/mfcc_stats.R
mfcc_stats.Rd
mfcc_stats
calculates descriptive statistics on Mel-frequency cepstral coefficients and its derivatives.
Usage
mfcc_stats(
X,
ovlp = 50,
wl = 512,
bp = "frange",
path = NULL,
numcep = 25,
nbands = 40,
parallel = 1,
pb = TRUE,
...
)
Arguments
- X
'selection_table', 'extended_selection_table' or data frame with the following columns: 1) "sound.files": name of the sound files, 2) "sel": number of the selections, 3) "start": start time of selections, 4) "end": end time of selections.
- ovlp
Numeric vector of length 1 specifying % of overlap between two consecutive windows. Internally this is used to set the 'hoptime' argument in
melfcc
. Default is 50.- wl
A numeric vector of length 1 specifying the spectrogram window length. Default is 512. See 'wl.freq' for setting windows length independently in the frequency domain.
- bp
A numeric vector of length 2 for the lower and upper limits of a frequency bandpass filter (in kHz) or "frange" (default) to indicate that values in minimum of 'bottom.freq' and maximum of 'top.freq' columns will be used as bandpass limits.
- path
Character string containing the directory path where the sound files are located.
- numcep
Numeric vector of length 1 controlling the number of cepstra to return (see
melfcc
).- nbands
Numeric vector of length 1 controlling the number of warped spectral bands to use (see
melfcc
). Default is 40.- parallel
Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing).
- pb
Logical argument to control progress bar and messages. Default is
TRUE
.- ...
Additional parameters to be passed to
melfcc
.
Value
A data frame containing the descriptive statistics for each of the Mel-frequency cepstral coefficients (set by 'numcep' argument). See details.
Details
The function calculates descriptive statistics on Mel-frequency cepstral coefficients (MFCCs) for each of the signals (rows) in a selection data frame. The descriptive statistics are: minimum, maximum, mean, median, skewness, kurtosis and variance. It also returns the mean and variance for the first and second derivatives of the coefficients. These parameters are commonly used in acoustic signal processing and detection (e.g. Salamon et al 2014).
References
Araya-Salas, M., & Smith-Vidaurre, G. (2017). warbleR: An R package to streamline analysis of animal acoustic signals. Methods in Ecology and Evolution, 8(2), 184-191.Lyon, R. H., & Ordubadi, A. (1982). Use of cepstra in acoustical signal analysis. Journal of Mechanical Design, 104(2), 303-306.Salamon, J., Jacoby, C., & Bello, J. P. (2014). A dataset and taxonomy for urban sound research. In Proceedings of the 22nd ACM international conference on Multimedia. 1041-1044.
Author
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
Examples
{
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "lbh_selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav"))
# run function
mel_st <- mfcc_stats(X = lbh_selec_table, pb = FALSE, path = tempdir())
head(mel_st)
# measure 12 coefficients
mel_st12 <- mfcc_stats(X = lbh_selec_table, numcep = 12, pb = FALSE, path = tempdir())
head(mel_st)
}
#> sound.files selec min.cc1 min.cc2 min.cc3 min.cc4 min.cc5
#> 1 Phae.long1.wav 1 97.41710 -9.741738 -11.32636 -2.4775313 -16.442584
#> 2 Phae.long1.wav 2 103.66298 -11.204330 -13.11395 -5.1566762 -16.876461
#> 3 Phae.long1.wav 3 101.56633 -10.796311 -12.12637 -3.9241991 -15.481162
#> 4 Phae.long2.wav 1 90.35586 -17.738353 -15.98023 -0.3796791 -9.827981
#> 5 Phae.long2.wav 2 94.59037 -15.337203 -15.04966 -0.8982095 -11.579024
#> 6 Phae.long3.wav 1 83.58712 -16.166409 -11.60570 1.7900544 -13.428846
#> min.cc6 min.cc7 min.cc8 min.cc9 min.cc10 min.cc11 min.cc12
#> 1 -12.669396 -25.51122 -16.122035 -21.1652585 -26.85733 -8.311928 -11.161755
#> 2 -17.495990 -25.70540 -14.485720 -14.9742115 -30.10690 -7.252546 -13.750444
#> 3 -12.494062 -25.11734 -15.979317 -14.6357577 -34.17262 -10.433532 -6.513314
#> 4 -12.748253 -15.83535 -5.149791 -6.2990882 -13.84780 -7.544004 -4.810362
#> 5 -10.828286 -16.90564 -3.682015 -4.8593790 -16.72003 -8.594043 -5.992594
#> 6 -1.788067 -10.02436 -4.227750 0.7438716 -14.48855 -6.704159 -5.681910
#> min.cc13 min.cc14 min.cc15 min.cc16 min.cc17 min.cc18 min.cc19
#> 1 -10.893999 -6.548138 -6.228469 -12.351283 -10.011899 -14.210023 -10.674114
#> 2 -7.469322 -7.517244 -15.924519 -7.058725 -12.643605 -10.448158 -5.083385
#> 3 -10.428165 -2.100663 -10.343367 -16.166685 -12.808690 -10.431413 -2.289366
#> 4 -5.963805 -6.319496 -8.933051 -6.763212 -1.182565 -6.149335 -9.457490
#> 5 -12.106991 -6.543729 -4.679565 -3.715462 -8.811456 -6.970448 -4.089950
#> 6 -9.431567 -9.134731 -5.153216 -4.322798 -4.878103 -5.830261 -20.224515
#> min.cc20 min.cc21 min.cc22 min.cc23 min.cc24 min.cc25 max.cc1
#> 1 -14.936022 -14.660531 -1.831284 -7.074403 -10.602284 -15.498981 123.8829
#> 2 -14.862029 -10.599017 -4.799863 -15.609107 -11.213116 -13.257737 121.7936
#> 3 -8.575396 -6.649396 -5.371442 -11.981505 -5.868671 -13.167830 115.8979
#> 4 -5.379245 -3.139821 -6.112165 -1.469666 -4.517338 -8.295976 106.4477
#> 5 -6.062614 -7.508700 -7.220562 -8.242488 -6.971534 -3.505703 110.4075
#> 6 -4.753631 -6.782422 -6.012380 -12.781620 -8.859711 -14.718285 101.1518
#> max.cc2 max.cc3 max.cc4 max.cc5 max.cc6 max.cc7 max.cc8
#> 1 -5.471136 1.604269 13.207769 3.765825 18.400812 14.693230 13.396234
#> 2 -5.916305 0.798860 12.415208 7.577028 19.227664 13.613360 10.935493
#> 3 -5.011725 1.503675 9.933779 7.834471 21.543872 14.126354 13.235474
#> 4 -7.399087 -3.281254 12.512596 1.169290 11.551683 7.105545 7.710989
#> 5 -5.262125 -4.712893 11.423114 3.675929 9.407848 6.781409 4.386000
#> 6 -10.734089 2.179903 11.501854 0.127160 11.620112 7.747183 2.748573
#> max.cc9 max.cc10 max.cc11 max.cc12 max.cc13 max.cc14 max.cc15
#> 1 11.950669 4.715892 18.462866 6.651267 7.989516 13.994428 9.666043
#> 2 11.703480 18.517115 13.460480 7.254551 5.505258 9.559330 7.031169
#> 3 7.225735 11.434075 18.722485 10.857621 13.911743 14.360009 12.381654
#> 4 5.166011 6.555404 11.793875 4.035566 5.455683 4.812108 7.472272
#> 5 9.138265 6.959043 3.078486 2.770936 3.262478 6.498858 10.700772
#> 6 9.273600 2.210349 3.499552 5.036030 2.578108 3.846708 4.236219
#> max.cc16 max.cc17 max.cc18 max.cc19 max.cc20 max.cc21 max.cc22
#> 1 23.755963 6.789029 18.622725 22.773468 10.710674 8.4029593 6.373672
#> 2 27.728741 6.262405 21.131985 22.298373 12.723599 9.5721075 3.267168
#> 3 16.908047 7.459304 11.839398 16.756546 12.316496 8.3001695 6.204872
#> 4 8.823517 6.556143 7.342826 4.316081 9.776778 6.2031408 4.659367
#> 5 20.876774 4.853740 4.382839 8.979047 8.117146 0.6202709 3.662607
#> 6 3.270320 3.448574 4.240012 5.379075 9.291310 12.5054848 5.635668
#> max.cc23 max.cc24 max.cc25 median.cc1 median.cc2 median.cc3 median.cc4
#> 1 9.994031 15.818974 8.657913 113.83520 -8.026102 -2.871619 4.353283
#> 2 15.562221 7.111506 15.096408 116.79498 -8.194719 -3.999071 5.900533
#> 3 13.429872 11.125478 5.702094 110.89634 -9.080785 -3.257558 3.805035
#> 4 8.461919 7.603726 2.517150 101.95072 -14.106201 -7.147220 6.413854
#> 5 2.531392 6.657956 10.659771 105.14495 -12.931932 -7.666588 5.337361
#> 6 3.025244 15.909787 4.676275 95.20185 -14.939280 -2.391788 7.996481
#> median.cc5 median.cc6 median.cc7 median.cc8 median.cc9 median.cc10
#> 1 -3.633554 2.589859 2.4490654 -8.2694605 -1.2132464 -13.542157
#> 2 -6.285458 -1.638995 2.3521451 -5.9505438 1.5506542 -11.107731
#> 3 -5.598541 1.339909 2.3398548 -4.7241597 -2.5715766 -12.488231
#> 4 -7.359406 1.599963 -0.6494207 0.5066077 -0.8671164 -1.217075
#> 5 -8.101284 4.025589 3.0080046 1.8971890 2.1193144 -4.734557
#> 6 -10.984953 4.393810 -0.8535795 -1.4618650 2.6501936 -2.338702
#> median.cc11 median.cc12 median.cc13 median.cc14 median.cc15 median.cc16
#> 1 3.15206419 1.3145897 -1.1204982 3.8116687 1.0065652 -5.5729624
#> 2 -0.83345023 -2.9185975 1.3527322 2.2873534 -3.0080424 -2.1224897
#> 3 2.55973554 1.6729575 0.5938637 3.2630734 0.8256174 -4.6850967
#> 4 1.62536392 -0.5555682 1.3737687 -0.8332135 0.8025779 2.8640700
#> 5 -2.52952403 -2.6837353 -4.0811671 -0.4724871 2.1186627 0.6013044
#> 6 -0.09845667 -0.8647434 1.0296915 -0.6900702 2.0542665 0.2010110
#> median.cc17 median.cc18 median.cc19 median.cc20 median.cc21 median.cc22
#> 1 2.50503890 -1.11639762 5.7759344 2.32512516 -0.8540258 1.4935067
#> 2 -2.84357434 -1.37221173 3.2727356 -4.39882963 0.4547581 0.5207376
#> 3 -0.07064844 -0.02392908 2.9201578 2.67885817 -2.0384039 0.9258723
#> 4 1.50004136 -1.77393307 -0.9454727 0.88169224 1.3835542 0.5904333
#> 5 0.44249953 -2.00572468 1.1993185 0.26393591 -2.0949872 -1.0577768
#> 6 -1.22595819 -1.55498880 -2.0707686 -0.08681687 -1.7115016 0.1864383
#> median.cc23 median.cc24 median.cc25 mean.cc1 mean.cc2 mean.cc3 mean.cc4
#> 1 -0.4861154 2.04273279 -0.9122798 113.19955 -7.939177 -3.199266 4.120387
#> 2 0.5404949 -0.05337164 -1.3325321 114.89566 -8.219827 -3.959138 4.681245
#> 3 2.0664991 3.67950393 -3.2870709 110.12377 -8.559412 -3.285924 2.786486
#> 4 2.1191358 0.34554833 -3.2740412 101.39783 -12.761469 -8.295904 5.481266
#> 5 -2.3613264 -4.73813610 1.0474525 104.62673 -10.888433 -9.114482 5.601466
#> 6 -0.6542713 -0.49587190 -1.1304126 94.15262 -14.153380 -3.537447 7.814291
#> mean.cc5 mean.cc6 mean.cc7 mean.cc8 mean.cc9 mean.cc10 mean.cc11
#> 1 -4.726259 4.207452 -0.8553604 -4.7982098 -2.3751679 -11.264607 3.0985564
#> 2 -5.155946 2.289969 -3.0194127 -2.2512726 0.2386140 -6.722905 2.6382179
#> 3 -4.341298 5.013151 -1.9808976 -3.3131405 -2.4616726 -10.705971 2.8894462
#> 4 -6.176140 1.670929 -1.1332517 0.8320822 -0.6255065 -1.968889 1.9550448
#> 5 -6.799643 1.911823 0.8254871 1.6543395 2.2464023 -4.618549 -2.8079092
#> 6 -10.258582 4.532534 -0.9876238 -1.2827938 3.2104720 -3.048860 -0.6069294
#> mean.cc12 mean.cc13 mean.cc14 mean.cc15 mean.cc16 mean.cc17
#> 1 -0.4467126 -0.7657920 4.60452555 0.94235472 -2.3514493 0.2318763
#> 2 -1.8833857 -0.3242044 2.00343329 -3.18169905 1.8427058 -1.6761584
#> 3 0.9581023 0.3452297 4.57264959 0.60290513 -3.1267562 -0.5234875
#> 4 -0.4003499 0.1558010 -0.96642218 -0.01982832 2.4284422 2.2653495
#> 5 -2.4730017 -3.9486621 0.09665821 2.75462837 3.4770352 -0.8511870
#> 6 -0.8157985 -0.4197169 -0.76869945 1.48406544 -0.3714472 -1.0090512
#> mean.cc18 mean.cc19 mean.cc20 mean.cc21 mean.cc22 mean.cc23 mean.cc24
#> 1 -0.6671743 7.997967 0.668789607 -0.6415378 2.0087210 0.3851994 3.9315266
#> 2 1.1926889 5.273383 -3.197205485 0.2261854 0.1752804 0.4480020 0.8498350
#> 3 0.1628125 4.781565 1.451355441 -0.6183360 0.3812597 1.8577396 2.7927463
#> 4 -0.3583433 -2.195724 0.626388383 1.6219077 -0.4445460 2.1273127 0.7963044
#> 5 -1.6113646 1.505541 0.355868834 -2.5401335 -1.4527925 -2.0170651 -3.1495878
#> 6 -1.3598896 -2.367155 -0.007740216 -0.4077784 0.3242966 -1.7722795 0.2038126
#> mean.cc25 var.cc1 var.cc2 var.cc3 var.cc4 var.cc5 var.cc6 var.cc7
#> 1 -2.438220 39.21008 2.070953 10.07102 25.004330 41.41051 134.29757 228.44671
#> 2 -1.543861 23.34247 2.294833 12.78865 25.558422 56.85797 163.65316 179.51730
#> 3 -3.060039 20.81667 3.115623 13.07580 19.582237 49.02256 140.81817 167.74917
#> 4 -3.234697 21.60639 13.116291 16.49137 22.494334 12.94459 52.92598 42.63822
#> 5 1.726908 23.09798 15.123558 17.46103 12.056544 20.28798 49.01745 52.35854
#> 6 -1.149354 27.49950 3.309704 20.90734 7.756721 16.30287 27.77845 29.34361
#> var.cc8 var.cc9 var.cc10 var.cc11 var.cc12 var.cc13 var.cc14 var.cc15
#> 1 94.908434 76.386035 138.39633 83.03398 29.876386 21.57676 39.05402 30.056266
#> 2 82.123954 61.240740 181.52430 58.16833 29.658785 21.57489 28.80127 42.164783
#> 3 80.701395 32.189461 205.12173 65.05734 25.149615 37.30307 24.73257 37.962457
#> 4 11.675368 16.238239 32.51568 43.10345 11.828904 15.75580 14.39072 24.312511
#> 5 4.775292 17.076494 36.21512 13.79523 9.208385 19.95035 15.69836 26.747861
#> 6 4.570056 7.128759 19.23308 10.14763 10.452876 14.51532 19.90096 7.978399
#> var.cc16 var.cc17 var.cc18 var.cc19 var.cc20 var.cc21 var.cc22 var.cc23
#> 1 119.35358 31.505159 69.265636 98.45217 50.92907 36.102691 7.272967 29.096157
#> 2 102.13704 34.910110 78.128544 95.17125 68.79282 33.957072 5.785868 72.260874
#> 3 97.00508 23.139221 45.457159 33.21711 37.26710 20.750502 10.269237 41.433950
#> 4 18.70611 8.501661 17.012997 22.01938 20.98573 12.098514 11.289852 7.982322
#> 5 52.64480 19.099041 9.395019 22.89027 21.27622 7.577858 11.118885 9.185258
#> 6 7.88226 7.199381 12.645376 48.63872 15.44240 35.126401 8.665264 20.369185
#> var.cc24 var.cc25 skew.cc1 skew.cc2 skew.cc3 skew.cc4 skew.cc5
#> 1 62.46642 47.20023 -0.7388222 0.1819517 -0.8424626 0.23234270 -0.4087082
#> 2 30.86495 59.57412 -0.7535361 -0.3274096 -0.9442204 -0.38514803 0.2554274
#> 3 22.56075 26.77044 -0.6225267 0.6398787 -0.7071045 -0.14396567 0.3246500
#> 4 12.78288 11.84562 -1.1335045 0.2978414 -0.5034189 0.07279951 0.8441109
#> 5 14.86880 18.09226 -0.6548490 0.3913148 -0.3977141 -0.09548085 1.0793999
#> 6 40.01337 30.04012 -0.7358763 0.7887711 -0.3331404 -0.69191425 1.6002095
#> skew.cc6 skew.cc7 skew.cc8 skew.cc9 skew.cc10 skew.cc11
#> 1 -0.01866101 -0.48835920 0.5570190 -0.63056303 0.11565166 0.38681448
#> 2 0.06672828 -0.41338496 0.1241709 -0.20821166 0.13807461 0.14431112
#> 3 0.23289147 -0.44606038 0.5302892 -0.19724554 -0.12690372 0.20297102
#> 4 -0.48436397 -0.84477731 0.2954321 0.08363398 -0.47475280 -0.07805675
#> 5 -0.44185547 -1.45338601 -1.1802099 -0.02441273 -0.09122774 0.01841604
#> 6 0.05700990 -0.04840729 0.3166589 1.06892450 -1.57191096 -0.34711631
#> skew.cc12 skew.cc13 skew.cc14 skew.cc15 skew.cc16 skew.cc17
#> 1 -0.6142467 -0.1484506 -0.106445587 0.12486365 1.3666383 -0.50660097
#> 2 -0.3259585 -0.2312339 -0.164461259 -0.40171343 1.4062080 -0.14329520
#> 3 0.1414025 0.3704042 0.365027997 0.05501897 0.7874996 -0.83632345
#> 4 -0.1383504 -0.4263072 -0.054756497 -0.27919823 -0.6084099 0.25334818
#> 5 0.2636373 -0.1238036 0.007103377 0.13446054 1.2686720 -0.46283989
#> 6 0.2547037 -1.2169558 -0.397347656 -1.14544704 -0.4091171 0.05847849
#> skew.cc18 skew.cc19 skew.cc20 skew.cc21 skew.cc22 skew.cc23
#> 1 0.5491275 -0.03979579 -1.0299131 -0.52011909 0.3048525 0.3693062
#> 2 0.7547712 0.36759686 0.2689195 -0.10428438 -0.8072175 -0.2294949
#> 3 -0.1299190 0.55031159 -0.2687133 0.63878056 -0.2950719 -0.4327213
#> 4 0.4633078 -0.38943000 0.4711683 0.04842276 -0.3781934 0.8276710
#> 5 0.2083102 0.26525228 0.1881902 -0.48154680 -0.2072295 -0.4325777
#> 6 0.4068986 -1.46726807 1.0378404 0.86600536 -0.3745826 -1.2351570
#> skew.cc24 skew.cc25 kurt.cc1 kurt.cc2 kurt.cc3 kurt.cc4 kurt.cc5 kurt.cc6
#> 1 0.07460141 -0.5224114 3.692373 1.438470 3.685870 1.542584 2.026494 1.267189
#> 2 -0.48588119 0.3592784 2.807812 2.035873 3.785911 2.017039 1.748489 1.326794
#> 3 -0.32218991 -0.3133332 1.982351 1.938390 3.061307 1.581973 1.774037 1.374422
#> 4 0.39146058 0.1716544 3.444364 1.373735 1.833495 1.266572 2.189092 2.126287
#> 5 1.49431039 0.7216276 2.319423 1.228036 1.258907 2.209629 3.188262 1.574108
#> 6 1.20879138 -1.2868775 2.330985 2.014690 1.543509 2.685203 4.488608 1.207101
#> kurt.cc7 kurt.cc8 kurt.cc9 kurt.cc10 kurt.cc11 kurt.cc12 kurt.cc13 kurt.cc14
#> 1 1.575220 1.693552 2.661247 1.220348 1.759860 2.075862 2.770308 1.749640
#> 2 1.566243 1.346922 1.940861 1.948459 1.161452 2.587980 1.400122 1.721571
#> 3 1.719963 2.034883 2.672801 1.588426 1.982298 2.009586 2.899741 1.784707
#> 4 2.962703 2.676028 1.299919 2.651348 1.538738 1.274102 1.499599 1.413677
#> 5 3.813506 3.867286 1.843679 3.033589 1.684377 1.484912 2.036914 1.822548
#> 6 1.770796 1.924167 2.951370 4.853628 1.966645 1.841446 3.301255 1.720128
#> kurt.cc15 kurt.cc16 kurt.cc17 kurt.cc18 kurt.cc19 kurt.cc20 kurt.cc21
#> 1 1.291308 3.581792 1.795662 3.011537 1.783469 3.140739 2.786548
#> 2 2.342942 3.744191 1.669686 2.695255 1.504540 1.806701 1.935296
#> 3 2.125656 2.501337 3.783112 1.992832 1.983839 1.977878 2.070000
#> 4 1.912687 2.662871 1.319669 1.885780 1.523207 2.189645 1.437228
#> 5 1.473286 3.516086 1.753017 2.490501 1.545868 1.560605 1.676822
#> 6 3.296963 1.413143 1.830883 1.621089 4.502698 3.455573 2.576168
#> kurt.cc22 kurt.cc23 kurt.cc24 kurt.cc25 mean.d1.cc var.d1.cc mean.d2.cc
#> 1 1.698707 1.750416 1.860362 2.185622 -180.0812 149674.3 2575.527
#> 2 2.680944 2.145128 2.265519 2.407302 -182.5251 155809.8 2665.290
#> 3 2.403744 2.704935 2.349213 2.172382 -175.9519 140683.8 2501.807
#> 4 1.830708 2.934473 2.107674 1.589294 -160.5609 118844.1 2321.431
#> 5 1.761313 2.417847 4.319930 2.391357 -160.9951 127833.3 2566.415
#> 6 3.241118 3.767870 4.239549 3.974242 -148.0187 102672.1 2228.953
#> var.d2.cc
#> 1 17080568
#> 2 17909354
#> 3 16438780
#> 4 14648211
#> 5 14220803
#> 6 12182912