Commit 697d094e authored by Accraze's avatar Accraze
Browse files

Add basic generation script

parent 0decbba9
from magenta.models.nsynth import utils
from magenta.models.nsynth.wavenet import fastgen
def load_encoding(fname, sample_length=None, sr=16000, ckpt='model.ckpt-200000'):
# load the audio file
audio = utils.load_audio(fname, sample_length=sample_length, sr=sr)
# encode
encoding = fastgen.encode(audio, ckpt, sample_length)
return audio, encoding
def synthesize():
fname = 'Drum_(avk).wav'
sample_length = 1000
audio, encoding = load_encoding(fname, sample_length=sample_length)
fastgen.synthesize(encoding, save_paths=['new-audio.wav'], samples_per_save=sample_length)
if __name__ == "__main__":
synthesize()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment