File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import librosa
2
+ import numpy as np
3
+
4
+
5
+ def acoustic_complexity_index (S ):
6
+ spectrogram = np .abs (S )** 2
7
+ flux = np .abs (np .diff (spectrogram , axis = 1 ))
8
+ return np .sum (flux , axis = 1 )/ np .sum (spectrogram , axis = 1 )
9
+
10
+
11
+ def average_energy (S ):
12
+ spectrogram = np .abs (S )** 2
13
+ return np .sqrt (np .mean (spectrogram , axis = 1 ))
14
+
15
+
16
+ def entropy_based_concentration (S ):
17
+ spectrogram = np .abs (S )** 2
18
+ entropy = np .array ([scipy .stats .entropy (row ) for row in spectrogram ])
19
+ return (1 - entropy / np .log (spectrogram .shape [1 ]))
20
+
21
+
22
+ def maximum_energy (S ):
23
+ spectrogram = np .abs (S )** 2
24
+ return np .max (spectrogram , axis = 1 )
25
+
26
+
27
+ def maximum_flux (S ):
28
+ spectrogram = np .abs (S )** 2
29
+ flux = np .abs (np .diff (spectrogram , axis = 1 ))
30
+ return np .max (flux , axis = 1 )
You can’t perform that action at this time.
0 commit comments