我尝试用洋红色的music_vae插入2个旋律。 首先,我创建旋律:
teapot = music_pb2.NoteSequence()
teapot.notes.add(pitch=69, start_time=0, end_time=0.5, velocity=80)
teapot.notes.add(pitch=71, start_time=0.5, end_time=1, velocity=80)
teapot.notes.add(pitch=73, start_time=1, end_time=1.5, velocity=80)
teapot.notes.add(pitch=74, start_time=1.5, end_time=2, velocity=80)
teapot.notes.add(pitch=76, start_time=2, end_time=2.5, velocity=80)
teapot.notes.add(pitch=81, start_time=3, end_time=4, velocity=80)
teapot.notes.add(pitch=78, start_time=4, end_time=5, velocity=80)
teapot.notes.add(pitch=81, start_time=5, end_time=6, velocity=80)
teapot.notes.add(pitch=76, start_time=6, end_time=8, velocity=80)
teapot.total_time = 8
teapot.tempos.add(qpm=80)
melody = music_pb2.NoteSequence()
melody.notes.add(pitch=55, start_time=0, end_time=0.375, velocity=80)
melody.notes.add(pitch=62, start_time=0.375, end_time=0.75, velocity=80)
melody.notes.add(pitch=60, start_time=0.75, end_time=1.0, velocity=80)
melody.notes.add(pitch=59, start_time=1.0, end_time=1.375, velocity=80)
melody.notes.add(pitch=60, start_time=1.375, end_time=1.75, velocity=80)
melody.notes.add(pitch=62, start_time=1.75, end_time=2.0, velocity=80)
melody.notes.add(pitch=65, start_time=2.0, end_time=2.25, velocity=80)
melody.notes.add(pitch=64, start_time=2.25, end_time=2.75, velocity=80)
melody.notes.add(pitch=60, start_time=2.75, end_time=3.0, velocity=80)
melody.notes.add(pitch=62, start_time=3.0, end_time=3.5, velocity=80)
melody.notes.add(pitch=62, start_time=3.5, end_time=3.75, velocity=80)
melody.notes.add(pitch=64, start_time=3.75, end_time=4.0, velocity=80)
melody.notes.add(pitch=65, start_time=4.0, end_time=4.25, velocity=80)
melody.notes.add(pitch=64, start_time=4.25, end_time=4.75, velocity=80)
melody.notes.add(pitch=60, start_time=4.75, end_time=5.0, velocity=80)
melody.notes.add(pitch=65, start_time=5.0, end_time=5.25, velocity=80)
melody.notes.add(pitch=64, start_time=5.25, end_time=5.75, velocity=80)
melody.notes.add(pitch=60, start_time=5.75, end_time=6.0, velocity=80)
melody.notes.add(pitch=55, start_time=6.0, end_time=6.375, velocity=80)
melody.notes.add(pitch=57, start_time=6.375, end_time=6.75, velocity=80)
melody.notes.add(pitch=59, start_time=6.75, end_time=7.0, velocity=80)
melody.notes.add(pitch=60, start_time=7.0, end_time=7.375, velocity=80)
melody.notes.add(pitch=59, start_time=7.375, end_time=7.75, velocity=80)
melody.notes.add(pitch=57, start_time=7.75, end_time=8.0, velocity=80)
melody.total_time = 8
melody.tempos.add(qpm=80)
然后,我尝试进行插值:
note_sequences = music_vae.interpolate(
teapot,
melody,
num_steps= 8,
length=32, assert_same_length=False)
然后出现以下异常:
MultipleExtractedExamplesException: Multiple (2) examples extracted from NoteSequence: tempos {
qpm: 80.0
}...
在“ Hello Magenta”彩色记事本(https://colab.research.google.com/notebooks/magenta/hello_magenta/hello_magenta.ipynb#scrollTo=71dgCmmBli-s)中,有2个示例旋律: 茶壶和twinkle_twinkle。我可以插值他们没有问题。但是当我尝试将我的旋律插进茶壶旋律时,我得到了例外。