Skip to content

Commit 2f5cb42

Browse files
committed
Version 2.0.9
Feature-partiy with the native 2.0.9 SDK, including less jitter in time-stretching. Fixed Promise implementations.
1 parent 86afd2a commit 2f5cb42

File tree

9 files changed

+45
-17
lines changed

9 files changed

+45
-17
lines changed

docs.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ <h3>Initialization</h3>
3737
// Always call this once in your main scope (main thread).
3838
// Worklets: if using Superpowered in a Worklet, call this in the Worklet as well.
3939
// Audio Worklets: do not call this in an Audio Worklet.
40-
var Superpowered = SuperpoweredModule({
40+
var Superpowered = null;
41+
SuperpoweredModule({
4142
licenseKey: 'ExampleLicenseKey-WillExpire-OnNextUpdate', // your license key
4243
enableAudioAnalysis: true, // Enables Analyzer, Waveform and BandpassFilterbank.
4344
enableFFTAndFrequencyDomain: false, // Enables FFTComplex, FFTReal and PolarFFT.
4445
enableAudioTimeStretching: false, // Enables TimeStretching.
4546
enableAudioEffects: false, // Enables all effects and the Spatializer.
4647

47-
onReady: function() {
48+
onReady: function(SuperpoweredInstance) {
49+
Superpowered = SuperpoweredInstance;
4850
// stuff you run after Superpowered is initialized
4951
}
5052
});

example_effects/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ async function toggleAudio() {
4444
}
4545
}
4646

47-
Superpowered = SuperpoweredModule({
47+
SuperpoweredModule({
4848
licenseKey: 'ExampleLicenseKey-WillExpire-OnNextUpdate',
4949
enableAudioEffects: true,
5050
enableAudioAnalysis: true,
5151

52-
onReady: function() {
52+
onReady: function(SuperpoweredInstance) {
53+
Superpowered = SuperpoweredInstance;
5354
// UI: innerHTML may be ugly but keeps this example small
5455
document.getElementById('content').innerHTML = '\
5556
<p>Put on your headphones first, you\'ll be deaf due audio feedback otherwise.</p>\

example_guitardistortion/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ async function startInput() {
201201
startUserInterface();
202202
}
203203

204-
Superpowered = SuperpoweredModule({
204+
SuperpoweredModule({
205205
licenseKey: 'ExampleLicenseKey-WillExpire-OnNextUpdate',
206206
enableAudioEffects: true,
207207

208-
onReady: function() {
208+
onReady: function(SuperpoweredInstance) {
209+
Superpowered = SuperpoweredInstance;
209210
content = document.getElementById('content');
210211
content.innerHTML = '<p>Use this if you just want to listen: <button id="startSample">START WITH GUITAR SAMPLE</button></p><p>Use this if you want to play the guitar live: <button id="startInput">START WITH AUDIO INPUT</button></p>';
211212
document.getElementById('startSample').addEventListener('click', startSample);

example_timestretching/main.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function start() {
6464
content.innerText = 'Downloading music...';
6565
let response = await fetch('track.wav');
6666

67-
content.innerText = 'Decoding audio...'; console.log('new');
67+
content.innerText = 'Decoding audio...';
6868
let rawData = await response.arrayBuffer();
6969
audioContext.decodeAudioData(rawData, function(pcmData) { // Safari doesn't support await for decodeAudioData yet
7070
// send the PCM audio to the audio node
@@ -94,11 +94,12 @@ async function start() {
9494
});
9595
}
9696

97-
Superpowered = SuperpoweredModule({
97+
SuperpoweredModule({
9898
licenseKey: 'ExampleLicenseKey-WillExpire-OnNextUpdate',
9999
enableAudioTimeStretching: true,
100100

101-
onReady: function() {
101+
onReady: function(SuperpoweredInstance) {
102+
Superpowered = SuperpoweredInstance;
102103
content = document.getElementById('content');
103104
content.innerHTML = '<button id="startButton">START</button>';
104105
document.getElementById('startButton').addEventListener('click', start);

example_timestretching/processor.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var Superpowered = null;
44

55
class MyProcessor extends SuperpoweredModule.AudioWorkletProcessor {
66
// runs after the constructor
7-
onReady() {
7+
onReady() {
88
Superpowered = this.Superpowered;
99
this.posFrames = -1;
1010
// allocating some WASM memory for passing audio to the time stretcher
1111
this.pcm = Superpowered.createFloatArray(2048 * 2);
1212
// the star of the show
13-
this.timeStretching = Superpowered.new('TimeStretching', Superpowered.samplerate, 0.5, 1);
13+
this.timeStretching = Superpowered.new('TimeStretching', Superpowered.samplerate, 0.5);
1414
}
1515

1616
onMessageFromMainScope(message) {

package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "superpowered",
3+
"description": "Superpowered interactive audio features in JavaScript + WebAssembly.",
4+
"version": "2.0.7",
5+
"browser": "superpowered.js",
6+
"scripts": {
7+
"test": "echo \"No test specified.\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/superpoweredSDK/web-audio-javascript-webassembly-SDK-interactive-audio.git"
12+
},
13+
"keywords": ["superpowered", "audio"],
14+
"author": "Splice",
15+
"license": "SEE LICENSE IN /license",
16+
"bugs": {
17+
"url": "https://github.com/superpoweredSDK/web-audio-javascript-webassembly-SDK-interactive-audio/issues",
18+
"email": "support@superpowered.zendesk.com"
19+
},
20+
"homepage": "https://superpowered.com/js-wasm-overview"
21+
}

superpowered-worker.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

superpowered.bc

38 Bytes
Binary file not shown.

superpowered.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)