Skip to content

Instantly share code, notes, and snippets.

@0xfe
Created February 23, 2020 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xfe/29aedb7cc2733e7bde767eebcdd1d204 to your computer and use it in GitHub Desktop.
Save 0xfe/29aedb7cc2733e7bde767eebcdd1d204 to your computer and use it in GitHub Desktop.
Build Training Data for Deep Pitches
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