{"id":13767918,"url":"https://github.com/naomiaro/webaudio-peaks","last_synced_at":"2025-04-14T03:13:20.784Z","repository":{"id":42629468,"uuid":"49914292","full_name":"naomiaro/webaudio-peaks","owner":"naomiaro","description":"Small library to extract peaks from either a TypedArray of audio samples or a webaudio AudioBuffer into an Int8Array, Int16Array, or Int32Array.","archived":false,"fork":false,"pushed_at":"2023-01-07T09:40:55.000Z","size":386,"stargazers_count":57,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T03:13:13.289Z","etag":null,"topics":["peaks","waveform","webaudio"],"latest_commit_sha":null,"homepage":"","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/naomiaro.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":"2016-01-19T00:14:50.000Z","updated_at":"2024-11-14T18:48:02.000Z","dependencies_parsed_at":"2023-02-06T20:06:25.006Z","dependency_job_id":null,"html_url":"https://github.com/naomiaro/webaudio-peaks","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naomiaro%2Fwebaudio-peaks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naomiaro%2Fwebaudio-peaks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naomiaro%2Fwebaudio-peaks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naomiaro%2Fwebaudio-peaks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naomiaro","download_url":"https://codeload.github.com/naomiaro/webaudio-peaks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813802,"owners_count":21165634,"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":["peaks","waveform","webaudio"],"created_at":"2024-08-03T16:01:14.189Z","updated_at":"2025-04-14T03:13:20.744Z","avatar_url":"https://github.com/naomiaro.png","language":"JavaScript","funding_links":[],"categories":["Libraries: Web Audio API"],"sub_categories":["Web MIDI API"],"readme":"# webaudio-peaks\n\nSmall library to extract peaks from an array of audio samples or a webaudio AudioBuffer.\n\n[![npm](https://img.shields.io/npm/dm/webaudio-peaks.svg)](https://www.npmjs.com/package/webaudio-peaks)\n\n## Installation\n\n`npm install webaudio-peaks --save`\n\n## Basic Usage\n\n```javascript\nvar extractPeaks = require(\"webaudio-peaks\");\n\nvar audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n//decode an ArrayBuffer into an AudioBuffer\naudioCtx.decodeAudioData(audioData, function (decodedData) {\n  //calculate peaks from an AudioBuffer\n  var peaks = extractPeaks(decodedData, 10000, true);\n});\n```\n\n### extractPeaks(source, samplesPerPixel, isMono, cueIn, cueOut, bits)\nfunction to extract peaks from a TypedArray, or AudioBuffer\n\n**Params**\n\n- source `TypedArray|AudioBuffer` - A source of audio samples.\n- samplesPerPixel `number` - Number of samples used to calculate a single peak.\n- isMono `boolean` - Combine all channels into one array of peaks or not.\n- cueIn `number` - Sample to begin at. The offset is inclusive.\n- cueOut `number` - Sample to end at. The offset is exclusive.\n- bits `(8|16|32)` - Resolution of calculated peaks.\n\n**Returns**: `object`\n\n```javascript\n{\n  length: `number`; //Number of calculated peaks,\n  //Computed peak data, length ==  #channels or 1 if isMono == true\n  //Each entry of type `Int{bits}Array`\n  data: `Array`;\n  bits: `(8|16|32)`; //Resolution of calculated peaks.\n}\n```\n\n## License\n\n[MIT License](http://doge.mit-license.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaomiaro%2Fwebaudio-peaks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaomiaro%2Fwebaudio-peaks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaomiaro%2Fwebaudio-peaks/lists"}