mfcc_stats calculates descriptive statistics on Mel-frequency cepstral coefficients and its derivatives.

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 .wav files, 2) "sel": number of the selections, 3) "start": start time of selections, 4) "end": end time of selections. The output of manualoc or autodetec can be used as the input data frame.

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.

See also

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 min.cc6 #> 1 Phae.long1.wav 1 97.417 -9.7417 -11.326 -2.47753 -16.443 -12.6694 #> 2 Phae.long1.wav 2 103.663 -11.2043 -13.114 -5.15668 -16.876 -17.4960 #> 3 Phae.long1.wav 3 101.566 -10.7963 -12.126 -3.92420 -15.481 -12.4941 #> 4 Phae.long2.wav 1 90.356 -17.7384 -15.980 -0.37968 -9.828 -12.7483 #> 5 Phae.long2.wav 2 94.590 -15.3372 -15.050 -0.89821 -11.579 -10.8283 #> 6 Phae.long3.wav 1 83.587 -16.1664 -11.606 1.79005 -13.429 -1.7881 #> min.cc7 min.cc8 min.cc9 min.cc10 min.cc11 min.cc12 min.cc13 min.cc14 #> 1 -25.511 -16.1220 -21.16526 -26.857 -8.3119 -11.1618 -10.8940 -6.5481 #> 2 -25.705 -14.4857 -14.97421 -30.107 -7.2525 -13.7504 -7.4693 -7.5172 #> 3 -25.117 -15.9793 -14.63576 -34.173 -10.4335 -6.5133 -10.4282 -2.1007 #> 4 -15.835 -5.1498 -6.29909 -13.848 -7.5440 -4.8104 -5.9638 -6.3195 #> 5 -16.906 -3.6820 -4.85938 -16.720 -8.5940 -5.9926 -12.1070 -6.5437 #> 6 -10.024 -4.2278 0.74387 -14.489 -6.7042 -5.6819 -9.4316 -9.1347 #> min.cc15 min.cc16 min.cc17 min.cc18 min.cc19 min.cc20 min.cc21 min.cc22 #> 1 -6.2285 -12.3513 -10.0119 -14.2100 -10.6741 -14.9360 -14.6605 -1.8313 #> 2 -15.9245 -7.0587 -12.6436 -10.4482 -5.0834 -14.8620 -10.5990 -4.7999 #> 3 -10.3434 -16.1667 -12.8087 -10.4314 -2.2894 -8.5754 -6.6494 -5.3714 #> 4 -8.9331 -6.7632 -1.1826 -6.1493 -9.4575 -5.3792 -3.1398 -6.1122 #> 5 -4.6796 -3.7155 -8.8115 -6.9704 -4.0900 -6.0626 -7.5087 -7.2206 #> 6 -5.1532 -4.3228 -4.8781 -5.8303 -20.2245 -4.7536 -6.7824 -6.0124 #> min.cc23 min.cc24 min.cc25 max.cc1 max.cc2 max.cc3 max.cc4 max.cc5 max.cc6 #> 1 -7.0744 -10.6023 -15.4990 123.88 -5.4711 1.60427 13.2078 3.76582 18.4008 #> 2 -15.6091 -11.2131 -13.2577 121.79 -5.9163 0.79886 12.4152 7.57703 19.2277 #> 3 -11.9815 -5.8687 -13.1678 115.90 -5.0117 1.50367 9.9338 7.83447 21.5439 #> 4 -1.4697 -4.5173 -8.2960 106.45 -7.3991 -3.28125 12.5126 1.16929 11.5517 #> 5 -8.2425 -6.9715 -3.5057 110.41 -5.2621 -4.71289 11.4231 3.67593 9.4078 #> 6 -12.7816 -8.8597 -14.7183 101.15 -10.7341 2.17990 11.5019 0.12716 11.6201 #> max.cc7 max.cc8 max.cc9 max.cc10 max.cc11 max.cc12 max.cc13 max.cc14 max.cc15 #> 1 14.6932 13.3962 11.9507 4.7159 18.4629 6.6513 7.9895 13.9944 9.6660 #> 2 13.6134 10.9355 11.7035 18.5171 13.4605 7.2546 5.5053 9.5593 7.0312 #> 3 14.1264 13.2355 7.2257 11.4341 18.7225 10.8576 13.9117 14.3600 12.3817 #> 4 7.1055 7.7110 5.1660 6.5554 11.7939 4.0356 5.4557 4.8121 7.4723 #> 5 6.7814 4.3860 9.1383 6.9590 3.0785 2.7709 3.2625 6.4989 10.7008 #> 6 7.7472 2.7486 9.2736 2.2103 3.4996 5.0360 2.5781 3.8467 4.2362 #> max.cc16 max.cc17 max.cc18 max.cc19 max.cc20 max.cc21 max.cc22 max.cc23 #> 1 23.7560 6.7890 18.6227 22.7735 10.7107 8.40296 6.3737 9.9940 #> 2 27.7287 6.2624 21.1320 22.2984 12.7236 9.57211 3.2672 15.5622 #> 3 16.9080 7.4593 11.8394 16.7565 12.3165 8.30017 6.2049 13.4299 #> 4 8.8235 6.5561 7.3428 4.3161 9.7768 6.20314 4.6594 8.4619 #> 5 20.8768 4.8537 4.3828 8.9790 8.1171 0.62027 3.6626 2.5314 #> 6 3.2703 3.4486 4.2400 5.3791 9.2913 12.50548 5.6357 3.0252 #> max.cc24 max.cc25 median.cc1 median.cc2 median.cc3 median.cc4 median.cc5 #> 1 15.8190 8.6579 113.835 -8.0261 -2.8716 4.3533 -3.6336 #> 2 7.1115 15.0964 116.795 -8.1947 -3.9991 5.9005 -6.2855 #> 3 11.1255 5.7021 110.896 -9.0808 -3.2576 3.8050 -5.5985 #> 4 7.6037 2.5171 101.951 -14.1062 -7.1472 6.4139 -7.3594 #> 5 6.6580 10.6598 105.145 -12.9319 -7.6666 5.3374 -8.1013 #> 6 15.9098 4.6763 95.202 -14.9393 -2.3918 7.9965 -10.9850 #> median.cc6 median.cc7 median.cc8 median.cc9 median.cc10 median.cc11 #> 1 2.5899 2.44907 -8.26946 -1.21325 -13.5422 3.152064 #> 2 -1.6390 2.35215 -5.95054 1.55065 -11.1077 -0.833450 #> 3 1.3399 2.33985 -4.72416 -2.57158 -12.4882 2.559736 #> 4 1.6000 -0.64942 0.50661 -0.86712 -1.2171 1.625364 #> 5 4.0256 3.00800 1.89719 2.11931 -4.7346 -2.529524 #> 6 4.3938 -0.85358 -1.46187 2.65019 -2.3387 -0.098457 #> median.cc12 median.cc13 median.cc14 median.cc15 median.cc16 median.cc17 #> 1 1.31459 -1.12050 3.81167 1.00657 -5.57296 2.505039 #> 2 -2.91860 1.35273 2.28735 -3.00804 -2.12249 -2.843574 #> 3 1.67296 0.59386 3.26307 0.82562 -4.68510 -0.070648 #> 4 -0.55557 1.37377 -0.83321 0.80258 2.86407 1.500041 #> 5 -2.68374 -4.08117 -0.47249 2.11866 0.60130 0.442500 #> 6 -0.86474 1.02969 -0.69007 2.05427 0.20101 -1.225958 #> median.cc18 median.cc19 median.cc20 median.cc21 median.cc22 median.cc23 #> 1 -1.116398 5.77593 2.325125 -0.85403 1.49351 -0.48612 #> 2 -1.372212 3.27274 -4.398830 0.45476 0.52074 0.54049 #> 3 -0.023929 2.92016 2.678858 -2.03840 0.92587 2.06650 #> 4 -1.773933 -0.94547 0.881692 1.38355 0.59043 2.11914 #> 5 -2.005725 1.19932 0.263936 -2.09499 -1.05778 -2.36133 #> 6 -1.554989 -2.07077 -0.086817 -1.71150 0.18644 -0.65427 #> median.cc24 median.cc25 mean.cc1 mean.cc2 mean.cc3 mean.cc4 mean.cc5 mean.cc6 #> 1 2.042733 -0.91228 113.200 -7.9392 -3.1993 4.1204 -4.7263 4.2075 #> 2 -0.053372 -1.33253 114.896 -8.2198 -3.9591 4.6812 -5.1559 2.2900 #> 3 3.679504 -3.28707 110.124 -8.5594 -3.2859 2.7865 -4.3413 5.0132 #> 4 0.345548 -3.27404 101.398 -12.7615 -8.2959 5.4813 -6.1761 1.6709 #> 5 -4.738136 1.04745 104.627 -10.8884 -9.1145 5.6015 -6.7996 1.9118 #> 6 -0.495872 -1.13041 94.153 -14.1534 -3.5374 7.8143 -10.2586 4.5325 #> mean.cc7 mean.cc8 mean.cc9 mean.cc10 mean.cc11 mean.cc12 mean.cc13 mean.cc14 #> 1 -0.85536 -4.79821 -2.37517 -11.2646 3.09856 -0.44671 -0.76579 4.604526 #> 2 -3.01941 -2.25127 0.23861 -6.7229 2.63822 -1.88339 -0.32420 2.003433 #> 3 -1.98090 -3.31314 -2.46167 -10.7060 2.88945 0.95810 0.34523 4.572650 #> 4 -1.13325 0.83208 -0.62551 -1.9689 1.95504 -0.40035 0.15580 -0.966422 #> 5 0.82549 1.65434 2.24640 -4.6185 -2.80791 -2.47300 -3.94866 0.096658 #> 6 -0.98762 -1.28279 3.21047 -3.0489 -0.60693 -0.81580 -0.41972 -0.768699 #> mean.cc15 mean.cc16 mean.cc17 mean.cc18 mean.cc19 mean.cc20 mean.cc21 #> 1 0.942355 -2.35145 0.23188 -0.66717 7.9980 0.6687896 -0.64154 #> 2 -3.181699 1.84271 -1.67616 1.19269 5.2734 -3.1972055 0.22619 #> 3 0.602905 -3.12676 -0.52349 0.16281 4.7816 1.4513554 -0.61834 #> 4 -0.019828 2.42844 2.26535 -0.35834 -2.1957 0.6263884 1.62191 #> 5 2.754628 3.47704 -0.85119 -1.61136 1.5055 0.3558688 -2.54013 #> 6 1.484065 -0.37145 -1.00905 -1.35989 -2.3672 -0.0077402 -0.40778 #> mean.cc22 mean.cc23 mean.cc24 mean.cc25 var.cc1 var.cc2 var.cc3 var.cc4 #> 1 2.00872 0.3852 3.93153 -2.4382 39.210 2.0710 10.071 25.0043 #> 2 0.17528 0.4480 0.84983 -1.5439 23.342 2.2948 12.789 25.5584 #> 3 0.38126 1.8577 2.79275 -3.0600 20.817 3.1156 13.076 19.5822 #> 4 -0.44455 2.1273 0.79630 -3.2347 21.606 13.1163 16.491 22.4943 #> 5 -1.45279 -2.0171 -3.14959 1.7269 23.098 15.1236 17.461 12.0565 #> 6 0.32430 -1.7723 0.20381 -1.1494 27.500 3.3097 20.907 7.7567 #> var.cc5 var.cc6 var.cc7 var.cc8 var.cc9 var.cc10 var.cc11 var.cc12 var.cc13 #> 1 41.411 134.298 228.447 94.9084 76.3860 138.396 83.034 29.8764 21.577 #> 2 56.858 163.653 179.517 82.1240 61.2407 181.524 58.168 29.6588 21.575 #> 3 49.023 140.818 167.749 80.7014 32.1895 205.122 65.057 25.1496 37.303 #> 4 12.945 52.926 42.638 11.6754 16.2382 32.516 43.103 11.8289 15.756 #> 5 20.288 49.017 52.359 4.7753 17.0765 36.215 13.795 9.2084 19.950 #> 6 16.303 27.778 29.344 4.5701 7.1288 19.233 10.148 10.4529 14.515 #> var.cc14 var.cc15 var.cc16 var.cc17 var.cc18 var.cc19 var.cc20 var.cc21 #> 1 39.054 30.0563 119.3536 31.5052 69.266 98.452 50.929 36.1027 #> 2 28.801 42.1648 102.1370 34.9101 78.129 95.171 68.793 33.9571 #> 3 24.733 37.9625 97.0051 23.1392 45.457 33.217 37.267 20.7505 #> 4 14.391 24.3125 18.7061 8.5017 17.013 22.019 20.986 12.0985 #> 5 15.698 26.7479 52.6448 19.0990 9.395 22.890 21.276 7.5779 #> 6 19.901 7.9784 7.8823 7.1994 12.645 48.639 15.442 35.1264 #> var.cc22 var.cc23 var.cc24 var.cc25 skew.cc1 skew.cc2 skew.cc3 skew.cc4 #> 1 7.2730 29.0962 62.466 47.200 -0.73882 0.18195 -0.84246 0.232343 #> 2 5.7859 72.2609 30.865 59.574 -0.75354 -0.32741 -0.94422 -0.385148 #> 3 10.2692 41.4340 22.561 26.770 -0.62253 0.63988 -0.70710 -0.143966 #> 4 11.2899 7.9823 12.783 11.846 -1.13350 0.29784 -0.50342 0.072800 #> 5 11.1189 9.1853 14.869 18.092 -0.65485 0.39131 -0.39771 -0.095481 #> 6 8.6653 20.3692 40.013 30.040 -0.73588 0.78877 -0.33314 -0.691914 #> skew.cc5 skew.cc6 skew.cc7 skew.cc8 skew.cc9 skew.cc10 skew.cc11 skew.cc12 #> 1 -0.40871 -0.018661 -0.488359 0.55702 -0.630563 0.115652 0.386814 -0.61425 #> 2 0.25543 0.066728 -0.413385 0.12417 -0.208212 0.138075 0.144311 -0.32596 #> 3 0.32465 0.232891 -0.446060 0.53029 -0.197246 -0.126904 0.202971 0.14140 #> 4 0.84411 -0.484364 -0.844777 0.29543 0.083634 -0.474753 -0.078057 -0.13835 #> 5 1.07940 -0.441855 -1.453386 -1.18021 -0.024413 -0.091228 0.018416 0.26364 #> 6 1.60021 0.057010 -0.048407 0.31666 1.068925 -1.571911 -0.347116 0.25470 #> skew.cc13 skew.cc14 skew.cc15 skew.cc16 skew.cc17 skew.cc18 skew.cc19 #> 1 -0.14845 -0.1064456 0.124864 1.36664 -0.506601 0.54913 -0.039796 #> 2 -0.23123 -0.1644613 -0.401713 1.40621 -0.143295 0.75477 0.367597 #> 3 0.37040 0.3650280 0.055019 0.78750 -0.836323 -0.12992 0.550312 #> 4 -0.42631 -0.0547565 -0.279198 -0.60841 0.253348 0.46331 -0.389430 #> 5 -0.12380 0.0071034 0.134461 1.26867 -0.462840 0.20831 0.265252 #> 6 -1.21696 -0.3973477 -1.145447 -0.40912 0.058478 0.40690 -1.467268 #> skew.cc20 skew.cc21 skew.cc22 skew.cc23 skew.cc24 skew.cc25 kurt.cc1 kurt.cc2 #> 1 -1.02991 -0.520119 0.30485 0.36931 0.074601 -0.52241 3.6924 1.4385 #> 2 0.26892 -0.104284 -0.80722 -0.22949 -0.485881 0.35928 2.8078 2.0359 #> 3 -0.26871 0.638781 -0.29507 -0.43272 -0.322190 -0.31333 1.9824 1.9384 #> 4 0.47117 0.048423 -0.37819 0.82767 0.391461 0.17165 3.4444 1.3737 #> 5 0.18819 -0.481547 -0.20723 -0.43258 1.494310 0.72163 2.3194 1.2280 #> 6 1.03784 0.866005 -0.37458 -1.23516 1.208791 -1.28688 2.3310 2.0147 #> kurt.cc3 kurt.cc4 kurt.cc5 kurt.cc6 kurt.cc7 kurt.cc8 kurt.cc9 kurt.cc10 #> 1 3.6859 1.5426 2.0265 1.2672 1.5752 1.6936 2.6612 1.2203 #> 2 3.7859 2.0170 1.7485 1.3268 1.5662 1.3469 1.9409 1.9485 #> 3 3.0613 1.5820 1.7740 1.3744 1.7200 2.0349 2.6728 1.5884 #> 4 1.8335 1.2666 2.1891 2.1263 2.9627 2.6760 1.2999 2.6513 #> 5 1.2589 2.2096 3.1883 1.5741 3.8135 3.8673 1.8437 3.0336 #> 6 1.5435 2.6852 4.4886 1.2071 1.7708 1.9242 2.9514 4.8536 #> kurt.cc11 kurt.cc12 kurt.cc13 kurt.cc14 kurt.cc15 kurt.cc16 kurt.cc17 #> 1 1.7599 2.0759 2.7703 1.7496 1.2913 3.5818 1.7957 #> 2 1.1615 2.5880 1.4001 1.7216 2.3429 3.7442 1.6697 #> 3 1.9823 2.0096 2.8997 1.7847 2.1257 2.5013 3.7831 #> 4 1.5387 1.2741 1.4996 1.4137 1.9127 2.6629 1.3197 #> 5 1.6844 1.4849 2.0369 1.8225 1.4733 3.5161 1.7530 #> 6 1.9666 1.8414 3.3013 1.7201 3.2970 1.4131 1.8309 #> kurt.cc18 kurt.cc19 kurt.cc20 kurt.cc21 kurt.cc22 kurt.cc23 kurt.cc24 #> 1 3.0115 1.7835 3.1407 2.7865 1.6987 1.7504 1.8604 #> 2 2.6953 1.5045 1.8067 1.9353 2.6809 2.1451 2.2655 #> 3 1.9928 1.9838 1.9779 2.0700 2.4037 2.7049 2.3492 #> 4 1.8858 1.5232 2.1896 1.4372 1.8307 2.9345 2.1077 #> 5 2.4905 1.5459 1.5606 1.6768 1.7613 2.4178 4.3199 #> 6 1.6211 4.5027 3.4556 2.5762 3.2411 3.7679 4.2395 #> kurt.cc25 mean.d1.cc var.d1.cc mean.d2.cc var.d2.cc #> 1 2.1856 -180.08 149674 2575.5 17080568 #> 2 2.4073 -182.53 155810 2665.3 17909354 #> 3 2.1724 -175.95 140684 2501.8 16438780 #> 4 1.5893 -160.56 118844 2321.4 14648211 #> 5 2.3914 -161.00 127833 2566.4 14220803 #> 6 3.9742 -148.02 102672 2229.0 12182912