{"_id":"@soundtouchjs/worklet-base","_rev":"5-0f630907b824adab3bce2f1483dfe718","name":"@soundtouchjs/worklet-base","dist-tags":{"latest":"2.1.1"},"versions":{"0.1.0":{"name":"@soundtouchjs/worklet-base","version":"0.1.0","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"author":{"name":"Steve 'Cutter' Blades"},"license":"MPL-2.0","_id":"@soundtouchjs/worklet-base@0.1.0","maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"contributors":[{"url":"https://cutterscrossing.com/","name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com"}],"homepage":"https://github.com/cutterbl/SoundTouchJS","bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"dist":{"shasum":"f07459e2fcb52059637deedf85c28e956673f764","tarball":"https://registry.npmjs.org/@soundtouchjs/worklet-base/-/worklet-base-0.1.0.tgz","fileCount":16,"integrity":"sha512-ZYIPj9enMyOw4t7dxqUDCI4hwNmiOGgMRPPJElysUqjtBCGfA9v6cmdwcKtJz+fiJ+xaJ4k2vw+f8RDbYABLDQ==","signatures":[{"sig":"MEYCIQC1hMiBe6kW7iCindKpvBOxchVDcYlYTCJqs8zaLJhPCQIhAM6kDG9dyz4U+Vqz4pfqjkBHl8jh4j5Vwdk9yrpqLQbI","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@soundtouchjs%2fworklet-base@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59647},"main":"./.dist/index.js","type":"module","_from":"file:soundtouchjs-worklet-base-0.1.0.tgz","types":"./.dist/index.d.ts","exports":{".":{"types":"./.dist/index.d.ts","default":"./.dist/index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"cutterbl","email":"no.junk@cutterscrossing.com"},"_resolved":"/tmp/4ab9acc5d6788b46273b45cc7a25d8b6/soundtouchjs-worklet-base-0.1.0.tgz","_integrity":"sha512-ZYIPj9enMyOw4t7dxqUDCI4hwNmiOGgMRPPJElysUqjtBCGfA9v6cmdwcKtJz+fiJ+xaJ4k2vw+f8RDbYABLDQ==","repository":{"url":"git+https://github.com/cutterbl/SoundTouchJS.git","type":"git","directory":"packages/worklet-base"},"_npmVersion":"10.8.2","description":"Abstract base processor for SoundTouchJS AudioWorklet packages","directories":{},"licenseFile":"LICENSE","sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@soundtouchjs/core":"2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/worklet-base_0.1.0_1778872511106_0.4291696915526748","host":"s3://npm-registry-packages-npm-production"}},"2.0.3":{"name":"@soundtouchjs/worklet-base","version":"2.0.3","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"author":{"name":"Steve 'Cutter' Blades"},"license":"MPL-2.0","_id":"@soundtouchjs/worklet-base@2.0.3","maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"contributors":[{"url":"https://cutterscrossing.com/","name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com"}],"homepage":"https://github.com/cutterbl/SoundTouchJS","bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"dist":{"shasum":"79aed3626cfe115f720deb3e8ba88bc16bc2280f","tarball":"https://registry.npmjs.org/@soundtouchjs/worklet-base/-/worklet-base-2.0.3.tgz","fileCount":16,"integrity":"sha512-nnS7l1XuvmesbZP1GNkT5uZL1q6PcP2gPsqC/yH+7oit6s5mdfaBvp3hzSEaP1rsRca6vxVoOV4GnO3wWiVfEA==","signatures":[{"sig":"MEYCIQCobvrQt/tEfoGuTvQNTvBJe5kKoQnkVC/pbX3c4NZTvQIhAJJZG18ibYYmchfLZqnVhjRtJYHYB85ffCTkUXle0d4r","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@soundtouchjs%2fworklet-base@2.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59647},"main":"./.dist/index.js","type":"module","_from":"file:soundtouchjs-worklet-base-2.0.3.tgz","types":"./.dist/index.d.ts","exports":{".":{"types":"./.dist/index.d.ts","default":"./.dist/index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"cutterbl","email":"no.junk@cutterscrossing.com"},"_resolved":"/tmp/01c6a6201fbb2b2cec92d0e6b106cf67/soundtouchjs-worklet-base-2.0.3.tgz","_integrity":"sha512-nnS7l1XuvmesbZP1GNkT5uZL1q6PcP2gPsqC/yH+7oit6s5mdfaBvp3hzSEaP1rsRca6vxVoOV4GnO3wWiVfEA==","repository":{"url":"git+https://github.com/cutterbl/SoundTouchJS.git","type":"git","directory":"packages/worklet-base"},"_npmVersion":"10.8.2","description":"Abstract base processor for SoundTouchJS AudioWorklet packages","directories":{},"licenseFile":"LICENSE","sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@soundtouchjs/core":"2.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/worklet-base_2.0.3_1778876391632_0.382260786171271","host":"s3://npm-registry-packages-npm-production"}},"2.0.4":{"name":"@soundtouchjs/worklet-base","version":"2.0.4","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"author":{"name":"Steve 'Cutter' Blades"},"license":"MPL-2.0","_id":"@soundtouchjs/worklet-base@2.0.4","maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"contributors":[{"url":"https://cutterscrossing.com/","name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com"}],"homepage":"https://github.com/cutterbl/SoundTouchJS","bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"dist":{"shasum":"6382bf5835d328f2ff944679dc06404bbab4392f","tarball":"https://registry.npmjs.org/@soundtouchjs/worklet-base/-/worklet-base-2.0.4.tgz","fileCount":16,"integrity":"sha512-2gj49iFxrsvxuecFYIfeJFcgnMp6y5lSHCa5kykBPFOsnmSIfTVJYJCNrFNn4m6hWhobBQbdS/TfHptKehaBLg==","signatures":[{"sig":"MEUCIAe2XX6ddn30A6QY3Fn/RXC0DRkuCv6EWaaTVp7fmQreAiEAryuohr4KXArr29KBWYSE3UzCveYM4exVXswrQYcisM0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@soundtouchjs%2fworklet-base@2.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59647},"main":"./.dist/index.js","type":"module","_from":"file:soundtouchjs-worklet-base-2.0.4.tgz","types":"./.dist/index.d.ts","exports":{".":{"types":"./.dist/index.d.ts","default":"./.dist/index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"cutterbl","email":"no.junk@cutterscrossing.com"},"_resolved":"/tmp/2981730ed8f9616fc7c5a0830fa96cfd/soundtouchjs-worklet-base-2.0.4.tgz","_integrity":"sha512-2gj49iFxrsvxuecFYIfeJFcgnMp6y5lSHCa5kykBPFOsnmSIfTVJYJCNrFNn4m6hWhobBQbdS/TfHptKehaBLg==","repository":{"url":"git+https://github.com/cutterbl/SoundTouchJS.git","type":"git","directory":"packages/worklet-base"},"_npmVersion":"11.13.0","description":"Abstract base processor for SoundTouchJS AudioWorklet packages","directories":{},"licenseFile":"LICENSE","sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"@soundtouchjs/core":"2.0.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/worklet-base_2.0.4_1781036337840_0.32489559844565274","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@soundtouchjs/worklet-base","version":"2.1.0","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"author":{"name":"Steve 'Cutter' Blades"},"license":"MPL-2.0","_id":"@soundtouchjs/worklet-base@2.1.0","maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"contributors":[{"url":"https://cutterscrossing.com/","name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com"}],"homepage":"https://github.com/cutterbl/SoundTouchJS","bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"dist":{"shasum":"db318c590d992a97afe4a8a4164ceb967182f35f","tarball":"https://registry.npmjs.org/@soundtouchjs/worklet-base/-/worklet-base-2.1.0.tgz","fileCount":16,"integrity":"sha512-450GQpS1ehZ6iJep/udiUbXFvOtDDoX92Nk4xPp2YzMrkH3uz4tc2TSaZj4qmNy+mgjaIP17vB4pzzVzR3BZoQ==","signatures":[{"sig":"MEQCIGxq8iuA8otX4FwNUaW7ZGZkI0Fcv+c5aDaCrn0OUmj0AiAgWPt8KQr0IxfNb4JcfwqLPwbv6553BaMArJa3IGFg8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@soundtouchjs%2fworklet-base@2.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":59647},"main":"./.dist/index.js","type":"module","_from":"file:soundtouchjs-worklet-base-2.1.0.tgz","types":"./.dist/index.d.ts","exports":{".":{"types":"./.dist/index.d.ts","default":"./.dist/index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"cutterbl","email":"no.junk@cutterscrossing.com"},"_resolved":"/tmp/a9ee69a2c8e381e04eae676758c5f4aa/soundtouchjs-worklet-base-2.1.0.tgz","_integrity":"sha512-450GQpS1ehZ6iJep/udiUbXFvOtDDoX92Nk4xPp2YzMrkH3uz4tc2TSaZj4qmNy+mgjaIP17vB4pzzVzR3BZoQ==","repository":{"url":"git+https://github.com/cutterbl/SoundTouchJS.git","type":"git","directory":"packages/worklet-base"},"_npmVersion":"11.16.0","description":"Abstract base processor for SoundTouchJS AudioWorklet packages","directories":{},"licenseFile":"LICENSE","sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"@soundtouchjs/core":"2.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/worklet-base_2.1.0_1783533225079_0.41522823040402446","host":"s3://npm-registry-packages-npm-production"}},"2.1.1":{"name":"@soundtouchjs/worklet-base","version":"2.1.1","description":"Abstract base processor for SoundTouchJS AudioWorklet packages","license":"MPL-2.0","licenseFile":"LICENSE","type":"module","sideEffects":false,"exports":{"./package.json":"./package.json",".":{"types":"./.dist/index.d.ts","default":"./.dist/index.js"}},"main":"./.dist/index.js","types":"./.dist/index.d.ts","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"author":{"name":"Steve 'Cutter' Blades"},"contributors":[{"name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com","url":"https://cutterscrossing.com/"}],"repository":{"type":"git","url":"git+https://github.com/cutterbl/SoundTouchJS.git","directory":"packages/worklet-base"},"bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"homepage":"https://github.com/cutterbl/SoundTouchJS","publishConfig":{"access":"public"},"dependencies":{"@soundtouchjs/core":"2.1.1"},"_id":"@soundtouchjs/worklet-base@2.1.1","_integrity":"sha512-H/QMyW8yB91WX1CVSVCeOXNPdv1m71Zi0KQlvcX3f+159GNUo8kckmXV0cHpni9SCqVhCHMS/lapbBKl4tc6nQ==","_resolved":"/tmp/76eddf9d128bc91655e75d2480cdb86e/soundtouchjs-worklet-base-2.1.1.tgz","_from":"file:soundtouchjs-worklet-base-2.1.1.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-H/QMyW8yB91WX1CVSVCeOXNPdv1m71Zi0KQlvcX3f+159GNUo8kckmXV0cHpni9SCqVhCHMS/lapbBKl4tc6nQ==","shasum":"84474983cdcd9af8a60364ea66b780cabebcddb7","tarball":"https://registry.npmjs.org/@soundtouchjs/worklet-base/-/worklet-base-2.1.1.tgz","fileCount":16,"unpackedSize":59647,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@soundtouchjs%2fworklet-base@2.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHE2ktd0wfsyGWUIUDXq249B1BBj9UsIemtvImPs8bzBAiBGKtk2cXrATWP9dMU9PNOhkns9GrOf+cyjsPJvwAoQIg=="}]},"_npmUser":{"name":"cutterbl","email":"no.junk@cutterscrossing.com"},"directories":{},"maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/worklet-base_2.1.1_1785778768343_0.7263662405855311"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-15T19:15:11.004Z","modified":"2026-08-03T17:39:28.833Z","0.1.0":"2026-05-15T19:15:11.270Z","2.0.3":"2026-05-15T20:19:51.816Z","2.0.4":"2026-06-09T20:18:57.989Z","2.1.0":"2026-07-08T17:53:45.240Z","2.1.1":"2026-08-03T17:39:28.504Z"},"bugs":{"url":"https://github.com/cutterbl/SoundTouchJS/issues"},"author":{"name":"Steve 'Cutter' Blades"},"license":"MPL-2.0","homepage":"https://github.com/cutterbl/SoundTouchJS","keywords":["audio","WebAudio","AudioWorklet","TypeScript","pitch","tempo","soundtouch"],"repository":{"type":"git","url":"git+https://github.com/cutterbl/SoundTouchJS.git","directory":"packages/worklet-base"},"description":"Abstract base processor for SoundTouchJS AudioWorklet packages","contributors":[{"name":"Steve 'Cutter' Blades","email":"web.admin@cutterscrossing.com","url":"https://cutterscrossing.com/"}],"maintainers":[{"name":"cutterbl","email":"no.junk@cutterscrossing.com"}],"readme":"# @soundtouchjs/worklet-base\n\nAbstract base class for SoundTouchJS AudioWorklet processor packages. Centralises the shared DSP pipeline, runtime-update queue, and sample-buffer management that would otherwise be duplicated across every processor implementation.\n\n[I accept cash](https://paypal.me/cutterbl?locale.x=en_US) if you like what's been done.\n\nPart of the [SoundTouchJS](https://github.com/cutterbl/SoundTouchJS) monorepo — for more information and so much more.\n\n## Who this package is for\n\nThis package is an **implementation detail** of the SoundTouchJS worklet packages (`@soundtouchjs/audio-worklet`, `@soundtouchjs/phase-vocoder-worklet`, `@soundtouchjs/formant-correction-worklet`). It is also the correct starting point if you want to build a **custom AudioWorklet processor** on top of the SoundTouch engine.\n\nIf you only want to use SoundTouchJS in a web app, install one of the worklet packages above — you do not need to install this package directly.\n\n## Installation\n\n```sh\nnpm install @soundtouchjs/worklet-base\n```\n\n## Usage\n\nExtend `SoundTouchProcessorBase` inside your processor module and implement the required `onProcessComplete` hook:\n\n```ts\nimport { SoundTouchProcessorBase, STANDARD_PARAMETER_DESCRIPTORS } from '@soundtouchjs/worklet-base';\nimport type { ProcessCoreResult } from '@soundtouchjs/worklet-base';\n\nclass MyProcessor extends SoundTouchProcessorBase {\n  static get parameterDescriptors() {\n    return STANDARD_PARAMETER_DESCRIPTORS;\n  }\n\n  constructor() {\n    super('[MyProcessor]', {});\n  }\n\n  onProcessComplete(result: ProcessCoreResult): void {\n    // called after each block; post metrics, trigger side-effects, etc.\n    this.port.postMessage({ type: 'metrics', ...result });\n  }\n}\n\nregisterProcessor('my-processor', MyProcessor);\n```\n\n### Optional hooks\n\n| Method | When to override |\n|---|---|\n| `beforePipeProcess(left, right, frameCount, params)` | Pre-pipe analysis (e.g. LPC analysis for formant correction). Default is a no-op. |\n| `extractSamples(leftOutput, rightOutput, frameCount)` | Full extraction/write-back override (e.g. formant synthesis). Default writes both channels and returns RMS/peak metrics. |\n\n### Runtime messages\n\nSend messages to the processor via `AudioWorkletNode.port.postMessage`:\n\n```ts\n// Change interpolation strategy\nnode.port.postMessage({ type: 'setInterpolationStrategy', value: 'lanczos' });\n\n// Update strategy parameters\nnode.port.postMessage({ type: 'setInterpolationStrategyParams', value: { ... } });\n\n// Update stretch parameters\nnode.port.postMessage({ type: 'setStretchParameters', value: { ... } });\n```\n\n## API\n\n### `SoundTouchProcessorBase`\n\nAbstract class extending `AudioWorkletProcessor`.\n\n#### Constructor\n\n```ts\nnew SoundTouchProcessorBase(processorLabel: string, pipeOptions: SoundTouchOptions)\n```\n\n| Parameter | Description |\n|---|---|\n| `processorLabel` | Label used in log messages (e.g. `'[MyProcessor]'`). |\n| `pipeOptions` | Options forwarded to `SoundTouch` (interpolation strategy, stretch parameters, etc.). |\n\n#### Abstract method\n\n```ts\nabstract onProcessComplete(result: ProcessCoreResult): void\n```\n\nCalled at the end of every successfully processed block. `result` contains `{ outputRms, outputPeak }` unless `extractSamples` is overridden to return different values.\n\n#### Static method\n\n```ts\nstatic resolveStrategy(\n  id: RateTransposerInterpolationStrategy | undefined,\n  label: string,\n): RateTransposerInterpolationStrategy | undefined\n```\n\nValidates an interpolation strategy ID against the registry. Falls back to `'lanczos'` and logs a warning for unknown IDs.\n\n### `STANDARD_PARAMETER_DESCRIPTORS`\n\nArray of `AudioParamDescriptor` objects for the three standard k-rate parameters: `pitch`, `pitchSemitones`, and `playbackRate`. Spread this into your `parameterDescriptors` getter.\n\n### Message types\n\n| Export | Description |\n|---|---|\n| `SetInterpolationStrategyMessage` | `{ type: 'setInterpolationStrategy', value: RateTransposerInterpolationStrategy }` |\n| `SetInterpolationStrategyParamsMessage` | `{ type: 'setInterpolationStrategyParams', value: InterpolationStrategyParams }` |\n| `SetStretchParametersMessage` | `{ type: 'setStretchParameters', value: StretchParameters }` |\n| `ProcessorMessage` | Union of the three message types above. |\n| `ProcessCoreResult` | `{ outputRms: number, outputPeak: number }` |\n\n## License\n\n[MPL-2.0](./LICENSE)\n","readmeFilename":"README.md"}