{"id":22882682,"url":"https://github.com/nimitzdev/javascript-audio-pipeline","last_synced_at":"2025-05-07T05:01:12.475Z","repository":{"id":57186641,"uuid":"120627995","full_name":"NimitzDEV/javascript-audio-pipeline","owner":"NimitzDEV","description":"A simple class that wraps basic Web Audio APIs","archived":false,"fork":false,"pushed_at":"2018-02-11T08:19:13.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-01T09:29:59.957Z","etag":null,"topics":["audiocontext","html5-audio-api","javascript","webaudio-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/NimitzDEV.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":"2018-02-07T14:48:23.000Z","updated_at":"2018-06-15T10:49:59.000Z","dependencies_parsed_at":"2022-09-14T16:51:01.326Z","dependency_job_id":null,"html_url":"https://github.com/NimitzDEV/javascript-audio-pipeline","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/NimitzDEV%2Fjavascript-audio-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimitzDEV%2Fjavascript-audio-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimitzDEV%2Fjavascript-audio-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NimitzDEV%2Fjavascript-audio-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NimitzDEV","download_url":"https://codeload.github.com/NimitzDEV/javascript-audio-pipeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816937,"owners_count":21808704,"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":["audiocontext","html5-audio-api","javascript","webaudio-api"],"created_at":"2024-12-13T18:19:02.303Z","updated_at":"2025-05-07T05:01:10.881Z","avatar_url":"https://github.com/NimitzDEV.png","language":"JavaScript","readme":"# AudioPipeline\n\nAudioPipeline is a simple class that wraps basic Web Audio APIs, making connect and modify AudioNodes more easily.\n\n## Install\n[![NPM](https://nodei.co/npm/audio-pipeline.png)](https://npmjs.org/package/audio-pipeline)\n\ninstall using npm or yarn\n\n`npm i audio-pipeline`\n\n`yarn add audio-pipeline`\n\n## Basic Usage\n\n```javascript\n// init AudioPipeline\nimport AudioPipeline from 'audio-pipeline';\nconst AP = new AudioPipeline();\n\n// pass ArrayBuffer to loadArrayBuffer to init AudioContext\nawait AP.loadArrayBuffer(buffer);\n\n// then, we can build up our pipeline by using addNode\n// first, we should get the source as the starting point.\nAP.addNode(AP.getSourceNode());\n// then we add effects that we want\nAP.addNode(AP.getBiquadFilterNode('lowpass'));\n// .... some more awesome effects\n// and finally, we put it into the destination\nAP.addNode(AP.getDestinationNode());\n// after that, we connect those nodes\nAP.fullConnect();\n// and we play it\nAP.control('start', 0);\n```\n\n## Add effects while playing\n\nBy passing true to the `addNode()` method, you can add new audio effects to the current pipeline.\n\n```javascript\nAP.addNode(AP.getBiquadFilterNode('highpass'), 2, true);\n```\n\n## Modify effects while playing\n\nUsing `getNode()` method, you can get AudioNode instant in specific position, previously, we constructed a pipeline in following order :\n\n`Audio Source` =\u003e `lowpass` =\u003e `highpass`=\u003e`Audio Destination`\n\nnow we want to change the cut-off frequency of the `lowpass` filter, which is on position 1.\n\n```javascript\nAP.getNode(1).frequency.value = 200;\n```\n\n## APIs\n\nloadArrayBuffer(buffer: ArrayBuffer): Promise\n\n\u003e this function initialize the AudioContext with ArrayBuffer\n\ncontrol(action: String, params: Any)\n\n\u003e call methods on source object\n\nfullConnect()\n\n\u003e connect all nodes added using addNode method\n\nfullDisconnect()\n\n\u003e disconnect all nodes\n\naddNode(node: AudioNode [, position: Number, reconnect: Boolean]): AudioNode\n\n\u003e add a AudioNode into pipeline, if position not set, the AudioNode will add to the last.\n\u003e\n\u003e if reconnect is set to true, will reconnect the AudioNodes between the new one, this is useful when you want to add AudioNode dynamically while playing audio.\n\ndeleteNode(position: Number [, reconnect: Boolean]): AudioNode\n\n\u003e delete specify AudioNode in the pipeline, if reconnect is set to true, will reconnect AudioNodes between the deleted one, this is useful when you want to delete AudioNode dynamically while playing audio.\n\nswitchNodes(from: Number, to: Number, [, reconnect: Boolean]): Boolean\n\n\u003e Switch two AudioNodes in the pipeline, if reconnect is set to true, will reconnect AudioNodes between the switched AudioNodes, this is useful when you want to switch AudioNodes order dynamically while playing audio.\n\ngetNode(position: Number): AudioNode\n\n\u003e get specific AudioNode reference in pipeline\n\nclearNodes()\n\n\u003e empty pipeline, this method will not disconnect AudioNodes, make sure to call fullDisconnect() before clearNodes()\n\ngetBiquadFilterNode(type: String): BiquadFilterNode\n\n\u003e Create a new BiquadFilterNode with given type\n\ngetOscillatorNode(type: String): OscillatorNode\n\n\u003e Create a new OscillatorNode with given type\n\ngetGainNode(gain: Number): GainNode\n\n\u003e Create a new GainNode with given gain value\n\ngetDelayNode(delay: Number): DelayNode\n\n\u003e Create a new DelayNode with given delay time\n\ngetPannerNode(): PannerNode\n\n\u003e Create a new PannerNode\n\ngetPeriodicWave(real: Float32Array, imag: Float32Array, constraints; Object): OscillatorNode\n\n\u003e Create a new OscillatorNode with given PeriodicWave settings\n\ngetDestinationNode()\n\n\u003e Get the audio destination\n\ngetSourceNode()\n\n\u003e Get the audio source\n\ngetContext()\n\n\u003e Get the AudioContext\n\n## How to build\n\ninstall dependencies first\n\n`yarn install`\n\nrun build\n\n`yarn build`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimitzdev%2Fjavascript-audio-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimitzdev%2Fjavascript-audio-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimitzdev%2Fjavascript-audio-pipeline/lists"}