diff --git a/Hello_Magenta.ipynb b/Hello_Magenta.ipynb
new file mode 100644
index 000000000000..bfd16a60bb0b
--- /dev/null
+++ b/Hello_Magenta.ipynb
@@ -0,0 +1,3132 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "Hello Magenta.ipynb",
+ "provenance": [],
+ "collapsed_sections": [],
+ "toc_visible": true,
+ "include_colab_link": true
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ }
+ },
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "view-in-github",
+ "colab_type": "text"
+ },
+ "source": [
+ "
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "dPkdg9jTjkTd"
+ },
+ "source": [
+ "# Making music with Magenta\n",
+ "\n",
+ "[Magenta](https://magenta.tensorflow.org/) is a Python library that helps you generate art and music. In this tutorial, we'll talk about the music generation bits in `note_seq` -- how to make your browser sing, and in particular, how to make your browser sing like you!\n",
+ "\n",
+ "As a library, `note_seq` can help you:\n",
+ "- make music using some of the neat abstractions and utilities in the library\n",
+ "- use Machine Learning models to generate music."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "R122bwRNbTus"
+ },
+ "source": [
+ "# Basic Instructions\n",
+ "\n",
+ "1. Double click on the hidden cells to make them visible, or select \"View > Expand Sections\" in the menu at the top.\n",
+ "2. Hover over the \"`[ ]`\" in the top-left corner of each cell and click on the \"Play\" button to run it, in order.\n",
+ "3. Listen to the generated samples.\n",
+ "4. Make it your own: copy the notebook, modify the code, train your own models, upload your own MIDI, etc. See the Magenta code on [GitHub](https://github.com/magenta/magenta) for more information!"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "zJbq5TmtFJUU"
+ },
+ "source": [
+ "# Step 0: First things first!\n",
+ "If you're going to use `Magenta`, you need to install it and its dependencies. Some of the later examples will also download other dependencies (such as models and checkpoints)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "cellView": "both",
+ "colab_type": "code",
+ "id": "PfRDVhNs3UFx",
+ "colab": {}
+ },
+ "source": [
+ "#@test {\"output\": \"ignore\"}\n",
+ "print('Installing dependencies...')\n",
+ "!apt-get update -qq && apt-get install -qq libfluidsynth1 fluid-soundfont-gm build-essential libasound2-dev libjack-dev\n",
+ "!pip install -qU pyfluidsynth pretty_midi\n",
+ "\n",
+ "!pip install -qU magenta\n",
+ "\n",
+ "# Hack to allow python to pick up the newly-installed fluidsynth lib. \n",
+ "# This is only needed for the hosted Colab environment.\n",
+ "import ctypes.util\n",
+ "orig_ctypes_util_find_library = ctypes.util.find_library\n",
+ "def proxy_find_library(lib):\n",
+ " if lib == 'fluidsynth':\n",
+ " return 'libfluidsynth.so.1'\n",
+ " else:\n",
+ " return orig_ctypes_util_find_library(lib)\n",
+ "ctypes.util.find_library = proxy_find_library\n",
+ "\n",
+ "print('Importing libraries and defining some helper functions...')\n",
+ "from google.colab import files\n",
+ "\n",
+ "import magenta\n",
+ "import note_seq\n",
+ "import tensorflow\n",
+ "\n",
+ "print('🎉 Done!')\n",
+ "print(magenta.__version__)\n",
+ "print(tensorflow.__version__)"
+ ],
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "oLSgiA6Uktpm"
+ },
+ "source": [
+ "# Step 1. Making sounds with NoteSequences\n",
+ "\n",
+ "Everything in `Magenta` is centered around [NoteSequences](https://github.com/magenta/note-seq/blob/master/note_seq/protobuf/music.proto#L27). This is an abstract representation of a series of notes, each with different pitches, instruments and strike velocities, much like [MIDI](https://en.wikipedia.org/wiki/MIDI).\n",
+ "\n",
+ "For example, this is a `NoteSequence` that represents \"Twinkle Twinkle Little Star\". Try changing the pitches to see how the sound changes!"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "71dgCmmBli-s",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 593
+ },
+ "outputId": "51a31f4f-6c43-47d1-f703-d83e8bf38bce"
+ },
+ "source": [
+ "from note_seq.protobuf import music_pb2\n",
+ "\n",
+ "twinkle_twinkle = music_pb2.NoteSequence()\n",
+ "\n",
+ "# Add the notes to the sequence.\n",
+ "twinkle_twinkle.notes.add(pitch=60, start_time=0.0, end_time=0.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=60, start_time=0.5, end_time=1.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=67, start_time=1.0, end_time=1.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=67, start_time=1.5, end_time=2.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=69, start_time=2.0, end_time=2.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=69, start_time=2.5, end_time=3.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=67, start_time=3.0, end_time=4.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=65, start_time=4.0, end_time=4.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=65, start_time=4.5, end_time=5.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=64, start_time=5.0, end_time=5.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=64, start_time=5.5, end_time=6.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=62, start_time=6.0, end_time=6.5, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=62, start_time=6.5, end_time=7.0, velocity=80)\n",
+ "twinkle_twinkle.notes.add(pitch=60, start_time=7.0, end_time=8.0, velocity=80) \n",
+ "twinkle_twinkle.total_time = 8\n",
+ "\n",
+ "twinkle_twinkle.tempos.add(qpm=60);\n",
+ "\n",
+ "# This is a colab utility method that visualizes a NoteSequence.\n",
+ "note_seq.plot_sequence(twinkle_twinkle)\n",
+ "\n",
+ "# This is a colab utility method that plays a NoteSequence.\n",
+ "note_seq.play_sequence(twinkle_twinkle,synth=note_seq.fluidsynth)\n",
+ "\n",
+ "# Here's another NoteSequence!\n",
+ "teapot = music_pb2.NoteSequence()\n",
+ "teapot.notes.add(pitch=69, start_time=0, end_time=0.5, velocity=80)\n",
+ "teapot.notes.add(pitch=71, start_time=0.5, end_time=1, velocity=80)\n",
+ "teapot.notes.add(pitch=73, start_time=1, end_time=1.5, velocity=80)\n",
+ "teapot.notes.add(pitch=74, start_time=1.5, end_time=2, velocity=80)\n",
+ "teapot.notes.add(pitch=76, start_time=2, end_time=2.5, velocity=80)\n",
+ "teapot.notes.add(pitch=81, start_time=3, end_time=4, velocity=80)\n",
+ "teapot.notes.add(pitch=78, start_time=4, end_time=5, velocity=80)\n",
+ "teapot.notes.add(pitch=81, start_time=5, end_time=6, velocity=80)\n",
+ "teapot.notes.add(pitch=76, start_time=6, end_time=8, velocity=80)\n",
+ "teapot.total_time = 8\n",
+ "\n",
+ "teapot.tempos.add(qpm=60);\n",
+ "\n",
+ "note_seq.plot_sequence(teapot)\n",
+ "note_seq.play_sequence(teapot,synth=note_seq.synthesize)"
+ ],
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1050\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1050\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1050' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1050\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1050\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1050\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1050' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1050\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"837e0d01-9f43-4d03-a4a2-4f2a41d012d9\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"1045\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1038\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1039\",\"type\":\"Quad\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1035\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":{\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1011\",\"type\":\"BasicTicker\"}},\"id\":\"1014\",\"type\":\"Grid\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1046\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1033\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1015\",\"type\":\"LinearAxis\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"zczMzMzMTUDNzMzMzMxNQGZmZmZmplBAZmZmZmamUEBmZmZmZiZRQGZmZmZmJlFAZmZmZmamUEBmZmZmZiZQQGZmZmZmJlBAzczMzMzMT0DNzMzMzMxPQM3MzMzMzE5AzczMzMzMTkDNzMzMzMxNQA==\",\"dtype\":\"float64\",\"shape\":[14]},\"duration\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"shape\":[14]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADwPwAAAAAAAPg/AAAAAAAAAEAAAAAAAAAEQAAAAAAAAAhAAAAAAAAAEEAAAAAAAAASQAAAAAAAABRAAAAAAAAAFkAAAAAAAAAYQAAAAAAAABpAAAAAAAAAHEAAAAAAAAAgQA==\",\"dtype\":\"float64\",\"shape\":[14]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPw==\",\"dtype\":\"float64\",\"shape\":[14]},\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],\"instrument\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"pitch\":[60,60,67,67,69,69,67,65,65,64,64,62,62,60],\"program\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADgPwAAAAAAAPA/AAAAAAAA+D8AAAAAAAAAQAAAAAAAAARAAAAAAAAACEAAAAAAAAAQQAAAAAAAABJAAAAAAAAAFEAAAAAAAAAWQAAAAAAAABhAAAAAAAAAGkAAAAAAAAAcQA==\",\"dtype\":\"float64\",\"shape\":[14]},\"top\":{\"__ndarray__\":\"MzMzMzMzTkAzMzMzMzNOQJqZmZmZ2VBAmpmZmZnZUECamZmZmVlRQJqZmZmZWVFAmpmZmZnZUECamZmZmVlQQJqZmZmZWVBAmpmZmZkZUECamZmZmRlQQDMzMzMzM09AMzMzMzMzT0AzMzMzMzNOQA==\",\"dtype\":\"float64\",\"shape\":[14]},\"velocity\":[80,80,80,80,80,80,80,80,80,80,80,80,80,80]},\"selected\":{\"id\":\"1047\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1048\",\"type\":\"UnionRenderers\"}},\"id\":\"1036\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"BasicTicker\"},{\"attributes\":{\"interval\":12},\"id\":\"1035\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1020\",\"type\":\"HoverTool\"},{\"id\":\"1021\",\"type\":\"PanTool\"},{\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"id\":\"1023\",\"type\":\"ResetTool\"},{\"id\":\"1024\",\"type\":\"SaveTool\"}]},\"id\":\"1025\",\"type\":\"Toolbar\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"interval\":12},\"id\":\"1033\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1020\",\"type\":\"HoverTool\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1043\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{\"source\":{\"id\":\"1036\",\"type\":\"ColumnDataSource\"}},\"id\":\"1041\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1036\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1038\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1039\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1041\",\"type\":\"CDSView\"}},\"id\":\"1040\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1046\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"ResetTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1027\",\"type\":\"BoxAnnotation\"}},\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1045\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1011\",\"type\":\"BasicTicker\"}},\"id\":\"1010\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"1002\",\"type\":\"DataRange1d\"},{\"attributes\":{\"below\":[{\"id\":\"1010\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1015\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1010\",\"type\":\"LinearAxis\"},{\"id\":\"1014\",\"type\":\"Grid\"},{\"id\":\"1015\",\"type\":\"LinearAxis\"},{\"id\":\"1019\",\"type\":\"Grid\"},{\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"id\":\"1040\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1043\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1025\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1002\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1006\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1004\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1008\",\"type\":\"LinearScale\"}},\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"}],\"root_ids\":[\"1001\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"837e0d01-9f43-4d03-a4a2-4f2a41d012d9\",\"roots\":{\"1001\":\"ec174206-f25b-454a-9b8c-a3fba7db05ff\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1001"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1156\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1156\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1156' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1156\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1156\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1156\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1156' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1156\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"7018f0c1-aacc-4315-8d70-d3b3ffda9190\":{\"roots\":{\"references\":[{\"attributes\":{\"overlay\":{\"id\":\"1133\",\"type\":\"BoxAnnotation\"}},\"id\":\"1128\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1129\",\"type\":\"ResetTool\"},{\"attributes\":{\"interval\":12},\"id\":\"1141\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1142\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1144\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1145\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1147\",\"type\":\"CDSView\"}},\"id\":\"1146\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1142\",\"type\":\"ColumnDataSource\"}},\"id\":\"1147\",\"type\":\"CDSView\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1144\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1145\",\"type\":\"Quad\"},{\"attributes\":{\"plot\":{\"id\":\"1107\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1117\",\"type\":\"BasicTicker\"}},\"id\":\"1120\",\"type\":\"Grid\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1152\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1107\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1139\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1121\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1149\",\"type\":\"Title\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1107\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1141\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1125\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1126\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1127\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"ZmZmZmYmUUBmZmZmZqZRQGZmZmZmJlJAZmZmZmZmUkBmZmZmZuZSQGZmZmZmJlRAZmZmZmZmU0BmZmZmZiZUQGZmZmZm5lJA\",\"dtype\":\"float64\",\"shape\":[9]},\"duration\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAABA\",\"dtype\":\"float64\",\"shape\":[9]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADwPwAAAAAAAPg/AAAAAAAAAEAAAAAAAAAEQAAAAAAAABBAAAAAAAAAFEAAAAAAAAAYQAAAAAAAACBA\",\"dtype\":\"float64\",\"shape\":[9]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[9]},\"index\":[0,1,2,3,4,5,6,7,8],\"instrument\":[0,0,0,0,0,0,0,0,0],\"pitch\":[69,71,73,74,76,81,78,81,76],\"program\":[0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADgPwAAAAAAAPA/AAAAAAAA+D8AAAAAAAAAQAAAAAAAAAhAAAAAAAAAEEAAAAAAAAAUQAAAAAAAABhA\",\"dtype\":\"float64\",\"shape\":[9]},\"top\":{\"__ndarray__\":\"mpmZmZlZUUCamZmZmdlRQJqZmZmZWVJAmpmZmZmZUkCamZmZmRlTQJqZmZmZWVRAmpmZmZmZU0CamZmZmVlUQJqZmZmZGVNA\",\"dtype\":\"float64\",\"shape\":[9]},\"velocity\":[80,80,80,80,80,80,80,80,80]},\"selected\":{\"id\":\"1153\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1154\",\"type\":\"UnionRenderers\"}},\"id\":\"1142\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"1110\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1112\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1114\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1117\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1151\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1107\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1117\",\"type\":\"BasicTicker\"}},\"id\":\"1116\",\"type\":\"LinearAxis\"},{\"attributes\":{\"interval\":12},\"id\":\"1139\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1133\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1154\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1126\",\"type\":\"HoverTool\"},{\"id\":\"1127\",\"type\":\"PanTool\"},{\"id\":\"1128\",\"type\":\"BoxZoomTool\"},{\"id\":\"1129\",\"type\":\"ResetTool\"},{\"id\":\"1130\",\"type\":\"SaveTool\"}]},\"id\":\"1131\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1130\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1151\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1153\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"below\":[{\"id\":\"1116\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1121\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1116\",\"type\":\"LinearAxis\"},{\"id\":\"1120\",\"type\":\"Grid\"},{\"id\":\"1121\",\"type\":\"LinearAxis\"},{\"id\":\"1125\",\"type\":\"Grid\"},{\"id\":\"1133\",\"type\":\"BoxAnnotation\"},{\"id\":\"1146\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1149\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1131\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1108\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1112\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1110\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1114\",\"type\":\"LinearScale\"}},\"id\":\"1107\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null},\"id\":\"1108\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"1107\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"7018f0c1-aacc-4315-8d70-d3b3ffda9190\",\"roots\":{\"1107\":\"943642bf-a60b-497d-9acb-1f533961ac8d\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1107"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "oC7BS_4OwCIR"
+ },
+ "source": [
+ "You can use other instruments for your sequences. For example, the sequence below should sound like a drum solo!"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "DQLjca9SwOiI",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 305
+ },
+ "outputId": "7082c36b-2ad6-4daf-84a0-93bfe2000a78"
+ },
+ "source": [
+ "drums = music_pb2.NoteSequence()\n",
+ "\n",
+ "drums.notes.add(pitch=36, start_time=0, end_time=0.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=38, start_time=0, end_time=0.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=0, end_time=0.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=46, start_time=0, end_time=0.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=0.25, end_time=0.375, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=0.375, end_time=0.5, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=0.5, end_time=0.625, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=50, start_time=0.5, end_time=0.625, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=36, start_time=0.75, end_time=0.875, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=38, start_time=0.75, end_time=0.875, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=0.75, end_time=0.875, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=45, start_time=0.75, end_time=0.875, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=36, start_time=1, end_time=1.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=1, end_time=1.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=46, start_time=1, end_time=1.125, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=42, start_time=1.25, end_time=1.375, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=48, start_time=1.25, end_time=1.375, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.notes.add(pitch=50, start_time=1.25, end_time=1.375, is_drum=True, instrument=10, velocity=80)\n",
+ "drums.total_time = 1.375\n",
+ "\n",
+ "drums.tempos.add(qpm=60)\n",
+ "\n",
+ "# This is a colab utility method that visualizes a NoteSequence.\n",
+ "note_seq.plot_sequence(drums)\n",
+ "\n",
+ "# This is a colab utility method that plays a NoteSequence.\n",
+ "note_seq.play_sequence(drums,synth=note_seq.fluidsynth)"
+ ],
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1270\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1270\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1270' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1270\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1270\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1270\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1270' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1270\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"fdcc943b-1ee8-48e6-af6f-25587b812810\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"1226\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1268\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"callback\":null},\"id\":\"1222\",\"type\":\"DataRange1d\"},{\"attributes\":{\"below\":[{\"id\":\"1230\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1235\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1230\",\"type\":\"LinearAxis\"},{\"id\":\"1234\",\"type\":\"Grid\"},{\"id\":\"1235\",\"type\":\"LinearAxis\"},{\"id\":\"1239\",\"type\":\"Grid\"},{\"id\":\"1247\",\"type\":\"BoxAnnotation\"},{\"id\":\"1260\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1263\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1245\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1222\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1226\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1224\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1228\",\"type\":\"LinearScale\"}},\"id\":\"1221\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1263\",\"type\":\"Title\"},{\"attributes\":{\"source\":{\"id\":\"1256\",\"type\":\"ColumnDataSource\"}},\"id\":\"1261\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1256\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1258\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1259\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1261\",\"type\":\"CDSView\"}},\"id\":\"1260\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1267\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1266\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1265\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1228\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null},\"id\":\"1224\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"zczMzMzMQUDNzMzMzMxCQM3MzMzMzERAzczMzMzMRkDNzMzMzMxEQM3MzMzMzERAzczMzMzMREDNzMzMzMxIQM3MzMzMzEFAzczMzMzMQkDNzMzMzMxEQM3MzMzMTEZAzczMzMzMQUDNzMzMzMxEQM3MzMzMzEZAzczMzMzMREDNzMzMzMxHQM3MzMzMzEhA\",\"dtype\":\"float64\",\"shape\":[18]},\"duration\":{\"__ndarray__\":\"AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/\",\"dtype\":\"float64\",\"shape\":[18]},\"end_time\":{\"__ndarray__\":\"AAAAAAAAwD8AAAAAAADAPwAAAAAAAMA/AAAAAAAAwD8AAAAAAADYPwAAAAAAAOA/AAAAAAAA5D8AAAAAAADkPwAAAAAAAOw/AAAAAAAA7D8AAAAAAADsPwAAAAAAAOw/AAAAAAAA8j8AAAAAAADyPwAAAAAAAPI/AAAAAAAA9j8AAAAAAAD2PwAAAAAAAPY/\",\"dtype\":\"float64\",\"shape\":[18]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[18]},\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],\"instrument\":[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10],\"pitch\":[36,38,42,46,42,42,42,50,36,38,42,45,36,42,46,42,48,50],\"program\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQPwAAAAAAANg/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOg/AAAAAAAA6D8AAAAAAADoPwAAAAAAAOg/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA9D8AAAAAAAD0PwAAAAAAAPQ/\",\"dtype\":\"float64\",\"shape\":[18]},\"top\":{\"__ndarray__\":\"MzMzMzMzQkAzMzMzMzNDQDMzMzMzM0VAMzMzMzMzR0AzMzMzMzNFQDMzMzMzM0VAMzMzMzMzRUAzMzMzMzNJQDMzMzMzM0JAMzMzMzMzQ0AzMzMzMzNFQDMzMzMzs0ZAMzMzMzMzQkAzMzMzMzNFQDMzMzMzM0dAMzMzMzMzRUAzMzMzMzNIQDMzMzMzM0lA\",\"dtype\":\"float64\",\"shape\":[18]},\"velocity\":[80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80]},\"selected\":{\"id\":\"1267\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1268\",\"type\":\"UnionRenderers\"}},\"id\":\"1256\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"interval\":12},\"id\":\"1255\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"interval\":12},\"id\":\"1253\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1258\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1259\",\"type\":\"Quad\"},{\"attributes\":{\"plot\":{\"id\":\"1221\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1231\",\"type\":\"BasicTicker\"}},\"id\":\"1234\",\"type\":\"Grid\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1266\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1221\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1253\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1235\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1265\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1221\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1231\",\"type\":\"BasicTicker\"}},\"id\":\"1230\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1231\",\"type\":\"BasicTicker\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1221\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1255\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1239\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1241\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1240\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1243\",\"type\":\"ResetTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1247\",\"type\":\"BoxAnnotation\"}},\"id\":\"1242\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1240\",\"type\":\"HoverTool\"},{\"id\":\"1241\",\"type\":\"PanTool\"},{\"id\":\"1242\",\"type\":\"BoxZoomTool\"},{\"id\":\"1243\",\"type\":\"ResetTool\"},{\"id\":\"1244\",\"type\":\"SaveTool\"}]},\"id\":\"1245\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1244\",\"type\":\"SaveTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1247\",\"type\":\"BoxAnnotation\"}],\"root_ids\":[\"1221\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"fdcc943b-1ee8-48e6-af6f-25587b812810\",\"roots\":{\"1221\":\"4585b5e0-de76-4290-ac0c-06aab5a71275\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1221"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "QhtRBNNf05CA"
+ },
+ "source": [
+ "## Converting a `NoteSequence` to MIDI\n",
+ "\n",
+ "When you called the \"play_sequence\" method above, this converted the `NoteSequence` to MIDI, and created an HTML widget to play it. This method is specially made for colab notebooks, so it won't work inside your Python script. That method uses the Magenta built-in [conversion methods](https://github.com/magenta/note-seq/blob/master/note_seq/midi_io.py#L51), which you can use in your python script:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "EcmmAToP4WE3",
+ "colab": {}
+ },
+ "source": [
+ "# This creates a file called `drums_sample_output.mid`, containing the drums solo we've been using.\n",
+ "note_seq.sequence_proto_to_midi_file(drums, 'drums_sample_output.mid')\n",
+ "\n",
+ "# This is a colab utility method to download that file. In your Python script, you \n",
+ "# would just write it to disk.\n",
+ "files.download('drums_sample_output.mid')"
+ ],
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "9YalOCM_5JP6"
+ },
+ "source": [
+ "## Useful helpers\n",
+ "There are a lot of other helper methods sprinkled around the `note_seq` codebase that you might need but not know where to find. Here are some of our favourites:\n",
+ "\n",
+ "- [converting](https://github.com/magenta/note-seq/blob/master/note_seq/midi_io.py) between MIDI and NoteSequences\n",
+ "- [trimming, concatenating and expanding](https://github.com/magenta/note-seq/blob/master/note_seq/sequences_lib.py) NoteSequences\n",
+ "- [colab notebook](https://github.com/magenta/note-seq/blob/master/note_seq/notebook_utils.py) utils"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "K1o5dZjR57c_"
+ },
+ "source": [
+ "# Step 2. Using Machine Learning to make music\n",
+ "\n",
+ "`note_seq` has several Machine Learning models, each with different strengths. All models are built with [Tensorflow](https://www.tensorflow.org), so they will run faster if you can run them on a GPU. Here are some of the most popular ones:\n",
+ "\n",
+ "- [**MelodyRNN**](https://github.com/magenta/magenta/tree/master/magenta/models/melody_rnn) - you give it a NoteSequence, and it continues it in the style of your original NoteSequence.\n",
+ "- [**MusicVAE**](https://github.com/magenta/magenta/tree/master/magenta/models/music_vae) - generates brand new NoteSequences or interpolates between two sequences.\n",
+ "- [**Onsets and Frames**](https://github.com/magenta/magenta/tree/master/magenta/models/onsets_frames_transcription) -- transcribes piano audio\n",
+ "\n",
+ "Now that we know how to use `NoteSequences`, adding some basic Machine Learning is a continuation of that. The pattern for using any of these models is:\n",
+ "\n",
+ "- Load `note_seq` (which we already know how to do!)\n",
+ "- Create a model from a downloaded checkpoint (i.e. where the weights, or the encoding, of the model lives)\n",
+ "- Ask the model to do something."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "_Pm3kdH0-DaH"
+ },
+ "source": [
+ "## Melody RNN\n",
+ "\n",
+ "A MelodyRNN is an [LSTM-based](https://colah.github.io/posts/2015-08-Understanding-LSTMs/) language model for musical notes -- it is best at continuing a NoteSequence that you give it.\n",
+ "\n",
+ "To use it, you need to give it a sequence to continue and the model will return the following sequence.\n",
+ "\n",
+ "This example shows how to use the basic Melody RNN model -- check out the [docs](https://github.com/magenta/magenta/tree/master/magenta/models/melody_rnn) for the other models, such as `lookback_rnn` and `attention_rnn`."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "zdPBBzSY-P38"
+ },
+ "source": [
+ "### Initialize the model"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "7Y0VkNafNKLP",
+ "colab": {}
+ },
+ "source": [
+ "print('Downloading model bundle. This will take less than a minute...')\n",
+ "note_seq.notebook_utils.download_bundle('basic_rnn.mag', '/content/')\n",
+ "\n",
+ "# Import dependencies.\n",
+ "from magenta.models.melody_rnn import melody_rnn_sequence_generator\n",
+ "from magenta.models.shared import sequence_generator_bundle\n",
+ "from note_seq.protobuf import generator_pb2\n",
+ "from note_seq.protobuf import music_pb2\n",
+ "\n",
+ "# Initialize the model.\n",
+ "print(\"Initializing Melody RNN...\")\n",
+ "bundle = sequence_generator_bundle.read_bundle_file('/content/basic_rnn.mag')\n",
+ "generator_map = melody_rnn_sequence_generator.get_generator_map()\n",
+ "melody_rnn = generator_map['basic_rnn'](checkpoint=None, bundle=bundle)\n",
+ "melody_rnn.initialize()\n",
+ "\n",
+ "print('🎉 Done!')"
+ ],
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "SlYDyTA0-UJT"
+ },
+ "source": [
+ "### Continuing a sequence\n",
+ "\n",
+ "With Melody RNN, you can configure the number of steps the new sequence will be, as well as the \"temperature\" of the result -- the higher the temperature, the more random (and less like the input) your sequence will be. You can play around with these values and see how the resulting sequences are different:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "LgREckzBmd-8",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 322
+ },
+ "outputId": "a57027e2-78d5-45a4-94e4-d3bce66f5d2a"
+ },
+ "source": [
+ "# Model options. Change these to get different generated sequences! \n",
+ "\n",
+ "input_sequence = twinkle_twinkle # change this to teapot if you want\n",
+ "num_steps = 128 # change this for shorter or longer sequences\n",
+ "temperature = 1.0 # the higher the temperature the more random the sequence.\n",
+ "\n",
+ "# Set the start time to begin on the next step after the last note ends.\n",
+ "last_end_time = (max(n.end_time for n in input_sequence.notes)\n",
+ " if input_sequence.notes else 0)\n",
+ "qpm = input_sequence.tempos[0].qpm \n",
+ "seconds_per_step = 60.0 / qpm / melody_rnn.steps_per_quarter\n",
+ "total_seconds = num_steps * seconds_per_step\n",
+ "\n",
+ "generator_options = generator_pb2.GeneratorOptions()\n",
+ "generator_options.args['temperature'].float_value = temperature\n",
+ "generate_section = generator_options.generate_sections.add(\n",
+ " start_time=last_end_time + seconds_per_step,\n",
+ " end_time=total_seconds)\n",
+ "\n",
+ "# Ask the model to continue the sequence.\n",
+ "sequence = melody_rnn.generate(input_sequence, generator_options)\n",
+ "\n",
+ "note_seq.plot_sequence(sequence)\n",
+ "note_seq.play_sequence(sequence, synth=note_seq.fluidsynth)\n"
+ ],
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "text": [
+ "INFO:tensorflow:Beam search yields sequence with log-likelihood: -134.252792 \n"
+ ],
+ "name": "stdout"
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1392\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1392\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1392' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1392\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1392\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1392\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1392' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1392\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"9c303819-3435-4182-924c-645acd7daa22\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"1348\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"1378\",\"type\":\"ColumnDataSource\"}},\"id\":\"1383\",\"type\":\"CDSView\"},{\"attributes\":{\"below\":[{\"id\":\"1352\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1357\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1352\",\"type\":\"LinearAxis\"},{\"id\":\"1356\",\"type\":\"Grid\"},{\"id\":\"1357\",\"type\":\"LinearAxis\"},{\"id\":\"1361\",\"type\":\"Grid\"},{\"id\":\"1369\",\"type\":\"BoxAnnotation\"},{\"id\":\"1382\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1385\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1367\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1344\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1348\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1346\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1350\",\"type\":\"LinearScale\"}},\"id\":\"1343\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null},\"id\":\"1344\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"1346\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1390\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1362\",\"type\":\"HoverTool\"},{\"attributes\":{\"interval\":12},\"id\":\"1375\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"interval\":12},\"id\":\"1377\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"zczMzMzMTUDNzMzMzMxNQGZmZmZmplBAZmZmZmamUEBmZmZmZiZRQGZmZmZmJlFAZmZmZmamUEBmZmZmZiZQQGZmZmZmJlBAzczMzMzMT0DNzMzMzMxPQM3MzMzMzE5AzczMzMzMTkDNzMzMzMxNQM3MzMzMzE1AzczMzMzMTkDNzMzMzMxNQM3MzMzMzE1AZmZmZmYmUUBmZmZmZiZRQGZmZmZmJlFAZmZmZmamUEBmZmZmZiZQQM3MzMzMzE9AzczMzMzMTkDNzMzMzMxOQM3MzMzMzE5AzczMzMzMTkDNzMzMzMxNQM3MzMzMzE5AzczMzMzMT0DNzMzMzMxPQM3MzMzMzE9AzczMzMzMTUDNzMzMzMxOQM3MzMzMzE1AzczMzMzMTUBmZmZmZiZQQGZmZmZmJlFAZmZmZmamUUBmZmZmZiZQQM3MzMzMzE1AzczMzMxMTUDNzMzMzMxNQM3MzMzMTExAZmZmZmYmUUA=\",\"dtype\":\"float64\",\"shape\":[46]},\"duration\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADwPwAAAAAAAOg/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAPA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA6D8AAAAAAADoPwAAAAAAAPA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOg/AAAAAAAA4D8=\",\"dtype\":\"float64\",\"shape\":[46]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADwPwAAAAAAAPg/AAAAAAAAAEAAAAAAAAAEQAAAAAAAAAhAAAAAAAAAEEAAAAAAAAASQAAAAAAAABRAAAAAAAAAFkAAAAAAAAAYQAAAAAAAABpAAAAAAAAAHEAAAAAAAAAgQAAAAAAAgCNAAAAAAAAAJkAAAAAAAAAnQAAAAAAAAChAAAAAAAAAKUAAAAAAAAAqQAAAAAAAACxAAAAAAAAALUAAAAAAAAAuQAAAAAAAAC9AAAAAAACAMEAAAAAAAAAxQAAAAAAAgDFAAAAAAAAAMkAAAAAAAIAyQAAAAAAAADNAAAAAAADAM0AAAAAAAMA0QAAAAAAAADZAAAAAAACAN0AAAAAAAAA4QAAAAAAAgDhAAAAAAAAAOUAAAAAAAIA5QAAAAAAAADpAAAAAAAAAO0AAAAAAAAA8QAAAAAAAgD1AAAAAAAAAPkAAAAAAAIA+QAAAAAAAQD9AAAAAAAAAQEA=\",\"dtype\":\"float64\",\"shape\":[46]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8=\",\"dtype\":\"float64\",\"shape\":[46]},\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],\"instrument\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"pitch\":[60,60,67,67,69,69,67,65,65,64,64,62,62,60,60,62,60,60,69,69,69,67,65,64,62,62,62,62,60,62,64,64,64,60,62,60,60,65,69,71,65,60,59,60,57,69],\"program\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADgPwAAAAAAAPA/AAAAAAAA+D8AAAAAAAAAQAAAAAAAAARAAAAAAAAACEAAAAAAAAAQQAAAAAAAABJAAAAAAAAAFEAAAAAAAAAWQAAAAAAAABhAAAAAAAAAGkAAAAAAAAAcQAAAAAAAACJAAAAAAAAAJUAAAAAAAAAmQAAAAAAAACdAAAAAAAAAKEAAAAAAAAApQAAAAAAAACpAAAAAAAAALEAAAAAAAAAtQAAAAAAAAC5AAAAAAAAAL0AAAAAAAIAwQAAAAAAAADFAAAAAAACAMUAAAAAAAAAyQAAAAAAAgDJAAAAAAAAAM0AAAAAAAAA0QAAAAAAAADVAAAAAAAAAN0AAAAAAAIA3QAAAAAAAADhAAAAAAACAOEAAAAAAAAA5QAAAAAAAgDlAAAAAAAAAOkAAAAAAAAA7QAAAAAAAAD1AAAAAAACAPUAAAAAAAAA+QAAAAAAAgD5AAAAAAACAP0A=\",\"dtype\":\"float64\",\"shape\":[46]},\"top\":{\"__ndarray__\":\"MzMzMzMzTkAzMzMzMzNOQJqZmZmZ2VBAmpmZmZnZUECamZmZmVlRQJqZmZmZWVFAmpmZmZnZUECamZmZmVlQQJqZmZmZWVBAmpmZmZkZUECamZmZmRlQQDMzMzMzM09AMzMzMzMzT0AzMzMzMzNOQDMzMzMzM05AMzMzMzMzT0AzMzMzMzNOQDMzMzMzM05AmpmZmZlZUUCamZmZmVlRQJqZmZmZWVFAmpmZmZnZUECamZmZmVlQQJqZmZmZGVBAMzMzMzMzT0AzMzMzMzNPQDMzMzMzM09AMzMzMzMzT0AzMzMzMzNOQDMzMzMzM09AmpmZmZkZUECamZmZmRlQQJqZmZmZGVBAMzMzMzMzTkAzMzMzMzNPQDMzMzMzM05AMzMzMzMzTkCamZmZmVlQQJqZmZmZWVFAmpmZmZnZUUCamZmZmVlQQDMzMzMzM05AMzMzMzOzTUAzMzMzMzNOQDMzMzMzs0xAmpmZmZlZUUA=\",\"dtype\":\"float64\",\"shape\":[46]},\"velocity\":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100]},\"selected\":{\"id\":\"1389\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1390\",\"type\":\"UnionRenderers\"}},\"id\":\"1378\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1389\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1353\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1387\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1343\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1353\",\"type\":\"BasicTicker\"}},\"id\":\"1352\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1350\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1388\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1343\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1375\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1357\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"1343\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1353\",\"type\":\"BasicTicker\"}},\"id\":\"1356\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1366\",\"type\":\"SaveTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1362\",\"type\":\"HoverTool\"},{\"id\":\"1363\",\"type\":\"PanTool\"},{\"id\":\"1364\",\"type\":\"BoxZoomTool\"},{\"id\":\"1365\",\"type\":\"ResetTool\"},{\"id\":\"1366\",\"type\":\"SaveTool\"}]},\"id\":\"1367\",\"type\":\"Toolbar\"},{\"attributes\":{\"overlay\":{\"id\":\"1369\",\"type\":\"BoxAnnotation\"}},\"id\":\"1364\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1365\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1388\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1363\",\"type\":\"PanTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1343\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1377\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1361\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1385\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1387\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1380\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1381\",\"type\":\"Quad\"},{\"attributes\":{\"data_source\":{\"id\":\"1378\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1380\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1381\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1383\",\"type\":\"CDSView\"}},\"id\":\"1382\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1369\",\"type\":\"BoxAnnotation\"}],\"root_ids\":[\"1343\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"9c303819-3435-4182-924c-645acd7daa22\",\"roots\":{\"1343\":\"bcf6922b-4240-49d7-a7e4-007716445921\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1343"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "7zp--0n5FSDm"
+ },
+ "source": [
+ "## Music VAE\n",
+ "\n",
+ "A [MusicVAE](https://g.co/magenta/musicvae) is a variational autoencoder made up of an Encoder and Decoder -- you can think of the encoder as trying to summarize all the data you give it, and the decoder as trying to recreate the original data, based on this summarized version. As a generative model, you can think of a VAE as coming up with new sequences that could be a decoding of some summarized version.\n",
+ "\n",
+ "The Music VAE implementation in `magenta/music` in particular does two things: it can create new sequences (which are reconstructions or variations of the input data), or it can interpolate between two."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "Lcx5W1417IP3"
+ },
+ "source": [
+ "### Initialize the model"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "cellView": "both",
+ "colab_type": "code",
+ "id": "FDW3h0cqUERq",
+ "colab": {}
+ },
+ "source": [
+ "print('Copying checkpoint from GCS. This will take less than a minute...')\n",
+ "# This will download the mel_2bar_big checkpoint. There are more checkpoints that you\n",
+ "# can use with this model, depending on what kind of output you want\n",
+ "# See the list of checkpoints: https://github.com/magenta/magenta/tree/master/magenta/models/music_vae#pre-trained-checkpoints\n",
+ "!gsutil -q -m cp -R gs://download.magenta.tensorflow.org/models/music_vae/colab2/checkpoints/mel_2bar_big.ckpt.* /content/\n",
+ "\n",
+ "# Import dependencies.\n",
+ "from magenta.models.music_vae import configs\n",
+ "from magenta.models.music_vae.trained_model import TrainedModel\n",
+ "\n",
+ "# Initialize the model.\n",
+ "print(\"Initializing Music VAE...\")\n",
+ "music_vae = TrainedModel(\n",
+ " configs.CONFIG_MAP['cat-mel_2bar_big'], \n",
+ " batch_size=4, \n",
+ " checkpoint_dir_or_path='/content/mel_2bar_big.ckpt')\n",
+ "\n",
+ "print('🎉 Done!')\n"
+ ],
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "APjD-ph4Fn3Q"
+ },
+ "source": [
+ "### Creating new sequences\n",
+ "\n",
+ "With Music VAE, you can configure how many new sequences to generate, the number of steps the new sequence will be, as well as the \"temperature\" of the result -- the higher the temperature, the more random (and less like the input) your sequence will be. You can play around with these values and see how the resulting sequences are different:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "cellView": "both",
+ "colab_type": "code",
+ "id": "XKk8rGihUR6B",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 593
+ },
+ "outputId": "62de9072-72f0-4884-d62a-54a14dc262d0"
+ },
+ "source": [
+ "generated_sequences = music_vae.sample(n=2, length=80, temperature=1.0)\n",
+ "\n",
+ "for ns in generated_sequences:\n",
+ " # print(ns)\n",
+ " note_seq.plot_sequence(ns)\n",
+ " note_seq.play_sequence(ns, synth=note_seq.fluidsynth)"
+ ],
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1522\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1522\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1522' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1522\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1522\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1522\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1522' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1522\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"5770975c-8865-4756-ba78-1ad5c01164fd\":{\"roots\":{\"references\":[{\"attributes\":{},\"id\":\"1483\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1517\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1473\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1483\",\"type\":\"BasicTicker\"}},\"id\":\"1482\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1480\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1518\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1473\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1505\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1487\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"1473\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1483\",\"type\":\"BasicTicker\"}},\"id\":\"1486\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1520\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"interval\":12},\"id\":\"1507\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"interval\":12},\"id\":\"1505\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"callback\":null},\"id\":\"1476\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"zczMzMxMQECamZmZmZk5QJqZmZmZmT5AzczMzMxMQEDNzMzMzExGQM3MzMzMzEhA\",\"dtype\":\"float64\",\"shape\":[6]},\"duration\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAADsPwAAAAAAAOA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOw/\",\"dtype\":\"float64\",\"shape\":[6]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA4D8AAAAAAAD2PwAAAAAAAABAAAAAAAAABEAAAAAAAAAIQAAAAAAAAA9A\",\"dtype\":\"float64\",\"shape\":[6]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[6]},\"index\":[0,1,2,3,4,5],\"instrument\":[0,0,0,0,0,0],\"pitch\":[33,26,31,33,45,50],\"program\":[0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADgPwAAAAAAAPg/AAAAAAAAAEAAAAAAAAAEQAAAAAAAAAhA\",\"dtype\":\"float64\",\"shape\":[6]},\"top\":{\"__ndarray__\":\"MzMzMzOzQEBmZmZmZmY6QGZmZmZmZj9AMzMzMzOzQEAzMzMzM7NGQDMzMzMzM0lA\",\"dtype\":\"float64\",\"shape\":[6]},\"velocity\":[80,80,80,80,80,80]},\"selected\":{\"id\":\"1519\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1520\",\"type\":\"UnionRenderers\"}},\"id\":\"1508\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1473\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1507\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1491\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1492\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1493\",\"type\":\"PanTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1499\",\"type\":\"BoxAnnotation\"}},\"id\":\"1494\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1495\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1496\",\"type\":\"SaveTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1492\",\"type\":\"HoverTool\"},{\"id\":\"1493\",\"type\":\"PanTool\"},{\"id\":\"1494\",\"type\":\"BoxZoomTool\"},{\"id\":\"1495\",\"type\":\"ResetTool\"},{\"id\":\"1496\",\"type\":\"SaveTool\"}]},\"id\":\"1497\",\"type\":\"Toolbar\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1499\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1517\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"below\":[{\"id\":\"1482\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1487\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1482\",\"type\":\"LinearAxis\"},{\"id\":\"1486\",\"type\":\"Grid\"},{\"id\":\"1487\",\"type\":\"LinearAxis\"},{\"id\":\"1491\",\"type\":\"Grid\"},{\"id\":\"1499\",\"type\":\"BoxAnnotation\"},{\"id\":\"1512\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1515\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1497\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1474\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1478\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1476\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1480\",\"type\":\"LinearScale\"}},\"id\":\"1473\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1519\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1518\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null},\"id\":\"1474\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1515\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1478\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1511\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1510\",\"type\":\"Quad\"},{\"attributes\":{\"source\":{\"id\":\"1508\",\"type\":\"ColumnDataSource\"}},\"id\":\"1513\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1508\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1510\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1511\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1513\",\"type\":\"CDSView\"}},\"id\":\"1512\",\"type\":\"GlyphRenderer\"}],\"root_ids\":[\"1473\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"5770975c-8865-4756-ba78-1ad5c01164fd\",\"roots\":{\"1473\":\"70a6d428-f218-40fa-ac9f-987903a45a56\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1473"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"1660\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"1660\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1660' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"1660\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1660\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"1660\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1660' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"1660\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"cd8ab377-2ece-49e0-a11a-05dfed560fff\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"1630\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"1631\",\"type\":\"PanTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1637\",\"type\":\"BoxAnnotation\"}},\"id\":\"1632\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1633\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1634\",\"type\":\"SaveTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1630\",\"type\":\"HoverTool\"},{\"id\":\"1631\",\"type\":\"PanTool\"},{\"id\":\"1632\",\"type\":\"BoxZoomTool\"},{\"id\":\"1633\",\"type\":\"ResetTool\"},{\"id\":\"1634\",\"type\":\"SaveTool\"}]},\"id\":\"1635\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1618\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1637\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1616\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null},\"id\":\"1614\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"1612\",\"type\":\"DataRange1d\"},{\"attributes\":{\"below\":[{\"id\":\"1620\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"1625\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"1620\",\"type\":\"LinearAxis\"},{\"id\":\"1624\",\"type\":\"Grid\"},{\"id\":\"1625\",\"type\":\"LinearAxis\"},{\"id\":\"1629\",\"type\":\"Grid\"},{\"id\":\"1637\",\"type\":\"BoxAnnotation\"},{\"id\":\"1650\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1653\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1635\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"1612\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1616\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1614\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1618\",\"type\":\"LinearScale\"}},\"id\":\"1611\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1658\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1653\",\"type\":\"Title\"},{\"attributes\":{\"data_source\":{\"id\":\"1646\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1648\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1649\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1651\",\"type\":\"CDSView\"}},\"id\":\"1650\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1646\",\"type\":\"ColumnDataSource\"}},\"id\":\"1651\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1656\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1657\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1655\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"ZmZmZmbmUUBmZmZmZuZRQGZmZmZm5lBAZmZmZmbmUEBmZmZmZuZQQGZmZmZmZlFAZmZmZmamUEBmZmZmZiZQQGZmZmZmJlBA\",\"dtype\":\"float64\",\"shape\":[9]},\"duration\":{\"__ndarray__\":\"AAAAAAAA2D8AAAAAAADYPwAAAAAAANg/AAAAAAAA2D8AAAAAAADAPwAAAAAAANg/AAAAAAAA8D8AAAAAAADAPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[9]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA2D8AAAAAAADsPwAAAAAAAPY/AAAAAAAA/j8AAAAAAAABQAAAAAAAAARAAAAAAAAADEAAAAAAAAANQAAAAAAAABNA\",\"dtype\":\"float64\",\"shape\":[9]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[9]},\"index\":[0,1,2,3,4,5,6,7,8],\"instrument\":[0,0,0,0,0,0,0,0,0],\"pitch\":[72,72,68,68,68,70,67,65,65],\"program\":[0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADgPwAAAAAAAPA/AAAAAAAA+D8AAAAAAAAAQAAAAAAAAAFAAAAAAAAABEAAAAAAAAAMQAAAAAAAAA5A\",\"dtype\":\"float64\",\"shape\":[9]},\"top\":{\"__ndarray__\":\"mpmZmZkZUkCamZmZmRlSQJqZmZmZGVFAmpmZmZkZUUCamZmZmRlRQJqZmZmZmVFAmpmZmZnZUECamZmZmVlQQJqZmZmZWVBA\",\"dtype\":\"float64\",\"shape\":[9]},\"velocity\":[80,80,80,80,80,80,80,80,80]},\"selected\":{\"id\":\"1657\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1658\",\"type\":\"UnionRenderers\"}},\"id\":\"1646\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"interval\":12},\"id\":\"1645\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{},\"id\":\"1621\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"1655\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1611\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1621\",\"type\":\"BasicTicker\"}},\"id\":\"1620\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"1656\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"1611\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1643\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1625\",\"type\":\"LinearAxis\"},{\"attributes\":{\"interval\":12},\"id\":\"1643\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"plot\":{\"id\":\"1611\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1621\",\"type\":\"BasicTicker\"}},\"id\":\"1624\",\"type\":\"Grid\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"1611\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"1645\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"1629\",\"type\":\"Grid\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1649\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"1648\",\"type\":\"Quad\"}],\"root_ids\":[\"1611\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"cd8ab377-2ece-49e0-a11a-05dfed560fff\",\"roots\":{\"1611\":\"c78f5385-0e6f-4968-811f-25334b608f95\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "1611"
+ }
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "OSq4nJfL-Y2y"
+ },
+ "source": [
+ "### Interpolating between two sequences"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "metadata": {
+ "colab_type": "code",
+ "id": "NjHUvtn5-daA",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 305
+ },
+ "outputId": "83a921f5-5d6e-4ccf-f4d6-6a3ab269a503"
+ },
+ "source": [
+ "# We're going to interpolate between the Twinkle Twinkle Little Star\n",
+ "# NoteSequence we defined in the first section, and one of the generated\n",
+ "# sequences from the previous VAE example\n",
+ "\n",
+ "# How many sequences, including the start and end ones, to generate.\n",
+ "num_steps = 8;\n",
+ "\n",
+ "# This gives us a list of sequences.\n",
+ "note_sequences = music_vae.interpolate(\n",
+ " twinkle_twinkle,\n",
+ " teapot, \n",
+ " num_steps=num_steps,\n",
+ " length=32)\n",
+ "\n",
+ "# Concatenate them into one long sequence, with the start and \n",
+ "# end sequences at each end. \n",
+ "interp_seq = note_seq.sequences_lib.concatenate_sequences(note_sequences)\n",
+ "\n",
+ "note_seq.play_sequence(interp_seq, synth=note_seq.fluidsynth)\n",
+ "note_seq.plot_sequence(interp_seq)"
+ ],
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ "
\n",
+ "
Loading BokehJS ...\n",
+ "
"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "\n",
+ "(function(root) {\n",
+ " function now() {\n",
+ " return new Date();\n",
+ " }\n",
+ "\n",
+ " var force = true;\n",
+ "\n",
+ " if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
+ " root._bokeh_onload_callbacks = [];\n",
+ " root._bokeh_is_loading = undefined;\n",
+ " }\n",
+ "\n",
+ " var JS_MIME_TYPE = 'application/javascript';\n",
+ " var HTML_MIME_TYPE = 'text/html';\n",
+ " var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
+ " var CLASS_NAME = 'output_bokeh rendered_html';\n",
+ "\n",
+ " /**\n",
+ " * Render data to the DOM node\n",
+ " */\n",
+ " function render(props, node) {\n",
+ " var script = document.createElement(\"script\");\n",
+ " node.appendChild(script);\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when an output is cleared or removed\n",
+ " */\n",
+ " function handleClearOutput(event, handle) {\n",
+ " var cell = handle.cell;\n",
+ "\n",
+ " var id = cell.output_area._bokeh_element_id;\n",
+ " var server_id = cell.output_area._bokeh_server_id;\n",
+ " // Clean up Bokeh references\n",
+ " if (id != null && id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ "\n",
+ " if (server_id !== undefined) {\n",
+ " // Clean up Bokeh references\n",
+ " var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
+ " cell.notebook.kernel.execute(cmd, {\n",
+ " iopub: {\n",
+ " output: function(msg) {\n",
+ " var id = msg.content.text.trim();\n",
+ " if (id in Bokeh.index) {\n",
+ " Bokeh.index[id].model.document.clear();\n",
+ " delete Bokeh.index[id];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " });\n",
+ " // Destroy server and session\n",
+ " var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
+ " cell.notebook.kernel.execute(cmd);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " /**\n",
+ " * Handle when a new output is added\n",
+ " */\n",
+ " function handleAddOutput(event, handle) {\n",
+ " var output_area = handle.output_area;\n",
+ " var output = handle.output;\n",
+ "\n",
+ " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
+ " if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
+ " return\n",
+ " }\n",
+ "\n",
+ " var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
+ "\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
+ " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
+ " // store reference to embed id on output_area\n",
+ " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
+ " }\n",
+ " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
+ " var bk_div = document.createElement(\"div\");\n",
+ " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
+ " var script_attrs = bk_div.children[0].attributes;\n",
+ " for (var i = 0; i < script_attrs.length; i++) {\n",
+ " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
+ " }\n",
+ " // store reference to server id on output_area\n",
+ " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " function register_renderer(events, OutputArea) {\n",
+ "\n",
+ " function append_mime(data, metadata, element) {\n",
+ " // create a DOM node to render to\n",
+ " var toinsert = this.create_output_subarea(\n",
+ " metadata,\n",
+ " CLASS_NAME,\n",
+ " EXEC_MIME_TYPE\n",
+ " );\n",
+ " this.keyboard_manager.register_events(toinsert);\n",
+ " // Render to node\n",
+ " var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
+ " render(props, toinsert[toinsert.length - 1]);\n",
+ " element.append(toinsert);\n",
+ " return toinsert\n",
+ " }\n",
+ "\n",
+ " /* Handle when an output is cleared or removed */\n",
+ " events.on('clear_output.CodeCell', handleClearOutput);\n",
+ " events.on('delete.Cell', handleClearOutput);\n",
+ "\n",
+ " /* Handle when a new output is added */\n",
+ " events.on('output_added.OutputArea', handleAddOutput);\n",
+ "\n",
+ " /**\n",
+ " * Register the mime type and append_mime function with output_area\n",
+ " */\n",
+ " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
+ " /* Is output safe? */\n",
+ " safe: true,\n",
+ " /* Index of renderer in `output_area.display_order` */\n",
+ " index: 0\n",
+ " });\n",
+ " }\n",
+ "\n",
+ " // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
+ " if (root.Jupyter !== undefined) {\n",
+ " var events = require('base/js/events');\n",
+ " var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
+ "\n",
+ " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
+ " register_renderer(events, OutputArea);\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " \n",
+ " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
+ " root._bokeh_timeout = Date.now() + 5000;\n",
+ " root._bokeh_failed_load = false;\n",
+ " }\n",
+ "\n",
+ " var NB_LOAD_WARNING = {'data': {'text/html':\n",
+ " \"\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
+ " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n",
+ " \"- use INLINE resources instead, as so:
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"from bokeh.resources import INLINE\\n\"+\n",
+ " \"output_notebook(resources=INLINE)\\n\"+\n",
+ " \"
\\n\"+\n",
+ " \"
\"}};\n",
+ "\n",
+ " function display_loaded() {\n",
+ " var el = document.getElementById(\"2885\");\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS is loading...\";\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " if (el != null) {\n",
+ " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
+ " }\n",
+ " } else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(display_loaded, 100)\n",
+ " }\n",
+ " }\n",
+ "\n",
+ "\n",
+ " function run_callbacks() {\n",
+ " try {\n",
+ " root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
+ " }\n",
+ " finally {\n",
+ " delete root._bokeh_onload_callbacks\n",
+ " }\n",
+ " console.info(\"Bokeh: all callbacks have finished\");\n",
+ " }\n",
+ "\n",
+ " function load_libs(js_urls, callback) {\n",
+ " root._bokeh_onload_callbacks.push(callback);\n",
+ " if (root._bokeh_is_loading > 0) {\n",
+ " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
+ " return null;\n",
+ " }\n",
+ " if (js_urls == null || js_urls.length === 0) {\n",
+ " run_callbacks();\n",
+ " return null;\n",
+ " }\n",
+ " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
+ " root._bokeh_is_loading = js_urls.length;\n",
+ " for (var i = 0; i < js_urls.length; i++) {\n",
+ " var url = js_urls[i];\n",
+ " var s = document.createElement('script');\n",
+ " s.src = url;\n",
+ " s.async = false;\n",
+ " s.onreadystatechange = s.onload = function() {\n",
+ " root._bokeh_is_loading--;\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
+ " run_callbacks()\n",
+ " }\n",
+ " };\n",
+ " s.onerror = function() {\n",
+ " console.warn(\"failed to load library \" + url);\n",
+ " };\n",
+ " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
+ " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
+ " }\n",
+ " };var element = document.getElementById(\"2885\");\n",
+ " if (element == null) {\n",
+ " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2885' but no matching script tag was found. \")\n",
+ " return false;\n",
+ " }\n",
+ "\n",
+ " var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n",
+ "\n",
+ " var inline_js = [\n",
+ " function(Bokeh) {\n",
+ " Bokeh.set_log_level(\"info\");\n",
+ " },\n",
+ " \n",
+ " function(Bokeh) {\n",
+ " \n",
+ " },\n",
+ " function(Bokeh) {\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n",
+ " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n",
+ " }\n",
+ " ];\n",
+ "\n",
+ " function run_inline_js() {\n",
+ " \n",
+ " if ((root.Bokeh !== undefined) || (force === true)) {\n",
+ " for (var i = 0; i < inline_js.length; i++) {\n",
+ " inline_js[i].call(root, root.Bokeh);\n",
+ " }if (force === true) {\n",
+ " display_loaded();\n",
+ " }} else if (Date.now() < root._bokeh_timeout) {\n",
+ " setTimeout(run_inline_js, 100);\n",
+ " } else if (!root._bokeh_failed_load) {\n",
+ " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
+ " root._bokeh_failed_load = true;\n",
+ " } else if (force !== true) {\n",
+ " var cell = $(document.getElementById(\"2885\")).parents('.cell').data().cell;\n",
+ " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
+ " }\n",
+ "\n",
+ " }\n",
+ "\n",
+ " if (root._bokeh_is_loading === 0) {\n",
+ " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
+ " run_inline_js();\n",
+ " } else {\n",
+ " load_libs(js_urls, function() {\n",
+ " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
+ " run_inline_js();\n",
+ " });\n",
+ " }\n",
+ "}(window));"
+ ],
+ "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"2885\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"2885\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2885' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.0.1.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.0.1.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.0.1.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"2885\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n"
+ ]
+ },
+ "metadata": {
+ "tags": []
+ }
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "application/javascript": [
+ "(function(root) {\n",
+ " function embed_document(root) {\n",
+ " \n",
+ " var docs_json = {\"1e341ac2-2355-4fef-9882-b804c8507d1b\":{\"roots\":{\"references\":[{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2855\",\"type\":\"HoverTool\"},{\"id\":\"2856\",\"type\":\"PanTool\"},{\"id\":\"2857\",\"type\":\"BoxZoomTool\"},{\"id\":\"2858\",\"type\":\"ResetTool\"},{\"id\":\"2859\",\"type\":\"SaveTool\"}]},\"id\":\"2860\",\"type\":\"Toolbar\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"field\":\"fill_alpha\"},\"fill_color\":{\"value\":\"#d53e4f\"},\"left\":{\"field\":\"start_time\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"2873\",\"type\":\"Quad\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2862\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":{\"id\":\"2836\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2846\",\"type\":\"BasicTicker\"}},\"id\":\"2849\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2846\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis_label\":\"time (sec)\",\"formatter\":{\"id\":\"2880\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"2836\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2846\",\"type\":\"BasicTicker\"}},\"id\":\"2845\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2843\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2841\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2882\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2883\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2880\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2881\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"interval\":12},\"id\":\"2868\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{},\"id\":\"2859\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2858\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null,\"data\":{\"bottom\":{\"__ndarray__\":\"zczMzMzMTUDNzMzMzMxNQGZmZmZmplBAZmZmZmamUEBmZmZmZiZRQGZmZmZmJlFAZmZmZmamUEBmZmZmZiZQQGZmZmZmJlBAzczMzMzMT0DNzMzMzMxPQM3MzMzMzE5AzczMzMzMTkDNzMzMzMxNQM3MzMzMzE1AzczMzMzMT0BmZmZmZqZQQGZmZmZmplBAZmZmZmYmUUBmZmZmZiZRQGZmZmZmplBAZmZmZmYmUEBmZmZmZiZQQM3MzMzMzE9AzczMzMzMT0DNzMzMzMxOQM3MzMzMzE5AzczMzMzMTUBmZmZmZqZQQGZmZmZmJlFAZmZmZmYmUUBmZmZmZuZRQGZmZmZmJlFAZmZmZmYmUUBmZmZmZqZQQGZmZmZmplBAZmZmZmYmUUDNzMzMzMxPQM3MzMzMzE5AzczMzMzMTkBmZmZmZqZQQGZmZmZmJlFAZmZmZmamUUBmZmZmZuZRQGZmZmZmJlFAZmZmZmYmUUBmZmZmZmZSQM3MzMzMzE5AZmZmZmbmUkBmZmZmZuZSQGZmZmZmplNAzczMzMzMTkBmZmZmZqZTQGZmZmZmZlJAZmZmZmYmUUBmZmZmZqZRQGZmZmZm5lFAZmZmZmYmUUBmZmZmZiZRQGZmZmZmZlJAZmZmZmYmU0BmZmZmZuZSQGZmZmZmplNAZmZmZmZmU0BmZmZmZmZSQGZmZmZmZlJAZmZmZmamUUBmZmZmZqZRQGZmZmZm5lFAZmZmZmYmUUBmZmZmZqZQQGZmZmZmplNAZmZmZmbmUkBmZmZmZqZTQGZmZmZmZlNAZmZmZmZmUkBmZmZmZmZRQGZmZmZmplFAZmZmZmbmUUBmZmZmZmZSQGZmZmZmplJAZmZmZmZmU0BmZmZmZmZTQGZmZmZmplNAZmZmZmbmUkBmZmZmZiZRQGZmZmZmplFAZmZmZmYmUkBmZmZmZmZSQGZmZmZm5lJAZmZmZmYmVEBmZmZmZmZTQGZmZmZmJlRAZmZmZmbmUkA=\",\"dtype\":\"float64\",\"shape\":[94]},\"duration\":{\"__ndarray__\":\"AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA4D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAAOA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA4D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAAOA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8AAAAAAADQPwAAAAAAANA/AAAAAAAA0D8AAAAAAADQPwAAAAAAANA/AAAAAAAA4D8AAAAAAADgPwAAAAAAAOA/AAAAAAAA8D8=\",\"dtype\":\"float64\",\"shape\":[94]},\"end_time\":{\"__ndarray__\":\"AAAAAAAA0D8AAAAAAADgPwAAAAAAAOg/AAAAAAAA8D8AAAAAAAD0PwAAAAAAAPg/AAAAAAAAAEAAAAAAAAACQAAAAAAAAARAAAAAAAAABkAAAAAAAAAIQAAAAAAAAApAAAAAAAAADEAAAAAAAAAQQAAAAAAAABFAAAAAAAAAEkAAAAAAAAATQAAAAAAAABRAAAAAAAAAFUAAAAAAAAAWQAAAAAAAABhAAAAAAAAAGUAAAAAAAAAaQAAAAAAAABtAAAAAAAAAHEAAAAAAAAAdQAAAAAAAAB5AAAAAAAAAIEAAAAAAAIAgQAAAAAAAACFAAAAAAACAIUAAAAAAAAAiQAAAAAAAgCJAAAAAAAAAI0AAAAAAAAAkQAAAAAAAACVAAAAAAACAJUAAAAAAAAAmQAAAAAAAgCZAAAAAAAAAJ0AAAAAAAAAoQAAAAAAAAClAAAAAAACAKUAAAAAAAAAqQAAAAAAAgCpAAAAAAAAAK0AAAAAAAAAsQAAAAAAAAC1AAAAAAACALUAAAAAAAAAuQAAAAAAAgC5AAAAAAAAAL0AAAAAAAAAwQAAAAAAAQDBAAAAAAACAMEAAAAAAAMAwQAAAAAAAADFAAAAAAABAMUAAAAAAAIAxQAAAAAAAQDJAAAAAAACAMkAAAAAAAMAyQAAAAAAAADNAAAAAAABAM0AAAAAAAIAzQAAAAAAAwDNAAAAAAAAANEAAAAAAAEA0QAAAAAAAgDRAAAAAAADANEAAAAAAAAA1QAAAAAAAADZAAAAAAABANkAAAAAAAIA2QAAAAAAAwDZAAAAAAAAAN0AAAAAAAEA3QAAAAAAAgDdAAAAAAADAN0AAAAAAAAA4QAAAAAAAQDhAAAAAAACAOEAAAAAAAIA5QAAAAAAAADpAAAAAAAAAO0AAAAAAAEA7QAAAAAAAgDtAAAAAAADAO0AAAAAAAAA8QAAAAAAAQDxAAAAAAAAAPUAAAAAAAIA9QAAAAAAAAD5AAAAAAAAAP0A=\",\"dtype\":\"float64\",\"shape\":[94]},\"fill_alpha\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8=\",\"dtype\":\"float64\",\"shape\":[94]},\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],\"instrument\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"pitch\":[60,60,67,67,69,69,67,65,65,64,64,62,62,60,60,64,67,67,69,69,67,65,65,64,64,62,62,60,67,69,69,72,69,69,67,67,69,64,62,62,67,69,71,72,69,69,74,62,76,76,79,62,79,74,69,71,72,69,69,74,77,76,79,78,74,74,71,71,72,69,67,79,76,79,78,74,70,71,72,74,75,78,78,79,76,69,71,73,74,76,81,78,81,76],\"program\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\"start_time\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAADQPwAAAAAAAOA/AAAAAAAA6D8AAAAAAADwPwAAAAAAAPQ/AAAAAAAA+D8AAAAAAAAAQAAAAAAAAAJAAAAAAAAABEAAAAAAAAAGQAAAAAAAAAhAAAAAAAAACkAAAAAAAAAMQAAAAAAAABBAAAAAAAAAEUAAAAAAAAASQAAAAAAAABNAAAAAAAAAFEAAAAAAAAAVQAAAAAAAABZAAAAAAAAAGEAAAAAAAAAZQAAAAAAAABpAAAAAAAAAG0AAAAAAAAAcQAAAAAAAAB1AAAAAAAAAHkAAAAAAAAAgQAAAAAAAgCBAAAAAAAAAIUAAAAAAAIAhQAAAAAAAACJAAAAAAACAIkAAAAAAAAAjQAAAAAAAgCRAAAAAAAAAJUAAAAAAAIAlQAAAAAAAACZAAAAAAACAJkAAAAAAAAAnQAAAAAAAgChAAAAAAAAAKUAAAAAAAIApQAAAAAAAACpAAAAAAACAKkAAAAAAAAArQAAAAAAAgCxAAAAAAAAALUAAAAAAAIAtQAAAAAAAAC5AAAAAAACALkAAAAAAAAAvQAAAAAAAADBAAAAAAABAMEAAAAAAAIAwQAAAAAAAwDBAAAAAAAAAMUAAAAAAAEAxQAAAAAAAADJAAAAAAABAMkAAAAAAAIAyQAAAAAAAwDJAAAAAAAAAM0AAAAAAAEAzQAAAAAAAgDNAAAAAAADAM0AAAAAAAAA0QAAAAAAAQDRAAAAAAACANEAAAAAAAMA0QAAAAAAAgDVAAAAAAAAANkAAAAAAAEA2QAAAAAAAgDZAAAAAAADANkAAAAAAAAA3QAAAAAAAQDdAAAAAAACAN0AAAAAAAMA3QAAAAAAAADhAAAAAAABAOEAAAAAAAAA5QAAAAAAAgDlAAAAAAAAAOkAAAAAAAAA7QAAAAAAAQDtAAAAAAACAO0AAAAAAAMA7QAAAAAAAADxAAAAAAACAPEAAAAAAAAA9QAAAAAAAgD1AAAAAAAAAPkA=\",\"dtype\":\"float64\",\"shape\":[94]},\"top\":{\"__ndarray__\":\"MzMzMzMzTkAzMzMzMzNOQJqZmZmZ2VBAmpmZmZnZUECamZmZmVlRQJqZmZmZWVFAmpmZmZnZUECamZmZmVlQQJqZmZmZWVBAmpmZmZkZUECamZmZmRlQQDMzMzMzM09AMzMzMzMzT0AzMzMzMzNOQDMzMzMzM05AmpmZmZkZUECamZmZmdlQQJqZmZmZ2VBAmpmZmZlZUUCamZmZmVlRQJqZmZmZ2VBAmpmZmZlZUECamZmZmVlQQJqZmZmZGVBAmpmZmZkZUEAzMzMzMzNPQDMzMzMzM09AMzMzMzMzTkCamZmZmdlQQJqZmZmZWVFAmpmZmZlZUUCamZmZmRlSQJqZmZmZWVFAmpmZmZlZUUCamZmZmdlQQJqZmZmZ2VBAmpmZmZlZUUCamZmZmRlQQDMzMzMzM09AMzMzMzMzT0CamZmZmdlQQJqZmZmZWVFAmpmZmZnZUUCamZmZmRlSQJqZmZmZWVFAmpmZmZlZUUCamZmZmZlSQDMzMzMzM09AmpmZmZkZU0CamZmZmRlTQJqZmZmZ2VNAMzMzMzMzT0CamZmZmdlTQJqZmZmZmVJAmpmZmZlZUUCamZmZmdlRQJqZmZmZGVJAmpmZmZlZUUCamZmZmVlRQJqZmZmZmVJAmpmZmZlZU0CamZmZmRlTQJqZmZmZ2VNAmpmZmZmZU0CamZmZmZlSQJqZmZmZmVJAmpmZmZnZUUCamZmZmdlRQJqZmZmZGVJAmpmZmZlZUUCamZmZmdlQQJqZmZmZ2VNAmpmZmZkZU0CamZmZmdlTQJqZmZmZmVNAmpmZmZmZUkCamZmZmZlRQJqZmZmZ2VFAmpmZmZkZUkCamZmZmZlSQJqZmZmZ2VJAmpmZmZmZU0CamZmZmZlTQJqZmZmZ2VNAmpmZmZkZU0CamZmZmVlRQJqZmZmZ2VFAmpmZmZlZUkCamZmZmZlSQJqZmZmZGVNAmpmZmZlZVECamZmZmZlTQJqZmZmZWVRAmpmZmZkZU0A=\",\"dtype\":\"float64\",\"shape\":[94]},\"velocity\":[80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80]},\"selected\":{\"id\":\"2882\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"2883\",\"type\":\"UnionRenderers\"}},\"id\":\"2871\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"interval\":12},\"id\":\"2870\",\"type\":\"SingleIntervalTicker\"},{\"attributes\":{\"source\":{\"id\":\"2871\",\"type\":\"ColumnDataSource\"}},\"id\":\"2876\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"2871\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2873\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2874\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"2876\",\"type\":\"CDSView\"}},\"id\":\"2875\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"start_time\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"end_time\"},\"top\":{\"field\":\"top\"}},\"id\":\"2874\",\"type\":\"Quad\"},{\"attributes\":{\"axis_label\":\"pitch (MIDI)\",\"formatter\":{\"id\":\"2881\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"2836\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2868\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"2850\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"2878\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"renderers\":\"auto\",\"tooltips\":[[\"velo\",\"@velocity\"],[\"program\",\"@program\"],[\"end_time\",\"@end_time\"],[\"pitch\",\"@pitch\"],[\"duration\",\"@duration\"],[\"velocity\",\"@velocity\"],[\"start_time\",\"@start_time\"],[\"fill_alpha\",\"@fill_alpha\"]]},\"id\":\"2855\",\"type\":\"HoverTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"2836\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"2870\",\"type\":\"SingleIntervalTicker\"}},\"id\":\"2854\",\"type\":\"Grid\"},{\"attributes\":{\"overlay\":{\"id\":\"2862\",\"type\":\"BoxAnnotation\"}},\"id\":\"2857\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"2856\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null},\"id\":\"2839\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null},\"id\":\"2837\",\"type\":\"DataRange1d\"},{\"attributes\":{\"below\":[{\"id\":\"2845\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"2850\",\"type\":\"LinearAxis\"}],\"plot_height\":200,\"plot_width\":500,\"renderers\":[{\"id\":\"2845\",\"type\":\"LinearAxis\"},{\"id\":\"2849\",\"type\":\"Grid\"},{\"id\":\"2850\",\"type\":\"LinearAxis\"},{\"id\":\"2854\",\"type\":\"Grid\"},{\"id\":\"2862\",\"type\":\"BoxAnnotation\"},{\"id\":\"2875\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"2878\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"2860\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"2837\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"2841\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"2839\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"2843\",\"type\":\"LinearScale\"}},\"id\":\"2836\",\"subtype\":\"Figure\",\"type\":\"Plot\"}],\"root_ids\":[\"2836\"]},\"title\":\"Bokeh Application\",\"version\":\"1.0.1\"}};\n",
+ " var render_items = [{\"docid\":\"1e341ac2-2355-4fef-9882-b804c8507d1b\",\"roots\":{\"2836\":\"3f492766-5507-44c1-ac4a-05e1ac2cc82e\"}}];\n",
+ " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
+ "\n",
+ " }\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " } else {\n",
+ " var attempts = 0;\n",
+ " var timer = setInterval(function(root) {\n",
+ " if (root.Bokeh !== undefined) {\n",
+ " embed_document(root);\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " attempts++;\n",
+ " if (attempts > 100) {\n",
+ " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
+ " clearInterval(timer);\n",
+ " }\n",
+ " }, 10, root)\n",
+ " }\n",
+ "})(window);"
+ ],
+ "application/vnd.bokehjs_exec.v0+json": ""
+ },
+ "metadata": {
+ "tags": [],
+ "application/vnd.bokehjs_exec.v0+json": {
+ "id": "2836"
+ }
+ }
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "colab_type": "text",
+ "id": "Ho6gRbJ4Qgkj"
+ },
+ "source": [
+ "# That's it!\n",
+ "\n",
+ "You're now ready to build your own amazing, Machine Learning powered, music instrument! If you want more information, you can check out:\n",
+ "\n",
+ "- some [demos](https://magenta.tensorflow.org/demos) `#MadeWithMagenta`\n",
+ "- some more of our [Colab notebooks](https://magenta.tensorflow.org/demos#colab-notebooks)\n",
+ "- the [documentation](https://github.com/magenta/magenta)\n",
+ "- the [Magenta blog](https://magenta.tensorflow.org/blog), which talks about all the mathy bits we skipped.\n",
+ "\n",
+ "Have fun! 💕"
+ ]
+ }
+ ]
+}
\ No newline at end of file