This library is developed with focus on audio signals but it's base functionality is generalized to all kinds of (time)-signals.
The key advantages of this library are:
-
SigFeat provides an appropriate and simple abstraction layer for the feature extraction problem:
-
SigFeat minimizes computational cost by avoiding repeated computation of (interim) results. (For instance if many features depend on a result of another feature, this feature result is only computed once. Simple example: all Spectral features use one FFT output.)
-
SigFeat has a low memory footprint due to generators (except your own defined features blow up memory or your sources load all data at once...).
See the examples folder, the feature, source and sink subpackage to check the intended usage of the library.
Some parts of the library (the parameters module) are inspired by luigi.
from pylab import plt, np
from sigfeat import Extractor
from sigfeat.feature import SpectralFlux, SpectralCentroid, SpectralFlatness
from sigfeat.source.soundfile import SoundFileSource
from sigfeat.preprocess import MeanMix
from sigfeat.sink import DefaultDictSink
extractor = Extractor(
SpectralFlux(),
SpectralCentroid(),
SpectralFlatness(),
)
source = MeanMix(SoundFileSource('bonsai.wav'))
sink = extractor.extract(source, DefaultDictSink())
plt.figure()
for label, result in sink['results'].items():
plt.plot(result), label=str(label))
plt.legend()
plt.show()
The main base classes are: Source, Feature, Extractor and Sink.
Seven principal classes build up the whole framework:
- Feature
- Source
- Sink
- Extractor
- Preprocess
- Parameter
- Result
Additionally to the basic framework, some commonly known features, useful sources and sinks are implemented. But it is not the focus of this project to provide a complete feature collection. It is up to the user to define own features, sources and sinks. This framework allows many different usage scenarios... be creative.
The base framework only depends on six (sigfeat.base and sigfeat.extractor).
The namespaces sigfeat.feature .source and .preprocess depend on the scipy stack, soundfile and pyfilterbank. It depends on which submodules are used.