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
1#ライブラリ 2import magenta 3import note_seq 4from note_seq.protobuf import music_pb2 5import pretty_midi 6 7Amusic = music_pb2.NoteSequence() # NoteSequence 8 9#addを使用して追加を試みた 10for i_note in note_data: 11 Amusic.notes.add(i_note) #add → appendでも結果は同じ 12 13note_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
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。