Superpowered on NPM!
It's landed, the Superpowered v2.6.5 Javascript SDK is available on NPM!
You can now import the Superpowered WebAssembly library into your projects just like most other javascript libraries, with a simple install:
npm install @superpoweredsdk/web
// or if you want to install a specific version
npm install @superpoweredsdk/web@2.6.5
Changes on your main thread
We've also moved things around a little and we're now using a CDN to smooth out the integration process for you. Previously, you needed to pass in a location for a publically served copy of the .js Superpowered library to get around issues with mangeling which took place during bundleing. Now, if just evaluating the library, just pass in the trial license key and a CDN will be used to pull in the webassembly. If using Superpowered in production, you'll need to host the WASM yourself and pass in the location of the webassembly instead.
import { SuperpoweredGlue, SuperpoweredWebAudio } from '@superpoweredsdk/web';
// Option 1: If running the evaluation version of the library, this will pull the WASM from a CDN.
const superpowered = await SuperpoweredGlue.Instantiate('ExampleLicenseKey-WillExpire-OnNextUpdate');
// Option 2: If running the Superpowered in production with a license key, you'll need to host the Superpowered WASM yourself and pass in its' location.
const superpowered = await SuperpoweredGlue.Instantiate('[YOUR_LICENSE_KEY]', '/[WHERE YOU HOST]/superpowered.wasm');
Changes on your audio thread(s)
// Import the superpowered library from the CDN if evaluating
import "https://cdn.jsdelivr.net/npm/@superpoweredsdk/web@2.6.5/dist/superpowered-npm.wasm";
// Or from your own location if in production eg
import '/[YOUR_OWN_LOCATION]/Superpowered.js';
// Your usual Superpowered audio worklet processor script
class ToneProcessor extends SuperpoweredWebAudio.AudioWorkletProcessor {
processAudio {
...
}
}
You'll find the full guide here.
PS: Noticed two new version of Superpowered since our last update? v2.6.4 was using the UNPKG CDN but we found it often took a while to serve up the WASM, making the boot time of Supepowered too slow. In v2.6.5 we moved over to jsDelivr, which seems to be much more responsive. There were no feature changes from v2.6.4 to v2.6.5, we only changed the CDN.
Enjoy!
- superpowered documentation
- superpowered reference
- superpowered examples
- superpowered tutorial