in transformer-xl/utils/performance_event_repo.py [0:0]
def __init__(self, steps_per_second=100, num_velocity_bins=32, min_pitch=MIN_PITCH, max_pitch=MAX_PITCH,
stretch_factors=[1.0], pitch_transpose_lower=0, pitch_transpose_upper=0):
self._steps_per_second = steps_per_second
self._num_velocity_bins = num_velocity_bins
# Load the Performance vocab
f = open(PERFORMANCE_VOCAB_PATH, "r")
self.contents = f.readlines()
self.ids_to_events = {key: value.strip() for key, value in enumerate(self.contents)}
self.events_to_ids = {value.strip(): key for key, value in enumerate(self.contents)}
self.stretch_factors = stretch_factors
self.transpose_amounts = list(range(pitch_transpose_lower,
pitch_transpose_upper + 1))
self.augment_params = itertools.product(
self.stretch_factors, self.transpose_amounts)
self.augment_fns = [
functools.partial(augment_note_sequence,
stretch_factor=s, transpose_amount=t, min_pitch=min_pitch, max_pitch=max_pitch)
for s, t in self.augment_params
]
self.min_pitch, self.max_pitch = min_pitch, max_pitch