Skip to content

Commit

Permalink
Merge pull request #3 from SEPIA-Framework/dev
Browse files Browse the repository at this point in the history
v0.9.10
  • Loading branch information
fquirin authored Jan 30, 2022
2 parents 670110d + 99e565c commit ae7887c
Show file tree
Hide file tree
Showing 20 changed files with 3,342 additions and 80 deletions.
4 changes: 2 additions & 2 deletions dist/sepia-web-audio.min.js

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions modules-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="stylesheet" href="src/visualization/uPlot.min.css?v=1.5.2">

<!--<script src="src/polyfills/audioworklet-polyfill.js"></script>-->
<script type="text/javascript" src="src/sepia-web-audio.js?v=0.9.7"></script>
<script type="text/javascript" src="src/sepia-web-audio.js?v=0.9.10"></script>
<script>
//set correct modules folder
if (window.SepiaFW) SepiaFW.webAudio.defaultProcessorOptions.moduleFolder = "src/modules";
Expand Down Expand Up @@ -104,9 +104,11 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
<div><label>Porcupine Version:</label><select id="porcupineVersionSelect" onchange="setPorcupineVersion(+this.value);">
<option value="14" selected>v1.4</option>
<option value="19">v1.9</option>
<option value="20">v2.0 (en)</option>
</select></div>
<div style="display: inline-flex; align-items: center;"><label>Gate:</label><div id="wakeWordGateState"></div><label></label></div>
<div><label>Control:</label><button onclick="wakeWordSetGate('open');">Listen</button><button onclick="wakeWordSetGate('close');">Stop</button><label></label></div>
<div><label>Key (v2+):</label><input id="porcupineAccessKey" placeholder="access key required for v2+"></div>
</div>
<div id="waveEncoderControls" class="contorlGroup">
<label><b>Wave Encoder</b></label>
Expand Down Expand Up @@ -366,7 +368,7 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
name: 'porcupine-wake-word-worker',
type: 'worker',
preLoad: {
wasmFile: ('src/modules/picovoice/porcupine-' + porcupineVersion + '.wasm')
wasmFile: ('src/modules/picovoice/porcupine-' + (porcupineVersion > 19? (porcupineVersion + "_" + porcupineLanguage) : porcupineVersion) + '.wasm')
},
settings: {
onmessage: onWakeWordMessage,
Expand All @@ -377,8 +379,12 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
inputSampleSize: resamplerBufferSize, //output bufferSize of previous module
bufferSize: resamplerBufferSize, //TODO: this has no effect yet
version: porcupineVersion,
porcupineLanguage: "en",
porcupineAccessKey: document.getElementById("porcupineAccessKey").value,
keywords: (porcupineVersion == 14? ["Hey SEPIA"] : ["Computer", "Jarvis", "Picovoice"]),
sensitivities: (porcupineVersion == 14? [wakeWordSensitivity] : [wakeWordSensitivity, wakeWordSensitivity, wakeWordSensitivity])
sensitivities: (porcupineVersion == 14? [wakeWordSensitivity] : [wakeWordSensitivity, wakeWordSensitivity, wakeWordSensitivity]),
keywordsRemoteLocation: ""
//can be used in combination with keyword names like ["Server: My Word"] for path like: [keywordsRemoteLocation]/2.0_en/keywords/[my_word]_wasm_20_en.js
}
}
}
Expand Down Expand Up @@ -443,7 +449,8 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
startSuspended: true,
debugLog: onDebugLog,
customSourceTest: useWhiteNoiseTest,
customSource: customSource
customSource: customSource,
initializerTimeout: 8000

}, function(msg){
//Init. ready
Expand Down Expand Up @@ -552,10 +559,14 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
}else{
fileUrl = "test-sounds/traffic_counting.ogg";
}
showLogMessage("createFileSource", fileUrl);
showLogMessage("createFileSource", fileUrl);
var loop = true; //default is true
var onEndCallback = function(){
console.log("Audio file source stream ended."); //only triggers if loop=false
};
return SepiaFW.webAudio.createFileSource(fileUrl, {
targetSampleRate: targetSampleRate
});
}, loop, onEndCallback);
}

//Audio node data/visualizations:
Expand Down Expand Up @@ -842,6 +853,7 @@ <h1>SEPIA Web Audio Processor - Module Tests</h1>
var wakeWordGateOpen = false;
var wakeWordSensitivity = +document.getElementById("wakeWordSensitivity").value;
var porcupineVersion = +document.getElementById("porcupineVersionSelect").value;
var porcupineLanguage = "en"; //TODO: add more
function setWakeWordSensitivity(sense){
wakeWordSensitivity = sense;
console.log("wakeWordSensitivity", wakeWordSensitivity);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/example-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ExampleProcessor extends AudioWorkletProcessor {
that.port.postMessage({
//Default message type is "processing result", but it can be 'moduleState', 'moduleEvent' and 'moduleResponse' ("on-demand" requests) as well
//NOTE: only default processing (no tag) and 'moduleEvent' will be forwarded automatically
moduleState: 1, //1=ready, 2=changed, 9=read for termination
moduleState: 1, //1=ready, 2=changed, 9=ready for termination, 10=custom error
moduleInfo: {
sourceSamplerate: that.sourceSamplerate,
targetSamplerate: that.targetSamplerate,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/example-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function constructWorker(options) {
postMessage({
//Default message type is "processing result", but it can be 'moduleState', 'moduleEvent' and 'moduleResponse' ("on-demand" requests) as well
//NOTE: only default processing (no tag) and 'moduleEvent' will be forwarded automatically
moduleState: 1, //1=ready, 2=changed, 9=read for termination -- for "on-demand" requests outside of normal processing sequence use 'moduleResponse: true'
moduleState: 1, //1=ready, 2=changed, 9=ready for termination, 10=custom error -- for "on-demand" requests outside of normal processing sequence use 'moduleResponse: true'
moduleInfo: {
hello: "world"
}
Expand Down
Binary file added src/modules/picovoice/porcupine-20_en.wasm
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ae7887c

Please sign in to comment.