{
"nbformat": 4,
"nbformat_minor": 2,
"metadata": {
"language_info": {
"name": "python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"version": "3.8.2-final"
},
"orig_nbformat": 2,
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"npconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": 3,
"kernelspec": {
"name": "python38264bit90963b6dfcff4977b23d3abddad7c054",
"display_name": "Python 3.8.2 64-bit"
}
},
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import music21\n",
"from music21.midi import MidiFile"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"mf = MidiFile()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"filepath = '/home/altarin/praca-magisterska/docs/images/seq2seq_generated_midi_7.mid'\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"import mido"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "\n\n\n\nprogram_change channel=0 program=30 time=0\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=48 velocity=0 time=220\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=55 velocity=100 time=0\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=48 velocity=0 time=220\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=55 velocity=0 time=0\nnote_on channel=0 note=55 velocity=100 time=0\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=48 velocity=0 time=440\nnote_on channel=0 note=55 velocity=0 time=0\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=48 velocity=0 time=110\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=45 velocity=100 time=770\nnote_on channel=0 note=50 velocity=100 time=0\nnote_on channel=0 note=57 velocity=100 time=0\nnote_on channel=0 note=45 velocity=0 time=220\nnote_on channel=0 note=46 velocity=100 time=0\nnote_on channel=0 note=50 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=57 velocity=0 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=46 velocity=0 time=220\nnote_on channel=0 note=46 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=46 velocity=0 time=220\nnote_on channel=0 note=46 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=46 velocity=0 time=440\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=48 velocity=0 time=440\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=48 velocity=0 time=220\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=48 velocity=0 time=220\nnote_on channel=0 note=51 velocity=100 time=0\nnote_on channel=0 note=48 velocity=100 time=220\nnote_on channel=0 note=51 velocity=0 time=0\nnote_on channel=0 note=48 velocity=0 time=220\nnote_on channel=0 note=60 velocity=100 time=0\nnote_on channel=0 note=51 velocity=100 time=220\nnote_on channel=0 note=60 velocity=0 time=0\nnote_on channel=0 note=51 velocity=0 time=220\nnote_on channel=0 note=51 velocity=100 time=0\nnote_on channel=0 note=51 velocity=0 time=220\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=46 velocity=100 time=440\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=46 velocity=0 time=990\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=46 velocity=100 time=110\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=46 velocity=0 time=220\nnote_on channel=0 note=46 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=58 velocity=100 time=0\nnote_on channel=0 note=41 velocity=100 time=220\nnote_on channel=0 note=46 velocity=0 time=0\nnote_on channel=0 note=48 velocity=100 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=53 velocity=100 time=0\nnote_on channel=0 note=57 velocity=100 time=0\nnote_on channel=0 note=58 velocity=0 time=0\nnote_on channel=0 note=41 velocity=0 time=220\nnote_on channel=0 note=48 velocity=0 time=0\nnote_on channel=0 note=53 velocity=0 time=0\nnote_on channel=0 note=57 velocity=0 time=0\n\n\nprogram_change channel=1 program=1 time=0\nnote_on channel=1 note=60 velocity=100 time=0\nnote_on channel=1 note=60 velocity=0 time=220\nnote_on channel=1 note=62 velocity=100 time=0\nnote_on channel=1 note=62 velocity=0 time=220\nnote_on channel=1 note=63 velocity=100 time=0\nnote_on channel=1 note=63 velocity=0 time=220\nnote_on channel=1 note=62 velocity=100 time=220\nnote_on channel=1 note=62 velocity=0 time=220\nnote_on channel=1 note=75 velocity=100 time=0\nnote_on channel=1 note=58 velocity=100 time=220\nnote_on channel=1 note=75 velocity=0 time=0\nnote_on channel=1 note=75 velocity=100 time=0\nnote_on channel=1 note=58 velocity=0 time=220\nnote_on channel=1 note=75 velocity=0 time=0\nnote_on channel=1 note=75 velocity=100 time=0\nnote_on channel=1 note=75 velocity=0 time=220\nnote_on channel=1 note=75 velocity=100 time=0\nnote_on channel=1 note=75 velocity=0 time=220\nnote_on channel=1 note=72 velocity=100 time=220\nnote_on channel=1 note=72 velocity=0 time=220\nnote_on channel=1 note=75 velocity=100 time=440\nnote_on channel=1 note=75 velocity=0 time=220\nnote_on channel=1 note=72 velocity=100 time=220\nnote_on channel=1 note=72 velocity=0 time=220\nnote_on channel=1 note=75 velocity=100 time=0\nnote_on channel=1 note=75 velocity=0 time=220\nnote_on channel=1 note=72 velocity=100 time=220\nnote_on channel=1 note=72 velocity=0 time=220\nnote_on channel=1 note=75 velocity=100 time=440\nnote_on channel=1 note=75 velocity=0 time=220\nnote_on channel=1 note=72 velocity=100 time=220\nnote_on channel=1 note=72 velocity=0 time=220\nnote_on channel=1 note=70 velocity=100 time=220\nnote_on channel=1 note=70 velocity=0 time=220\nnote_on channel=1 note=70 velocity=100 time=0\nnote_on channel=1 note=70 velocity=0 time=220\nnote_on channel=1 note=70 velocity=100 time=0\nnote_on channel=1 note=70 velocity=0 time=220\nnote_on channel=1 note=70 velocity=100 time=0\nnote_on channel=1 note=70 velocity=0 time=440\nnote_on channel=1 note=71 velocity=100 time=0\nnote_on channel=1 note=71 velocity=0 time=440\n\n\nprogram_change channel=2 program=35 time=0\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=22 velocity=100 time=0\nnote_on channel=2 note=22 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=29 velocity=100 time=0\nnote_on channel=2 note=29 velocity=0 time=220\nnote_on channel=2 note=31 velocity=100 time=0\nnote_on channel=2 note=31 velocity=0 time=220\nnote_on channel=2 note=31 velocity=100 time=0\nnote_on channel=2 note=31 velocity=0 time=220\nnote_on channel=2 note=32 velocity=100 time=220\nnote_on channel=2 note=32 velocity=0 time=220\nnote_on channel=2 note=32 velocity=100 time=0\nnote_on channel=2 note=32 velocity=0 time=220\nnote_on channel=2 note=34 velocity=100 time=220\nnote_on channel=2 note=34 velocity=0 time=220\nnote_on channel=2 note=34 velocity=100 time=0\nnote_on channel=2 note=24 velocity=100 time=220\nnote_on channel=2 note=34 velocity=0 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\nnote_on channel=2 note=24 velocity=100 time=0\nnote_on channel=2 note=24 velocity=0 time=220\n\n\nprogram_change channel=9 program=1 time=0\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=110\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=49 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=49 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=110\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=110\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=110\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=49 velocity=100 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=49 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=36 velocity=100 time=0\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\nnote_on channel=9 note=38 velocity=100 time=0\nnote_on channel=9 note=36 velocity=100 time=220\nnote_on channel=9 note=38 velocity=0 time=0\nnote_on channel=9 note=36 velocity=0 time=220\n\n"
}
],
"source": [
"mid = mido.MidiFile(filepath)\n",
"for i, track in enumerate(mid.tracks):\n",
" for msg in track:\n",
" print(msg)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "