{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Csound engine started at slot#: 1.\n" ] } ], "source": [ "%matplotlib qt5\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "%load_ext csoundmagics\n", "cs = ICsound()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "tables = \"\"\"\n", "f 1 0 1024 16 1 1024 1 0\n", "f 2 0 1024 16 1 1024 2 0\n", "f 3 0 1024 16 1 1024 10 0\n", "f 4 0 1024 16 1 1024 -1 0\n", "f 5 0 1024 16 1 1024 -2 0\n", "f 6 0 1024 16 1 1024 -10 0\n", "f 7 0 1024 16 0 1024 1 1\n", "f 8 0 1024 16 0 1024 2 1\n", "f 9 0 1024 16 0 1024 10 1\n", "f 10 0 1024 16 0 1024 -1 1\n", "f 11 0 1024 16 0 1024 -2 1\n", "f 12 0 1024 16 0 1024 -10 1\n", "\"\"\"\n", "cs.sendScore(tables)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "fig, ax = plt.subplots(2,6,figsize=(15,5))\n", "xmax = cs.tableLength(1)\n", "x = range(xmax)\n", "types = [1,2,10,-1,-2,-10]*2\n", "count = 0\n", "for i in range(2):\n", " for j in range(6):\n", " ax[i][j].set_xlim(0,xmax)\n", " ax[i][j].set_ylim(0,1)\n", " ax[i][j].set_xticks([])\n", " ax[i][j].set_yticks([0,1])\n", " ax[i][j].set_title('type = %d'%types[count])\n", " ax[i][j].set_xlabel(tables.splitlines()[count+1])\n", " ax[i][j].plot(x,cs.table(count+1),c='k')\n", " count += 1\n", "fig.tight_layout()\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }