{"id":19321113,"url":"https://github.com/lusito/sounts","last_synced_at":"2025-07-11T18:11:30.052Z","repository":{"id":57366443,"uuid":"387159983","full_name":"Lusito/sounts","owner":"Lusito","description":"A tiny helper library for working with the web audio API written in TypeScript.","archived":false,"fork":false,"pushed_at":"2024-06-02T10:50:26.000Z","size":3786,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T00:52:10.864Z","etag":null,"topics":["audio","game-development","html5","positional-audio","spatialization","typescript","web-audio","web-audio-api"],"latest_commit_sha":null,"homepage":"https://lusito.github.io/sounts/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lusito.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}},"created_at":"2021-07-18T11:32:25.000Z","updated_at":"2024-08-14T07:47:42.000Z","dependencies_parsed_at":"2023-02-08T06:16:02.265Z","dependency_job_id":null,"html_url":"https://github.com/Lusito/sounts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lusito%2Fsounts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lusito%2Fsounts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lusito%2Fsounts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lusito%2Fsounts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lusito","download_url":"https://codeload.github.com/Lusito/sounts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903647,"owners_count":17222543,"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":["audio","game-development","html5","positional-audio","spatialization","typescript","web-audio","web-audio-api"],"created_at":"2024-11-10T01:35:34.247Z","updated_at":"2024-11-10T01:35:34.911Z","avatar_url":"https://github.com/Lusito.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sounts\n\n[![Minified + gzipped size](https://badgen.net/bundlephobia/minzip/sounts)](https://www.npmjs.com/package/sounts)\n[![NPM version](https://badgen.net/npm/v/sounts)](https://www.npmjs.com/package/sounts)\n[![License](https://badgen.net/github/license/lusito/sounts)](https://github.com/lusito/sounts/blob/master/LICENSE)\n[![Stars](https://badgen.net/github/stars/lusito/sounts)](https://github.com/lusito/sounts)\n[![Watchers](https://badgen.net/github/watchers/lusito/sounts)](https://github.com/lusito/sounts)\n\nA tiny helper library for working with the web audio API written in TypeScript.\nIt has been written to simplify playing sounds in games.\nIt is not meant as a fully-fledged audio library.\n\n**Features:**\n\n- Playing sounds with and without position and orientation (positional-audio / spatialization)\n- A SoundSource (position + orientation) can play multiple sounds\n- You can play sounds on channels (if the specified channel already plays a sound, it will be stopped)\n- Sounds can of course be played freely (not on a channel)\n- It does not abstract away the web audio API. It only simplifies its usage. So you can still use the full power of the web audio API.\n\n**What it doesn't do:**\n\n- Preloading sounds (that's up to you or a different asset manager)\n- Manipulating sounds\n- Fallback if web audio API is not supported\n\nIf you are looking for a more complete solution, you might want to take a look at [howler](https://www.npmjs.com/package/howler).\n\n#### Fair Warning\n\nThe compile target of this library is es2015, so if you want to support older browsers, you'll have to ensure that this module is being transpiled to an older es version during your build-process.\n\n### Get started\n\n- [Read the documentation](https://lusito.github.io/sounts/)\n- Look at the example (`example/*.ts`).\n- Ask questions if the above doesn't clarify something good enough.\n\n## Goals of this Project\n\nI am a purist. If possible, I like to work with the tools the browser gives me. I don't need an npm package to trim text, filter arrays, etc..\n\n### Existing libraries\n\nWhile looking at existing libraries, I mostly found packages, that have not been updated in almost a decade, had no TypeScript support, weighed a ton or had a lot of dependencies.\n\nThe only library I deemed worthy of considering was [howler](https://www.npmjs.com/package/howler). It's actively maintained, has type definitions via `@types/howler` and `0` dependencies.\n\nBut two aspects remained (If those don't concern you, you should consider howler):\n\n- It's big: [9.5kB minified + gzipped](https://bundlephobia.com/package/howler).\n- And it abstracts a lot of the web audio part away.\n\n### Working with Raw Web Audio API\n\nAfter that, I took a look at web audio API tutorials, most of which have been written almost a decade ago. Here are the top 3:\n\n- [Getting Started with Web Audio API](https://www.html5rocks.com/en/tutorials/webaudio/intro/)\n- [Developing Game Audio with the Web Audio API](https://www.html5rocks.com/en/tutorials/webaudio/games/)\n- [Web audio spatialization basics](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Web_audio_spatialization_basics)\n\nThat's a lot to read and a lot to adjust for, as the API has changed a bit since then. Even JavaScript has changed quite a lot since then.\n\nThose tutorials are still worth a read, at least for the theory. You'll have to adjust the code a bit to work with the current standard.\n\n### Deciding to Write Something New\n\nSo, here I am again starting the same old thought: \"_There has to be a better way..._\" (... to get started with web audio).\n\nThe goal of this library is to have a simple starting point for writing positional audio code with the web audio API without having to dig into old tutorials and convert all the legacy code examples to the new standard.\n\nYou can start writing code with **sounts** and as you learn more about the web audio API you can extend your code, as **sounts** does not hide the web audio API from you.\n\n### Report issues\n\nSomething not working quite as expected? Do you need a feature that has not been implemented yet? Check the [issue tracker](https://github.com/Lusito/sounts/issues) and add a new one if your problem is not already listed. Please try to provide a detailed description of your problem, including the steps to reproduce it.\n\n### Contribute\n\nAwesome! If you would like to contribute with a new feature or submit a bugfix, fork this repo and send a pull request. Please, make sure all the unit tests are passing before submitting and add new ones in case you introduced new features.\n\n### License\n\n**sounts** is licensed under the [zlib/libpng](https://github.com/Lusito/sounts/blob/master/LICENSE), meaning you\ncan use it free of charge, without strings attached in commercial and non-commercial projects. Credits are appreciated but not mandatory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusito%2Fsounts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flusito%2Fsounts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusito%2Fsounts/lists"}