note_dataに格納しているデータを
Amusic.notesへ格納したいのですが、うまくいきません
やり方を教えていただけますか。
#動作環境
グーグルコラボレートリー
#note_dataに格納されている内容 ['(start_time=0.000000, end_time=0.205469, pitch=60, velocity=64)', '(start_time=0.432552, end_time=0.646875, pitch=62, velocity=64)', '(start_time=0.882552, end_time=1.072135, pitch=64, velocity=64)', '(start_time=1.340625, end_time=1.529688, pitch=65, velocity=64)', '(start_time=1.799219, end_time=1.971615, pitch=65, velocity=64)', '(start_time=2.248958, end_time=2.455469, pitch=65, velocity=64)', '(start_time=2.665885, end_time=2.721875, pitch=64, velocity=64)', '(start_time=2.857031, end_time=2.913542, pitch=62, velocity=64)', '(start_time=3.080990, end_time=3.430208, pitch=60, velocity=64)']
note_dataに格納されている内容はMIDIデータから取得した音情報になっています。
これらを
Amusic.notesに入れて再生をしたいと考えています。
試したこと
Python
#ライブラリ import magenta import note_seq from note_seq.protobuf import music_pb2 import pretty_midi Amusic = music_pb2.NoteSequence() # NoteSequence #addを使用して追加を試みた for i_note in note_data: Amusic.notes.add(i_note) #add → appendでも結果は同じ note_seq.play_sequence(Amusic, synth=note_seq.fluidsynth) # NoteSequenceの再生
エラーの内容
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /var/folders/qy/nmqqxpln03qgnyvyqfm5p12r0000gn/T/ipykernel_18407/795780127.py in <module> 2 3 for i_note in note_data: ----> 4 aiMusic.notes.add(i_note) 5 6 TypeError: No positional arguments allowed
まだ回答がついていません
会員登録して回答してみよう