diff --git a/notebooks/test-paramtable.ipynb b/notebooks/test-paramtable.ipynb new file mode 100644 index 0000000..ab74915 --- /dev/null +++ b/notebooks/test-paramtable.ipynb @@ -0,0 +1,118 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "c357dc88-e4f5-44fb-ade3-97846008f074", + "metadata": {}, + "outputs": [], + "source": [ + "from csoundengine import *" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "a9e6384e-9305-437a-b4b6-5087c2fdbf58", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "\n", + "--Csound version 6.19 (double samples) May 26 2023\n", + "[commit: 593ac80dd986b58f24e3d59242243ba6266edda7]\n", + "\u001b[mlibsndfile-1.2.0\n", + "\u001b[msr = 48000.0,\u001b[m kr = 750.000,\u001b[m ksmps = 64\n", + "\u001b[m0dBFS level = 1.0,\u001b[m A4 tuning = 442.0\n", + "\u001b[maudio buffered in 1024 sample-frame blocks\n", + "\u001b[mreading 4096-byte blks of shorts from adc:PCM Source: (RAW)\n", + "writing 2048 sample blks of 64-bit floats to dac:Built-in Audio Analogue Stereo:\n", + "SECTION 1:\n" + ] + } + ], + "source": [ + "s = Engine().session()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "11afefa8-a926-41bd-9187-a217690b9341", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "Instr foo
\n", + "    tabargs = {'kpitch': 60.0, 'kamp': 0.1}\n", + "
\n", + "
    ; --- start generated table code\n",
+       "    iparams_ = p4\n",
+       "    if iparams_ == 0 || ftexists:i(iparams_) == 0 then\n",
+       "        initerror sprintf("Params table (%d) does not exist (p1: %f)", iparams_, p1)\n",
+       "        goto __exit\n",
+       "    endif\n",
+       "    iparamslen_ = ftlen(iparams_)\n",
+       "    if iparamslen_ < 2 then\n",
+       "        initerror sprintf("params table too small (size: %d, needed: 2)", iparamslen_)\n",
+       "    endif\n",
+       "    kpitch tab 0, iparams_\n",
+       "    kamp tab 1, iparams_\n",
+       "    ftfree iparams_, 1\n",
+       "    ; --- end generated table code\n",
+       "    outch oscili:a(kamp, mtof(kpitch)\n",
+       "    __exit:\n",
+       "
\n", + "
" + ], + "text/plain": [ + "Instr(foo, tabargs={'kpitch': 60.0, 'kamp': 0.1})" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "s.defInstr(\"foo\", r\"\"\"\n", + "{kpitch=60, kamp=0.1}\n", + "outch oscili:a(kamp, mtof(kpitch)\n", + "\"\"\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d4e65796-6b76-4013-808b-041192f2cc76", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.9.15" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}