|
@@ -162,6 +162,19 @@ class RandomFeatureExtractor(FeatureExtractor): |
|
|
start = random.random() * file.duration() - duration |
|
|
start = random.random() * file.duration() - duration |
|
|
self.features.append(Feature(interval=Interval(start=start, duration=duration), |
|
|
self.features.append(Feature(interval=Interval(start=start, duration=duration), |
|
|
source="random", path=file.path)) |
|
|
source="random", path=file.path)) |
|
|
|
|
|
class LoudAudioFeatureExtractor(FeatureExtractor): |
|
|
|
|
|
"""Feature extractor for loud audio detection. |
|
|
|
|
|
|
|
|
|
|
|
This class is responsible for extracting features corresponding to loud audio in media files. |
|
|
|
|
|
|
|
|
|
|
|
Here: |
|
|
|
|
|
|
|
|
|
|
|
setup() is used to validate input files & config, and extracting audio |
|
|
|
|
|
|
|
|
|
|
|
run() uses pyloudnorm to detect loud audio |
|
|
|
|
|
|
|
|
|
|
|
teardown() is used to clean up temporary files created during setup (if specified by config) |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
def teardown(self): |
|
|
def teardown(self): |
|
|
pass |
|
|
pass |