.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/basic/02_concatenate_two_midis.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_basic_02_concatenate_two_midis.py: Concatenate two midis ================================================== In this example : - We will concatenate two midi files horizontally - Then vertically .. GENERATED FROM PYTHON SOURCE LINES 9-27 .. code-block:: Python from maidi import MidiScore, midi_library score1 = MidiScore.from_midi(midi_library.get_midi_file('drum_and_bass')) score2 = MidiScore.from_midi(midi_library.get_midi_file('drum_and_bass')) print('Score1 shape: ', score1.shape) print('Score2.shape', score2.shape) horizontally_concatenated_score = score1.concatenate(score2, axis=1) horizontally_concatenated_score.write("horizontally_concatenated_score.mid") print('New horizontally concatenated score shape :', horizontally_concatenated_score.shape) # We could also concatenate the scores vertically (add new tracks keeping the same duration) vertically_concatenated_score = score1.concatenate(score2, axis=0) print('New vertically concatenated score shape :', vertically_concatenated_score.shape) .. _sphx_glr_download_auto_examples_basic_02_concatenate_two_midis.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_concatenate_two_midis.ipynb <02_concatenate_two_midis.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_concatenate_two_midis.py <02_concatenate_two_midis.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 02_concatenate_two_midis.zip <02_concatenate_two_midis.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_