{"id":34109563,"url":"https://github.com/ruguevara/pyayay","last_synced_at":"2026-03-17T16:12:51.799Z","repository":{"id":236288499,"uuid":"792307819","full_name":"ruguevara/pyayay","owner":"ruguevara","description":"PyAYay is a Python wrapper for the AY/YM sound chip emulator. Currently it supports only the Ayumi emulator by Peter Sovietov.","archived":false,"fork":false,"pushed_at":"2024-05-06T08:51:08.000Z","size":36,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T02:07:27.995Z","etag":null,"topics":["audio-library","emulation-library","pybind11","python3","retrocomputing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruguevara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-26T12:00:20.000Z","updated_at":"2024-04-27T21:02:22.000Z","dependencies_parsed_at":"2024-05-06T09:52:14.845Z","dependency_job_id":null,"html_url":"https://github.com/ruguevara/pyayay","commit_stats":null,"previous_names":["ruguevara/pyayay"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ruguevara/pyayay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruguevara%2Fpyayay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruguevara%2Fpyayay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruguevara%2Fpyayay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruguevara%2Fpyayay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruguevara","download_url":"https://codeload.github.com/ruguevara/pyayay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruguevara%2Fpyayay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30626932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T14:16:03.965Z","status":"ssl_error","status_checked_at":"2026-03-17T14:16:03.380Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-library","emulation-library","pybind11","python3","retrocomputing"],"created_at":"2025-12-14T18:34:26.742Z","updated_at":"2026-03-17T16:12:51.786Z","avatar_url":"https://github.com/ruguevara.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n| |\n|-|\n| ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ruguevara/pyayay/python-package.yml?style=flat\u0026logo=github\u0026label=tests) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ruguevara/pyayay/cibuildwheel.yml?style=flat\u0026logo=github) ![PyPI - License](https://img.shields.io/pypi/l/pyayay)|\n| ![PyPI](https://img.shields.io/pypi/v/pyayay?logo=python\u0026logoColor=white) ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fruguevara%2Fpyayay%2Fmain%2Fpyproject.toml\u0026logo=python\u0026logoColor=white) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/pyayay?logo=python\u0026logoColor=white) |\n\n\n# PyAYay\n\nPyAYay is a Python wrapper for the AY/YM sound chip emulator. Currently it supports only the [Ayumi](https://github.com/true-grue/ayumi) emulator by Peter Sovietov.\n\n## Installation\n\n### From PyPI\n\nYou can install the package from PyPI:\n\n```bash\npip install pyayay\n```\n\nYep, that's it!\n\n### From source\n\n```bash\ngit clone https://github.com/ruguevara/pyayay.git\ncd pyayay\npip install .\n```\n\nOr install in development mode:\n\n```bash\ngit clone https://github.com/ruguevara/pyayay.git\ncd pyayay\npip install -e .\n```\n\n## Usage\n\n```python\nfrom pyayay import Ayumi, ChipType, EnvShape\n\nay = Ayumi(sample_rate=44100, clock=1773400, type=ChipType.AY)\n# or just Ayumi() for default values\n```\n\nSet panning for channels, for example in ACB order, and the master volume:\n```python\nay.set_pan(0, 0.25)  # A left\nay.set_pan(1, 0.75)  # B right\nay.set_pan(2, 0.5)   # C center\n\nay.set_master_volume(0.75)\n```\n\nUse setters to set the channel parameters.\nDo not forget to call `set_mixer` to enable the channel.\n\n```python\nay.set_mixer(0, True, False, False)  # Tone, Noise and Envelope for A channel\nay.set_tone_period(0, 100)\nay.set_volume(0, 15)\n```\n\nYou can set the envelope shape and period, for example:\n\n```python\nay.set_mixer(0, True, False, True)  # Turn on envelope modulation for A channel\nay.set_envelope_shape(EnvShape.UP_DOWN_E)\nay.set_envelope_period(1024)\n```\n\nTo generate sound use `process_block` method:\n\n```python\nsamples = 44100 * 2  # 2 seconds\noutLeft  = np.zeros(samples, dtype=np.float32)\noutRight = np.zeros(samples, dtype=np.float32)\n\nay.process_block(outLeft, outRight, samples)\n```\n\n## Examples of using the R0-R13 registers and PSG rendering\n\nYou can use AY/YM registers R0-R13 directly:\n\n```python\nay.R[1] = 100\nay.R[0] = 0\nay.R[7] = 0b00111110\nay.R[8] = 15\n```\n\nor, to set number of register at once:\n\n```python\nay.set_registers(\n    [1, 0, 7, 8],\n    [100, 0, 0b00111110, 15]\n)\n```\n\nor, to set some of the registers with the 'mask' array.\nNOTE that mask is inverted, so 1 means \"do not change\".\nThis is useful for PSG frame playing.\n\n```python\n# R           0  1    2  3  4  5  6  7   8   9  10 11 12 13\nR = np.array([0, 100, 0, 0, 0, 0, 0, 62, 15, 0, 0, 0, 0, 0], dtype=np.uint8)\nM = np.array([0, 0,   1, 1, 1, 1, 1, 0,  0,  1, 1, 1, 1, 1], dtype=bool)\n\nay.set_registers_masked(R, M)\n```\n\nAnd render PSG data from Numpy arrays in one call:\n```python\ndata = np.array([\n    [249,   0, 148,   0,  40,   1,   3,  40,  13,  29,  13,  74,   0, 12],\n    [249,   0, 158,   4,  40,   1,   3,  56,  13,  15,  13,  74,   0, 12]], dtype=np.uint8)\nmask = np.array([\n    [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],\n    [1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1]], dtype=bool)\nfps = 50\nay.render_psg(data, mask, outLeft, outRight, fps)\n```\n\nFor more usage examples see [tests](tests/test_ayumi.py).\n\n## License\nWe use MIT license, see [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruguevara%2Fpyayay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruguevara%2Fpyayay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruguevara%2Fpyayay/lists"}