Skip to content

Commit a3f4911

Browse files
committed
remove headers and footers from snippets
1 parent 165190d commit a3f4911

File tree

8 files changed

+38
-118
lines changed

8 files changed

+38
-118
lines changed

examples/snippet-components/autotagging/index.html

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@
1818
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/essentia.js-plot.js"></script>
1919
<script src="app.js" defer></script>
2020
<script src="audio-utils.js" defer></script>
21-
<div>
22-
<a>
23-
<img
24-
src="https://github.com/MTG/essentia.js/blob/master/src/assets/img/essentiajsbanner.png?raw=true"
25-
/>
26-
</a>
27-
</div>
21+
2822
<h2 style="color: azure;">
2923
TensorflowMusiCNN example using WebWorkers
3024
</h2>
@@ -43,27 +37,7 @@ <h2 style="color: azure;">
4337
<div id="plotDiv"></div>
4438
<br/>
4539
<div id="plotDivTags"></div>
46-
<br />
47-
<br />
48-
49-
<div class="footer" style="margin-top: 30px; height: 20%;">
50-
<a class="demo_logo" target="_blank" href="//essentia.upf.edu">
51-
<img
52-
id="logo"
53-
src="https://essentia.upf.edu/documentation/_static/essentia_logo.svg"
54-
alt="MTG Logo"
55-
style="margin-left: 40px; height: 70px;"
56-
/>
57-
</a>
58-
<a target="_blank" href="https://www.upf.edu/web/mtg">
59-
<img
60-
class="essnt-footer_mtg-logo"
61-
src="https://mtg.github.io/assets/img/upflogo.png"
62-
alt="mtg logo"
63-
style="width:300px; height: 70px;"
64-
/>
65-
</a>
66-
</div>
40+
6741
</body>
6842
</center>
6943
</html>

examples/snippet-components/autotagging/inference-worker.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ class TestMusicnn extends EssentiaModel.TensorflowMusiCNN {
2828
});
2929
this.isReady = true;
3030
}
31+
32+
async predict(inputFeature, zeroPadding) {
33+
34+
let featureTensor = this.arrayToTensorAsBatches(
35+
inputFeature.melSpectrum,
36+
[inputFeature.frameSize, inputFeature.melBandsSize],
37+
inputFeature.patchSize,
38+
zeroPadding
39+
);
40+
// Get default model input variables
41+
let modelInputs = this.disambiguateExtraInputs();
42+
// add the input feature tensor to the model inputs
43+
modelInputs.push(featureTensor);
44+
// Run inference
45+
let results = this.model.execute(modelInputs);
46+
// free tensors
47+
featureTensor.dispose();
48+
// decode the output activations as array with a promise
49+
let resultsArray = await results.array();
50+
results.dispose();
51+
return resultsArray;
52+
}
3153
}
3254
const musiCNN = new TestMusicnn(tf, modelURL);
3355

@@ -37,6 +59,7 @@ musiCNN.initialize()
3759
console.log(`Using TF ${tf.getBackend()} backend`);
3860

3961
self.onmessage = e => {
62+
console.log('received data: ', e.data)
4063
musiCNN.predict(e.data, true)
4164
.then((predictions) => self.postMessage(predictions));
4265
// post the predictions as message to the main thread

examples/snippet-components/chroma/index.html

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/essentia.js-plot.js"></script>
2020
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
2121
<script src="script.js" defer></script>
22-
<div>
23-
<a>
24-
<img
25-
src="https://github.com/MTG/essentia.js/blob/master/src/assets/img/essentiajsbanner.png?raw=true"
26-
/>
27-
</a>
28-
</div>
22+
2923
<h2 style="color: azure;">
3024
HPCP chroma example
3125
</h2>
@@ -40,26 +34,7 @@ <h2 style="color: azure;">
4034
<div class="ui divider" style="width: 2px; height: 5px;"></div>
4135
<div id="plotDiv"></div>
4236
<br />
43-
<br />
44-
45-
<div class="footer" style="margin-top: 30px; height: 20%;">
46-
<a class="demo_logo" target="_blank" href="//essentia.upf.edu">
47-
<img
48-
id="logo"
49-
src="https://essentia.upf.edu/documentation/_static/essentia_logo.svg"
50-
alt="MTG Logo"
51-
style="margin-left: 40px; height: 70px;"
52-
/>
53-
</a>
54-
<a target="_blank" href="https://www.upf.edu/web/mtg">
55-
<img
56-
class="essnt-footer_mtg-logo"
57-
src="https://mtg.github.io/assets/img/upflogo.png"
58-
alt="mtg logo"
59-
style="width:300px; height: 70px;"
60-
/>
61-
</a>
62-
</div>
37+
6338
</body>
6439
</center>
6540
</html>

examples/snippet-components/chroma/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let essentiaExtractor;
2-
let audioURL = "https://freesound.org/data/previews/328/328857_230356-lq.mp3";
2+
let audioURL = "https://cdn.freesound.org/previews/328/328857_230356-lq.mp3";
33

44
let audioData;
55
// fallback for cross-browser Web Audio API BaseAudioContext
@@ -66,7 +66,7 @@ EssentiaWASM().then(async function(WasmModule) {
6666

6767
// essentia version log to html div
6868
$("#logDiv").html(
69-
"<h5> essentia-" + essentiaExtractor.version + " wasm backend loaded ... </h5>"
69+
"<h5> essentia.js wasm backend loaded ... </h5>"
7070
);
7171

7272
$("#logDiv").append(

examples/snippet-components/melspectrogram/index.html

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@
1919
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/essentia.js-plot.js"></script>
2020
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
2121
<script src="script.js" defer></script>
22-
<div>
23-
<a>
24-
<img
25-
src="https://github.com/MTG/essentia.js/blob/master/src/assets/img/essentiajsbanner.png?raw=true"
26-
/>
27-
</a>
28-
</div>
22+
2923
<h2 style="color: azure;">
30-
Log-MelSpectrogram example
24+
Log-Mel Spectrogram example
3125
</h2>
3226

3327
<div class="ui divider" style="height: 2px; width: 0.1px;"></div>
@@ -39,26 +33,6 @@ <h2 style="color: azure;">
3933
<div id="logDiv" style="color: azure;"><br /></div>
4034
<div class="ui divider" style="width: 0.1px; height: 0.1px;"></div>
4135
<div id="plotDiv"></div>
42-
<br />
43-
44-
<div class="footer" style="margin-top: 30px; height: 20%;">
45-
<a class="demo_logo" target="_blank" href="//essentia.upf.edu">
46-
<img
47-
id="logo"
48-
src="https://essentia.upf.edu/documentation/_static/essentia_logo.svg"
49-
alt="MTG Logo"
50-
style="margin-left: 40px; height: 70px;"
51-
/>
52-
</a>
53-
<a target="_blank" href="https://www.upf.edu/web/mtg">
54-
<img
55-
class="essnt-footer_mtg-logo"
56-
src="https://mtg.github.io/assets/img/upflogo.png"
57-
alt="mtg logo"
58-
style="width:300px; height: 70px;"
59-
/>
60-
</a>
61-
</div>
6236
</body>
6337
</center>
6438
</html>

examples/snippet-components/melspectrogram/script.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let essentiaExtractor;
2-
let audioURL = "https://freesound.org/data/previews/328/328857_230356-lq.mp3";
2+
let audioURL = "https://cdn.freesound.org/previews/328/328857_230356-lq.mp3";
33

44
let audioData;
55
let audioCtx = new AudioContext();
@@ -68,9 +68,9 @@ EssentiaWASM().then(async function(WasmModule) {
6868
essentiaExtractor = new EssentiaExtractor(WasmModule);
6969

7070
// essentia version log to html div
71-
$("#logDiv").html("<h5> essentia-" + essentiaExtractor.version + " wasm backend loaded ... </h5><br>");
71+
$("#logDiv").html("<h5> essentia.js wasm backend loaded ... </h5><br>");
7272

73-
$("#logDiv").append('<button id="btn" class="ui white inverted button">Compute Log-Mel-Spectrogram </button>');
73+
$("#logDiv").append('<button id="btn" class="ui white inverted button">Compute Log-Mel Spectrogram </button>');
7474

7575
var button = document.getElementById("btn");
7676

examples/snippet-components/pitch/index.html

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/essentia.js-plot.js"></script>
2020
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
2121
<script src="script.js" defer></script>
22-
<div>
23-
<a>
24-
<img
25-
src="https://github.com/MTG/essentia.js/blob/master/src/assets/img/essentiajsbanner.png?raw=true"
26-
/>
27-
</a>
28-
</div>
22+
2923
<h2 style="color: azure;">
3024
PitchMelodia example
3125
</h2>
@@ -39,27 +33,7 @@ <h2 style="color: azure;">
3933
<div id="logDiv" style="color: azure;"><br /></div>
4034
<div class="ui divider" style="width: 2px; height: 5px;"></div>
4135
<div id="plotDiv"></div>
42-
<br />
43-
<br />
44-
45-
<div class="footer" style="margin-top: 30px; height: 20%;">
46-
<a class="demo_logo" target="_blank" href="//essentia.upf.edu">
47-
<img
48-
id="logo"
49-
src="https://essentia.upf.edu/documentation/_static/essentia_logo.svg"
50-
alt="MTG Logo"
51-
style="margin-left: 40px; height: 70px;"
52-
/>
53-
</a>
54-
<a target="_blank" href="https://www.upf.edu/web/mtg">
55-
<img
56-
class="essnt-footer_mtg-logo"
57-
src="https://mtg.github.io/assets/img/upflogo.png"
58-
alt="mtg logo"
59-
style="width:300px; height: 70px;"
60-
/>
61-
</a>
62-
</div>
36+
6337
</body>
6438
</center>
6539
</html>

examples/snippet-components/pitch/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let essentia;
2-
let audioURL = "https://freesound.org/data/previews/328/328857_230356-lq.mp3";
2+
let audioURL = "https://cdn.freesound.org/previews/328/328857_230356-lq.mp3";
33

44
let audioData;
55
// fallback for cross-browser Web Audio API BaseAudioContext
@@ -64,7 +64,7 @@ EssentiaWASM().then(async function(WasmModule) {
6464

6565
// essentia version log to html div
6666
$("#logDiv").html(
67-
"<h5> essentia-" + essentia.version + " wasm backend loaded ... </h5>"
67+
"<h5> essentia.js wasm backend loaded ... </h5>"
6868
);
6969

7070
$("#logDiv").append(

0 commit comments

Comments
 (0)