{"id":17930522,"url":"https://github.com/remy/next-ayfx","last_synced_at":"2025-03-24T04:31:20.022Z","repository":{"id":55546128,"uuid":"282995641","full_name":"remy/next-ayfx","owner":"remy","description":"AYFX Driver for NextBASIC","archived":false,"fork":false,"pushed_at":"2021-02-08T15:46:15.000Z","size":24,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-19T01:59:51.199Z","etag":null,"topics":["nextbasic","spectrum-next"],"latest_commit_sha":null,"homepage":"https://zx.remysharp.com/audio/","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"remy"}},"created_at":"2020-07-27T19:27:55.000Z","updated_at":"2025-02-26T06:07:08.000Z","dependencies_parsed_at":"2022-08-15T03:00:17.884Z","dependency_job_id":null,"html_url":"https://github.com/remy/next-ayfx","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Fnext-ayfx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Fnext-ayfx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Fnext-ayfx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy%2Fnext-ayfx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remy","download_url":"https://codeload.github.com/remy/next-ayfx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245211081,"owners_count":20578341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["nextbasic","spectrum-next"],"created_at":"2024-10-28T21:13:57.674Z","updated_at":"2025-03-24T04:31:19.601Z","avatar_url":"https://github.com/remy.png","language":"Assembly","funding_links":["https://github.com/sponsors/remy"],"categories":[],"sub_categories":[],"readme":"# AYFX for NextBASIC\n\nThis project is a port of Shiru's AYFX format for NextBASIC*.\n\nWhat this offers: the ability to play back sound effects on the AY-8-3912 chips without interrupting NextBASIC during runtime.\n\n_\\* If writing assembly, [Shiru's AYFX Editor](https://shiru.untergrund.net/software.shtml#old) includes source code to play the FX bank and it's likely you don't need this library._\n\n## How it works\n\n- A driver is loaded and is configured to point to a `BANK` that holds [your special effects](#creating-sound-effects).\n- The driver waits for an interrupt and then processes a single frame of audio on the AY-8-3912 chip.\n- The player can play effects using all three AY channels. When there is an empty (not playing) channel, it will be used, otherwise the one that was active for longest time will be used. AY music can't play while this version of the player is active.\n- The driver will also put the selected AY chip into mono mode which boosts the volume of the sound (rather than splitting across stereo left, centre and right), this is done in the interrupt routine by repeatedly setting [NEXTREG $09](https://wiki.specnext.dev/Peripheral_4_Register)\n\n## Usage\n\nYou will need the `ayfx.drv` file accessible to your project. Then `.install` the driver and call it's initialisation routine, then the playback routine:\n\n```basic\n10 .install \"ayfx.drv\"\n20 LOAD \"my-sfx.afb\" BANK 20 : REM bank 20 is picked arbitrarily\n30 DRIVER 49, 1, 20 : REM point the driver to your bank 20\n40 REPEAT\n50   k$ = INKEY$\n60   DRIVER 49, 2, VAL k$ : REM play the fx at the numerical value k$\n70 REPEAT UNTIL 0 : REM loop forever\n```\n\nYou can also view the [examples](https://github.com/remy/next-ayfx/tree/main/example) directory for other NextBASIC examples.\n\n## Using with NextDAW\n\nImportant: if you're using this driver with the NextDAW driver, make sure to **install the NextDAW driver first** otherwise you'll hear some very bad audio corruption.\n\n## Driver API\n\nThere are currently only two routines available in the driver:\n\n- `1, arg: $bank_id, [$ay_chip=3]` - initialise the audio to point a 16K bank and _optionally_ select an AY chip\n- `2, arg: $effects_id` - start playing the given effect id\n\n**The driver id is 49 (hex 0x31)**\n\n## AY chip select\n\nBy default the driver uses AY chip 3. To change the AY chip used, the second argument to routine `1` is the chip number from 1 to 3 (note that 0 will default to chip 3).\n\nThis is to add compatibility with other drivers using the AY chips, allowing you, for example, to use AY chip 1 and 2 for NextDAW and AY chip 3 for special effects.\n\nTo use AY chip 1, the NextBASIC code is as follows:\n\n```basic\n30 DRIVER 49, 1, 25, 1 : REM use BANK 25 and use AY chip 1\n```\n\n## Creating Sound Effects\n\nIf you use Windows, you can install and use [Shiru's AYFX Editor](https://shiru.untergrund.net/software.shtml#old) (though it works, it doesn't quite render correctly on newer machines).\n\nAlternatively I have created an online tool that replicates the AYFX UI (which also works offline) where you can create, edit, preview and save your own effects: https://zx.remysharp.com/audio/\n\nOnce you've designed your sound effects, **save the bank** of effects taking note of the position of the effects. This is the file you will need to load into a NextBASIC `BANK` (seen in the example on line 20).\n\n## Known issues\n\nThe AYFX driver will playback on the 3 AY channels that were available to the 128K spectrum regardless of what's using it already. That means that if you're playing some music at the same time on the AY channels (such as using NextDAW) the sound can sometimes become _crunchy_. This is the noise mix being left on when the AYFX jumps in to play it's effect.\n\nYour mileage will vary. I've personally found that this doesn't create too much of an audible nuisance as one effect might trigger the noise mix, but many others will set it back (it also creates some subtle variation in the music in my games).\n\n## Possible upgrades\n\nThough there's no priority to do so, possible upgrades include:\n\n- De-registration of the driver (this means removing the saved user bank ID)\n\n## License\n\n- [MIT](https://rem.mit-license.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy%2Fnext-ayfx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremy%2Fnext-ayfx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy%2Fnext-ayfx/lists"}