{"id":13768530,"url":"https://github.com/mohayonao/adsr-envelope","last_synced_at":"2026-03-17T18:37:47.618Z","repository":{"id":57173699,"uuid":"41796460","full_name":"mohayonao/adsr-envelope","owner":"mohayonao","description":"ADSREnvelope for Web Audio API","archived":false,"fork":false,"pushed_at":"2015-11-06T02:29:28.000Z","size":418,"stargazers_count":42,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-23T19:00:04.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mohayonao.github.io/adsr-envelope/","language":"JavaScript","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/mohayonao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-02T11:03:21.000Z","updated_at":"2025-11-02T21:17:59.000Z","dependencies_parsed_at":"2022-08-24T13:31:10.908Z","dependency_job_id":null,"html_url":"https://github.com/mohayonao/adsr-envelope","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mohayonao/adsr-envelope","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohayonao%2Fadsr-envelope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohayonao%2Fadsr-envelope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohayonao%2Fadsr-envelope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohayonao%2Fadsr-envelope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohayonao","download_url":"https://codeload.github.com/mohayonao/adsr-envelope/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohayonao%2Fadsr-envelope/sbom","scorecard":{"id":656739,"data":{"date":"2025-08-11","repo":{"name":"github.com/mohayonao/adsr-envelope","commit":"a757050f5089ec09f9219b3167f177fc21477706"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T14:53:59.917Z","repository_id":57173699,"created_at":"2025-08-21T14:53:59.918Z","updated_at":"2025-08-21T14:53:59.918Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","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":[],"created_at":"2024-08-03T16:01:22.546Z","updated_at":"2026-03-17T18:37:47.604Z","avatar_url":"https://github.com/mohayonao.png","language":"JavaScript","funding_links":[],"categories":["Sound editing"],"sub_categories":["ADSR envelopes"],"readme":"# ADSR ENVELOPE\n[![Build Status](http://img.shields.io/travis/mohayonao/adsr-envelope.svg?style=flat-square)](https://travis-ci.org/mohayonao/adsr-envelope)\n[![NPM Version](http://img.shields.io/npm/v/adsr-envelope.svg?style=flat-square)](https://www.npmjs.org/package/adsr-envelope)\n[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://mohayonao.mit-license.org/)\n\n\u003e ADSR Envelope\n\n## Installation\n\nNode.js\n\n```sh\nnpm install adsr-envelope\n```\n\n## Online Demo\n- http://mohayonao.github.io/adsr-envelope/\n\n## ADSR\n\n![ADSREnvelope](https://github.com/mohayonao/adsr-envelope/wiki/images/ADSREnvelope.png)\n\n## API\n### ADSREnvelope\n- `constructor(opts: object = {})`\n  - `attackTime: number` _default: **0.01** (10msec)_\n  - `decayTime: number` _default: **0.3** (300msec)_\n  - `sustainLevel: number` _default: **0.5**_\n  - `releaseTime: number` _default: **1** (1sec)_\n  - `gateTime: number` _default: **Infinity**_\n  - `sustainTime: number`\n  - `duration: number`\n  - `peakLevel: number` _default: **1**_\n  - `epsilon: number` _default: **0.001**_\n  - `attackCurve: string` _default: **lin**_\n    - **lin** or **exp** (linear or exponential)\n  - `decayCurve: string` _default: **lin**_\n    - **lin** or **exp** (linear or exponential)\n  - `releaseCurve: string` _default: **lin**_\n    - **lin** or **exp** (linear or exponential)\n\n#### Instance Attributes\n- `duration: number`\n- `attackTime: number`\n- `decayTime: number`\n- `sustainTime: number`\n- `sustainLevel: number`\n- `releaseTime: number`\n- `gateTime: number`\n- `peakLevel: number`\n- `epsilon: number`\n- `attackCurve: string`\n- `decayCurve: string`\n- `releaseCurve: string`\n\n#### Instance Methods\n- `valueAt(time: number = 0): number`\n- `applyTo(audioParam: AudioParam, playbackTime: number = 0): self`\n- `getWebAudioAPIMethods(playbackTime: number = 0): Array[]`\n- `clone(): ADSREnvelope`\n\n## Example\n### sequencer style\n\n```js\nimport ADSREnvelope from \"adsr-envelope\";\n\nlet audioContext = new AudioContext();\nlet oscillator = audioContext.createOscillator();\nlet gain = audioContext.createGain();\nlet adsr = new ADSREnvelope({\n  attackTime: 0.5,\n  decayTime: 0.25,\n  sustainLevel: 0.8,\n  releaseTime: 2.5,\n  gateTime: 6,\n  releaseCurve: \"exp\",\n});\n\nadsr.applyTo(gain.gain, audioContext.currentTime);\n\nconsole.log(adsr.getWebAudioAPIMethods());\n// [\n//   [ \"setValueAtTime\", 0, 0 ],\n//   [ \"linearRampToValueAtTime\", 1, 0.5 ],\n//   [ \"linearRampToValueAtTime\", 0.8, 0.75],\n//   [ \"setValueAtTime\", 0.8, 6 ],\n//   [ \"exponentialRampToValueAtTime\", 0.001, 8.5 ],\n// ]\n\noscillator.start(audioContext.currentTime);\noscillator.stop(audioContext.currentTime + adsr.duration);\n\noscillator.connect(gain);\ngain.connect(audioContext.destination);\n```\n\n### noteOn / noteOff style\n\n```js\nimport ADSREnvelope from \"adsr-envelope\";\n\nlet audioContext = new AudioContext();\nlet adsr = new ADSREnvelope({\n  attackTime: 0.5,\n  decayTime: 0.25,\n  sustainLevel: 0.8,\n  releaseTime: 2.5,\n  gateTime: 6,\n  releaseCurve: \"exp\",\n});\nlet noteMap = {};\n\nclass Note {\n  constructor(audioContext, noteNumber, envelope) {\n    this.audioContext = audioContext;\n    this.noteNumber = noteNumber;\n    this.envelope = envelope;\n    this.startTime = 0;\n    this.oscillator = audioContext.createOscillator();\n    this.gain = audioContext.createGain();\n\n    this.oscillator.frequency.value = midicps(noteNumber);\n    this.oscillator.onended = () =\u003e {\n      this.oscillator.disconnect();\n      this.gain.disconnect();\n    };\n\n    this.oscillator.connect(this.gain);\n    this.gain.connect(audioContext.destination);\n  }\n\n  noteOn(playbackTime = this.audioContext.currentTime) {\n    this.startTime = playbackTime;\n    this.envelope.gateTime = Infinity;\n    this.envelope.applyTo(this.gain.gain, playbackTime);\n    this.oscillator.start(playbackTime);\n  }\n\n  noteOff(playbackTime = this.audioContext.currentTime) {\n    this.gain.gain.cancelScheduledValues(this.startTime);\n\n    this.envelope.gateTime = playbackTime - this.startTime;\n    this.envelope.applyTo(this.gain.gain, this.startTime);\n\n    this.oscillator.stop(this.startTime + this.envelope.duration);\n  }\n}\n\nmidiKeyboard.on(\"noteOn\", ({ noteNumber }) =\u003e {\n  if (noteMap[noteNumber]) {\n    noteMap[noteNumber].noteOff();\n  }\n\n  noteMap[noteNumber] = new Note(audioContext, noteNumber, adsr.clone());\n  noteMap[noteNumber].noteOn();\n});\nmidiKeyboard.on(\"noteOff\", ({ noteNumber }) =\u003e {\n  if (noteMap[noteNumber]) {\n    noteMap[noteNumber].noteOff();\n  }\n  noteMap[noteNumber] = null;\n});\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohayonao%2Fadsr-envelope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohayonao%2Fadsr-envelope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohayonao%2Fadsr-envelope/lists"}