83 lines
1.9 KiB
Plaintext
83 lines
1.9 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Playing note: 60\n",
|
|
"Playing note: 67\n",
|
|
"Playing note: 64\n",
|
|
"Playing note: 69\n",
|
|
"Playing note: 65\n",
|
|
"Playing note: 76\n",
|
|
"Playing note: 67\n",
|
|
"Playing note: 64\n",
|
|
"Playing note: 69\n",
|
|
"Playing note: 65\n",
|
|
"Playing note: 62\n",
|
|
"Playing note: 71\n",
|
|
"Playing note: 74\n",
|
|
"Playing note: 65\n",
|
|
"Playing note: 67\n",
|
|
"Playing note: 69\n",
|
|
"Playing note: 64\n",
|
|
"Playing note: 62\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Stream callback called with status: <sounddevice.CallbackFlags: output underflow>.\n",
|
|
"Stream callback called with status: <sounddevice.CallbackFlags: output underflow>.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from jupylet.audio.bundle import *\n",
|
|
"from clockblocks import *\n",
|
|
"from ziffers import *\n",
|
|
"\n",
|
|
"melody = zparse(\"q 0 4 2 5 e 3 9 4 2 s 5 3 1 6 8 3 4 5 2 1\")\n",
|
|
"bpm = 180\n",
|
|
"\n",
|
|
"clock = Clock(initial_tempo=bpm)\n",
|
|
"\n",
|
|
"for n in melody.evaluated_values:\n",
|
|
" if(isinstance(n, Pitch)):\n",
|
|
" print(\"Playing note: \" + str(n.get_note()))\n",
|
|
" tb303.play(n.get_note(), n.get_beat())\n",
|
|
" clock.wait(n.get_beat())\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"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.11.0b4"
|
|
},
|
|
"orig_nbformat": 4
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|