Created
February 23, 2020 03:16
-
-
Save 0xfe/29aedb7cc2733e7bde767eebcdd1d204 to your computer and use it in GitHub Desktop.
Build Training Data for Deep Pitches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for octave in range(2, 8): | |
random.shuffle(GM_PATCHES) | |
for patch in range(0, 15): | |
program = GM_PATCHES[patch] | |
for key in Note.names: | |
sample = Sample("samples/note-%s%s-P%s" % (key, octave, program), | |
program=program, key=key, octave=octave) | |
sample.make_wav() | |
for pitch_shift_hz in np.concatenate((np.array([0]), np.random.randint(10, 80, 5))): | |
sample.transform_wav( | |
"attack", duration=0.33, pitch_shift_hz=pitch_shift_hz) | |
sample.transform_wav( | |
"sustain", start_s=0.33, duration=0.33, pitch_shift_hz=pitch_shift_hz) | |
sample.transform_wav( | |
"decay", start_s=0.66, duration=0.33, pitch_shift_hz=pitch_shift_hz) | |
sample.clean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment