Debian Codegraph @

images/src/gen16.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {},
7 "outputs": [
8 {
9 "name": "stdout",
10 "output_type": "stream",
11 "text": [
12 "Csound engine started at slot#: 1.\n"
13 ]
14 }
15 ],
16 "source": [
17 "%matplotlib qt5\n",
18 "import matplotlib.pyplot as plt\n",
19 "import numpy as np\n",
20 "%load_ext csoundmagics\n",
21 "cs = ICsound()"
22 ]
23 },
24 {
25 "cell_type": "code",
26 "execution_count": 2,
27 "metadata": {},
28 "outputs": [],
29 "source": [
30 "tables = \"\"\"\n",
31 "f 1 0 1024 16 1 1024 1 0\n",
32 "f 2 0 1024 16 1 1024 2 0\n",
33 "f 3 0 1024 16 1 1024 10 0\n",
34 "f 4 0 1024 16 1 1024 -1 0\n",
35 "f 5 0 1024 16 1 1024 -2 0\n",
36 "f 6 0 1024 16 1 1024 -10 0\n",
37 "f 7 0 1024 16 0 1024 1 1\n",
38 "f 8 0 1024 16 0 1024 2 1\n",
39 "f 9 0 1024 16 0 1024 10 1\n",
40 "f 10 0 1024 16 0 1024 -1 1\n",
41 "f 11 0 1024 16 0 1024 -2 1\n",
42 "f 12 0 1024 16 0 1024 -10 1\n",
43 "\"\"\"\n",
44 "cs.sendScore(tables)"
45 ]
46 },
47 {
48 "cell_type": "code",
49 "execution_count": 6,
50 "metadata": {},
51 "outputs": [],
52 "source": [
53 "fig, ax = plt.subplots(2,6,figsize=(15,5))\n",
54 "xmax = cs.tableLength(1)\n",
55 "x = range(xmax)\n",
56 "types = [1,2,10,-1,-2,-10]*2\n",
57 "count = 0\n",
58 "for i in range(2):\n",
59 " for j in range(6):\n",
60 " ax[i][j].set_xlim(0,xmax)\n",
61 " ax[i][j].set_ylim(0,1)\n",
62 " ax[i][j].set_xticks([])\n",
63 " ax[i][j].set_yticks([0,1])\n",
64 " ax[i][j].set_title('type = %d'%types[count])\n",
65 " ax[i][j].set_xlabel(tables.splitlines()[count+1])\n",
66 " ax[i][j].plot(x,cs.table(count+1),c='k')\n",
67 " count += 1\n",
68 "fig.tight_layout()\n",
69 "plt.show()"
70 ]
71 },
72 {
73 "cell_type": "code",
74 "execution_count": null,
75 "metadata": {},
76 "outputs": [],
77 "source": []
78 }
79 ],
80 "metadata": {
81 "kernelspec": {
82 "display_name": "Python 3",
83 "language": "python",
84 "name": "python3"
85 },
86 "language_info": {
87 "codemirror_mode": {
88 "name": "ipython",
89 "version": 3
90 },
91 "file_extension": ".py",
92 "mimetype": "text/x-python",
93 "name": "python",
94 "nbconvert_exporter": "python",
95 "pygments_lexer": "ipython3",
96 "version": "3.7.3"
97 }
98 },
99 "nbformat": 4,
100 "nbformat_minor": 2
101 }