{ "info": { "author": "Marc Evanstein", "author_email": "marc@marcevanstein.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# clockblocks\n\n_clockblocks_ is a python library for controlling the flow of time, designed with musical applications in mind. In particular, it is a central component of [scamp](https://github.com/MarcTheSpark/scamp/), a Suite for Composing Algorithmic Music in Python. It is described in detail [in this paper](marcevanstein.com/Writings/Clockblocks.pdf).\n\nA `Clock` acts like thread, but with the advantage that when multiple clocks are coordinated under the same master clock they remain precisely coordinated and do not experience drift. Furthermore, processing time is taken into account when \"wait\" is called in a given Clock. For example, the following program:\n\n```python\nimport clockblocks\nimport time\nimport math\n\nclock = clockblocks.Clock()\nstart = time.time()\n\nwhile True:\n print(\"Current time: {}\".format(round(time.time() - start, 4)))\n # do some pointless and time-consuming calculations\n for i in range(1000000):\n math.log((i+1)**0.7)\n clock.wait(2)\n```\n\n... generates the output:\n\n```console\nCurrent time: 0.0\nCurrent time: 2.0001\nCurrent time: 4.0001\nCurrent time: 6.0\nCurrent time: 8.0001\nCurrent time: 10.0\n```\n\nWhereas a traditional thread:\n\n```python\nimport time\nimport math\n\nstart = time.time()\n\nwhile True:\n print(\"Current time: {}\".format(round(time.time() - start, 4)))\n # do some pointless and time-consuming calculations\n for i in range(1000000):\n math.log((i+1)**0.7)\n time.sleep(2)\n```\n\n\n...will gradually drift because of the intensive calculations, outputting:\n\n```console\nCurrent time: 0.0\nCurrent time: 2.3772\nCurrent time: 4.7623\nCurrent time: 7.1397\nCurrent time: 9.5151\nCurrent time: 11.893\n```\n\nIn addition, _clockblocks_ offers useful musical functionality, like sudden and gradual changes of tempo. Perhaps the most exciting feature of _clockblocks_ is that clocks moving at different tempos can be nested within each other. In this case, each clock distorts time for those underneath it: a clock whose tempo is oscillating between slow and fast, nested within a clock that is accelerating, will generate a time stream whose tempo oscillates faster and faster.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/MarcTheSpark/clockblocks", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "clockblocks", "package_url": "https://pypi.org/project/clockblocks/", "platform": "", "project_url": "https://pypi.org/project/clockblocks/", "project_urls": { "Homepage": "https://github.com/MarcTheSpark/clockblocks" }, "release_url": "https://pypi.org/project/clockblocks/0.2.1/", "requires_dist": [ "expenvelope (>=0.2)" ], "requires_python": "", "summary": "A python library for controlling the flow of musical time.", "version": "0.2.1" }, "last_serial": 5452406, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1742053b6072942988003f0155a537e2", "sha256": "dceb76d686f076fa8feb7d61119a073c43efe9e29e89af7d7bf1b37c0dba2188" }, "downloads": -1, "filename": "clockblocks-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1742053b6072942988003f0155a537e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27820, "upload_time": "2019-01-11T04:11:13", "url": "https://files.pythonhosted.org/packages/76/00/a7c25788b26112c543dd6b29af8e231df9c7fa8cec1701d3931937899142/clockblocks-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70d63ddb98a0289c93ed7d793387a308", "sha256": "8a9aff16b257e80d96298f476d92047029e2722376ba478fda6618d471ab2d74" }, "downloads": -1, "filename": "clockblocks-0.1.0.tar.gz", "has_sig": false, "md5_digest": "70d63ddb98a0289c93ed7d793387a308", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14144, "upload_time": "2019-01-11T04:11:15", "url": "https://files.pythonhosted.org/packages/3e/dc/83a4c52259ae7f3d43d4dd3d43b49dd477714ffc1f0933cb23c86e1d0c2e/clockblocks-0.1.0.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "caf658e613ea3e678c11f5d31cf89a81", "sha256": "325c3f4bdb683e411d40c097306ef6ddc231077f31ec346bd01456c6b73eaeb5" }, "downloads": -1, "filename": "clockblocks-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "caf658e613ea3e678c11f5d31cf89a81", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 30579, "upload_time": "2019-05-15T22:57:34", "url": "https://files.pythonhosted.org/packages/3f/39/76caa3f43add7cd1073a28e791d62d18041a44f4f08874da6d0c8b08cf52/clockblocks-0.2-py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "f657cce8e49a7faed0202e138cb42fb4", "sha256": "43cd6fdc61805f3d7e62f0ff55a3958de4588cf57cbbed4f59249fd7f636ec69" }, "downloads": -1, "filename": "clockblocks-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f657cce8e49a7faed0202e138cb42fb4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 30602, "upload_time": "2019-06-26T15:49:42", "url": "https://files.pythonhosted.org/packages/4a/4f/051b6806e86eee5adcd4eda633601a04c21e12cdd8e72c0cd7b6fb5c1d85/clockblocks-0.2.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f657cce8e49a7faed0202e138cb42fb4", "sha256": "43cd6fdc61805f3d7e62f0ff55a3958de4588cf57cbbed4f59249fd7f636ec69" }, "downloads": -1, "filename": "clockblocks-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f657cce8e49a7faed0202e138cb42fb4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 30602, "upload_time": "2019-06-26T15:49:42", "url": "https://files.pythonhosted.org/packages/4a/4f/051b6806e86eee5adcd4eda633601a04c21e12cdd8e72c0cd7b6fb5c1d85/clockblocks-0.2.1-py3-none-any.whl" } ] }