praca-magisterska/docs/images/plots.ipynb

142 lines
40 KiB
Plaintext
Raw Normal View History

2020-04-06 19:23:25 +02:00
{
"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": "<meta message set_tempo tempo=500000 time=0>\n<meta message time_signature numerator=4 denominator=4 clocks_per_click=24 notated_32nd_notes_per_beat=8 time=0>\n<meta message end_of_track time=1>\n<meta message track_name name='Guitar' time=0>\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
}
],
"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": "<Figure size 432x288 with 1 Axes>",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAtUAAAHwCAYAAABpOpNzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAADh0RVh0U29mdHdh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xy/FcfxJHMezgD2BN4BJURRt8FX3kSRJ6rMWLIDzzmO9//ov/qtd+XXg+8BPCduodSSdTvdoe+q+Qkyqv7fw5z1fvBDH8SfAwwufs2UBniVJklRannoKdtwRDjqIZebOBSALnAdUEg76WJK2trYebFCFUIhQvezCnx1tm7eoPrcAz5IkSSoNn34K9fWw1Vbw0EOfl58GvgUcBHzUyVuVl5f3QIMqpEKE6vsW/qyLomit9heiKNod2BH4FHigAM+SJEkqfvfdF/aYbmyEefNCbdAg3p4wgS2BB5fydu7+UfwKEaqvBu4CVgNmR1F0SRRFp0VRdCNwCxABR8Vx/G4BniVJklS8PvwQxo+Hqip49tlc/ZvfhMceY/jUqWxfVbVUt6yurqaysrLAjarQuh2q4zjOAnsAEwn/i8aewCRge+BWYLc4jqd09zmSJElF7YYboKICLrwwV1thBZg6NUyuKyoAqK+vp6yscxGsrKyMyZMn90S3KrBC7VM9L47jc+I43j6O4/I4jgfGcTw8juPvxXHcUohnSJIkFaV//hN+9CP4wQ/gzTdz9e9/HzIZmDAB2oXoVCpFU1PTEoN1WVkZzc3NLv0oEQUJ1ZIkSf1OHMO0aTBiBFxzTa4+fDhcdVWYXK+99mK/OnbsWFpaWqiurl7s9erqalpaWhgzZkxPdK4e0O1jyiVJkvqd556DujqYOTO/PmYMnHE
},
"metadata": {
"image/png": {
"width": 362,
"height": 248
},
"needs_background": "light"
}
}
],
"source": [
"x = np.arange(0,10)\n",
"y = np.arange(0,10) + np.random.random(10)-0.5\n",
"y_hat = np.arange(0,10)\n",
"plt.scatter(x, y, c='k')\n",
"plt.plot(x,y_hat, c='r')\n",
"# plt.savefig('linear_reg.png')"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": []
}
]
}