pumpp.core.Pump¶
-
class
pumpp.core.
Pump
(*ops)[source]¶ Top-level pump object.
This class is used to collect feature and task transformers
See also
Examples
Create a CQT and chord transformer
>>> p_cqt = pumpp.feature.CQT('cqt', sr=44100, hop_length=1024) >>> p_chord = pumpp.task.ChordTagTransformer(sr=44100, hop_length=1024) >>> pump = pumpp.Pump(p_cqt, p_chord) >>> data = pump.transform('/my/audio/file.mp3', '/my/jams/annotation.jams')
Access all the fields produced by this pump:
>>> pump.fields {'chord/chord': Tensor(shape=(None, 170), dtype=<class 'bool'>), 'cqt/mag': Tensor(shape=(None, 288), dtype=<class 'numpy.float32'>), 'cqt/phase': Tensor(shape=(None, 288), dtype=<class 'numpy.float32'>)}
Access a constituent operator by name:
>>> pump['chord'].fields {'chord/chord': Tensor(shape=(None, 170), dtype=<class 'bool'>)}
Attributes
ops (list of (BaseTaskTransformer, FeatureExtractor)) The operations to apply Methods
__init__
(*ops)add
(op)Add an operation to this pump. layers
()Construct Keras input layers for all feature transformers in the pump. sampler
(n_samples, duration)Construct a sampler object for this pump’s operators. transform
(audio_f[, jam])Apply the transformations to an audio file, and optionally JAMS object. Attributes
fields