{"id":16609670,"url":"https://github.com/ircam-ismm/node-web-audio-api","last_synced_at":"2026-04-07T03:02:39.410Z","repository":{"id":40720976,"uuid":"441689999","full_name":"ircam-ismm/node-web-audio-api","owner":"ircam-ismm","description":"Web Audio API implementation for Node.js","archived":false,"fork":false,"pushed_at":"2026-03-31T13:10:25.000Z","size":10387,"stargazers_count":245,"open_issues_count":29,"forks_count":25,"subscribers_count":8,"default_branch":"main","last_synced_at":"2026-03-31T15:12:18.978Z","etag":null,"topics":["nodejs","rust","webaudio"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/node-web-audio-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ircam-ismm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-25T13:57:27.000Z","updated_at":"2026-03-30T08:38:54.000Z","dependencies_parsed_at":"2023-02-14T08:30:50.382Z","dependency_job_id":"a5fc51bc-ffe7-4cc8-87f6-1c5685549f96","html_url":"https://github.com/ircam-ismm/node-web-audio-api","commit_stats":{"total_commits":167,"total_committers":3,"mean_commits":"55.666666666666664","dds":"0.053892215568862256","last_synced_commit":"2c89cd877a91b502222fb310bfd4784f77ef3e63"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":"napi-rs/package-template","purl":"pkg:github/ircam-ismm/node-web-audio-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ircam-ismm%2Fnode-web-audio-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ircam-ismm%2Fnode-web-audio-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ircam-ismm%2Fnode-web-audio-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ircam-ismm%2Fnode-web-audio-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ircam-ismm","download_url":"https://codeload.github.com/ircam-ismm/node-web-audio-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ircam-ismm%2Fnode-web-audio-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31498070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"online","status_checked_at":"2026-04-07T02:00:07.164Z","response_time":105,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["nodejs","rust","webaudio"],"created_at":"2024-10-12T01:29:11.679Z","updated_at":"2026-04-07T03:02:39.390Z","avatar_url":"https://github.com/ircam-ismm.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Node Web Audio API\n\n[![npm version](https://badge.fury.io/js/node-web-audio-api.svg)](https://badge.fury.io/js/node-web-audio-api)\n\nNode.js bindings for the Rust implementation of the [Web Audio API specification](https://www.w3.org/TR/webaudio/).\n\nThe library aims to provide an implementation that is both efficient and compliant with the specification.\n\n- see [`orottier/web-audio-api-rs`](https://github.com/orottier/web-audio-api-rs/) for the \"real\" audio guts\n- use [`napi-rs`](https://github.com/napi-rs/napi-rs/) for the Node.js bindings\n\nFor library authors who want to write components that run both in Node.js and the browser, we also provide [isomorphic-web-audio-api](https://github.com/ircam-ismm/isomorphic-web-audio-api).\n\n## Install\n\n```\nnpm install [--save] node-web-audio-api\n```\n\n## Example Use\n\n```js\nimport { AudioContext, OscillatorNode, GainNode } from 'node-web-audio-api';\n// or using old fashioned commonjs syntax:\n// const { AudioContext, OscillatorNode, GainNode } = require('node-web-audio-api');\nconst audioContext = new AudioContext();\n\nsetInterval(() =\u003e {\n  const now = audioContext.currentTime;\n  const frequency = 200 + Math.random() * 2800;\n\n  const env = new GainNode(audioContext, { gain: 0 });\n  env.connect(audioContext.destination);\n  env.gain\n    .setValueAtTime(0, now)\n    .linearRampToValueAtTime(0.2, now + 0.02)\n    .exponentialRampToValueAtTime(0.0001, now + 1);\n\n  const osc = new OscillatorNode(audioContext, { frequency });\n  osc.connect(env);\n  osc.start(now);\n  osc.stop(now + 1);\n}, 80);\n```\n\n### Running the Examples\n\nTo run all examples locally on your machine you will need to:\n\n1. Install Rust toolchain\n```sh\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n2. Clone the repo and build the binary on your machine\n```sh\ngit clone https://github.com/ircam-ismm/node-web-audio-api.git\ncd node-web-audio-api\nnpm install\nnpm run build\n```\n\n3. Run the examples from the project's root directory\n```sh\nnode examples/granular-scrub.js\n```\n\n## Caveats\n\n- `AudioBuffer#getChannelData` is implemented but not reliable in some situations. Your should prefer `AudioBuffer#copyToChannel` and `AudioBuffer#copyFromChannel` when you want to access or manipulate the underlying samples in a safe way.\n- `Streams`: only a minimal audio input stream and the `MediaStreamSourceNode` are provided. All other `MediaStream` features are left on the side for now as they principally concern a different API specification, which is not a trivial problem.\n- `new AudioContext({sinkId:{type:'none'}})`: if your system has no audio sinks (e.g. docker image) use `{sinkId:{type:'none'}}` when initializing `AudioContext`, else it will crash with `DeviceNotAvailable` [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext#sinkid)\n\n## Supported Platforms - Prebuilt Binaries\n\nWe provide prebuilt binaries for the following platforms:\n\n|                                                     | binaries |\n|-----------------------------------------------------|:--------:|\n| Windows x64                                         | ✓        |\n| Windows arm64                                       | ✓        |\n| macOS x64                                           | ✓        |\n| macOS aarch64                                       | ✓        |\n| Linux x64 gnu (jack / pipewire-jack)                | ✓        |\n| Linux arm gnueabihf (jack / pipewire-jack)          | ✓        |\n| Linux arm64 gnu     (jack / pipewire-jack)          | ✓        |\n\n\n\n### Important notes\n\n- If you need support for another platform, please fill an [issue](https://github.com/ircam-ismm/node-web-audio-api/issues) and we will see what we can do.\n\n- All provided Linux binaries are built with the `jack` flag, which should work either with properly configured [Jack](https://jackaudio.org/) or [pipewire-jack](https://pipewire.org/) backends. If this is a limitation for you, please fill an [issue](https://github.com/ircam-ismm/node-web-audio-api/issues) and we will see what we can do.\n\n\n## Manual Build\n\nIf prebuilt binaries are not shippped for your platform, you will need to:\n\n1. Install the Rust toolchain\n\n```sh\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n2. Install and build from github\n\n```sh\ngit clone https://github.com/ircam-ismm/node-web-audio-api.git node_modules/node-web-audio-api\ncd node_modules/node-web-audio-api\nnpm install\nnpm run build\n```\n\nThe package will be built on your machine, which might take some time.\n\nBe aware that the package won't be listed on your `package.json` file, and that it won't be re-installed if running `npm install` again. A possible workaround would be to include the above in a postinstall script.\n\n## Notes for Linux users\n\n### Build\n\nTo build the library, you will need to manually install the `libasound2-dev` package:\n\n```sh\nsudo apt install libasound2-dev\n```\n\nOptionally, if you use the Jack Audio Backend, the `libjack-jackd2-dev` package:\n\n```sh\nsudo apt install libjack-jackd2-dev\n```\n\nIn such case, you can use the `npm run build:jack` script to enable the Jack feature.\n\n### Audio backend and latency\n\nUsing the library on Linux with the ALSA backend might lead to unexpected cranky sound with the default render size (i.e. 128 frames). In such cases, a simple workaround is to pass the `playback` latency hint when creating the audio context, which will increase the render size to 1024 frames:\n\n```js\nconst audioContext = new AudioContext({ latencyHint: 'playback' });\n```\n\nFor real-time and interactive applications where low latency is crucial, you should instead rely on the JACK backend provided by `cpal`. By default the audio context will use that backend if a running JACK server is found.\n\nIf you don't have JACK installed, you can still pass the `WEB_AUDIO_LATENCY=playback` environment variable to all examples to create the audio context with the playback latency hint, e.g.:\n\n```sh\nWEB_AUDIO_LATENCY=playback node examples/amplitude-modulation.mjs\n```\n\n## Development notes\n\n### Synchronize versioning\n\nThe npm `postversion` script rely on [`cargo-bump`](https://crates.io/crates/cargo-bump) to maintain versions synced between the `package.json` and the `Cargo.toml` files. Therefore, you will need to install `cargo-bump` on your machine\n\n```\ncargo install cargo-bump\n```\n\n### Running the web-platform-test suite\n\nFollow the steps for 'Manual Build' first. Then checkout the web-platform-tests submodule with:\n\n```\ngit submodule init\ngit submodule update\n```\n\nThen run:\n\n```\nnpm run wpt                      # build in debug mode and run all wpt test\nnpm run wpt:only                 # run all wpt test without build\nnpm run wpt -- --list            # list all wpt test files\nnpm run wpt -- --filter \u003cstring\u003e # apply \u003cstring\u003e filter on executed/listed wpt tests\n```\n\n## License\n\n[BSD-3-Clause](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fircam-ismm%2Fnode-web-audio-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fircam-ismm%2Fnode-web-audio-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fircam-ismm%2Fnode-web-audio-api/lists"}