pumpp.task.ChordTagTransformer

class pumpp.task.ChordTagTransformer(name='chord', vocab='3567s', sr=22050, hop_length=512, sparse=False, p_self=None, p_init=None, p_state=None)[source]

Chord transformer that uses a tag-space encoding for chord labels.

Notes

The number of chord classes (n_labels) depends on the vocabulary:

  • ‘3’ => 2 + 12 * 2 = 26
  • ‘35’ => 2 + 12 * 4 = 50
  • ‘356’ => 2 + 12 * 6 = 74
  • ‘3567’ => 2 + 12 * 12 = 146
  • ‘3567s’ => 2 + 12 * 14 = 170
Attributes:
name : str

name of the transformer

vocab : str

A string of chord quality indicators to include:

  • ‘3’: maj/min
  • ‘5’: ‘3’ + aug/dim
  • ‘6’: ‘3’ + ‘5’ + maj6/min6
  • ‘7’: ‘3’ + ‘5’ + ‘6’ + 7/min7/maj7/dim7/hdim7/minmaj7
  • ‘s’: sus2/sus4

Note: 5 requires 3, 6 requires 5, 7 requires 6.

sr : number > 0

Sampling rate of audio

hop_length : int > 0

Hop length for annotation frames

p_self : None, float in (0, 1), or np.ndarray [shape=(n_labels,)]

Optional self-loop probability(ies), used for Viterbi decoding

p_state : None or np.ndarray [shape=(n_labels,)]

Optional marginal probability for each chord class

p_init : None or np.ndarray [shape=(n_labels,)]

Optional initial probability for each chord class

__init__(name='chord', vocab='3567s', sr=22050, hop_length=512, sparse=False, p_self=None, p_init=None, p_state=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([name, vocab, sr, hop_length, …]) Initialize self.
decode_events(encoded[, transition, …]) Decode labeled events into (time, value) pairs
decode_intervals(encoded[, duration, multi, …]) Decode labeled intervals into (start, end, value) triples
empty(duration) Empty chord annotations
encode_events(duration, events, values[, dtype]) Encode labeled events as a time-series matrix.
encode_intervals(duration, intervals, values) Encode labeled intervals as a time-series matrix.
inverse(encoded[, duration]) Inverse transformation
merge(data) Merge an array of output dictionaries into a single dictionary with properly scoped names.
pop(field)
register(field, shape, dtype) Register a field as a tensor with specified shape and type.
scope(key) Apply the name scope to a key
set_transition(p_self) Set the transition matrix according to self-loop probabilities.
simplify(chord) Simplify a chord string down to the vocabulary space
transform(jam[, query]) Transform jam object to make data for this task
transform_annotation(ann, duration) Transform an annotation to chord-tag encoding
vocabulary()