Skip to content

Commit

Permalink
Added minimum skip time to reduce stuttering
Browse files Browse the repository at this point in the history
removed console.logging in cue manager
updated jsdocs
  • Loading branch information
crazoter committed Aug 28, 2019
1 parent d394148 commit 43c9816
Show file tree
Hide file tree
Showing 55 changed files with 499 additions and 170 deletions.
Binary file modified PanoptoPlus/dev.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion PanoptoPlus/dev/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Panopto Plus",
"version": "1.3.4",
"version": "1.3.5",
"description": "Improve your webcasting experience!",
"manifest_version": 2,
"permissions": ["tabs", "storage"],
Expand Down
4 changes: 2 additions & 2 deletions PanoptoPlus/dev/panopto/js/core/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let Settings = (() => {
{"name":"settings_machinetranscript","value":1},
{"name":"settings_silencetrimming","value":1},
{"name":"settings_silencethreshold","value":1.89},
{"name":"settings_noisedetection","value":0}
{"name":"settings_staticnoisedetection","value":1}
];
data.push({name: "time", value: new Date().getTime()});
return data;
Expand Down Expand Up @@ -106,7 +106,7 @@ let Settings = (() => {
machinetranscript: "settings_machinetranscript",
silencetrimming: "settings_silencetrimming",
silencethreshold: "settings_silencethreshold",
noisedetection: "settings_noisedetection"
noisedetection: "settings_staticnoisedetection"
};
Settings.PLAYBACK_OPTIONS = {
DEFAULT: 0,
Expand Down
56 changes: 34 additions & 22 deletions PanoptoPlus/dev/panopto/js/jsmpeg/vad-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,32 @@ VADProcessor = (() => {
this.currentTime = 0;
//48,000 samples per second, 1 interval is every FFT1_BIN_COUNT
this.timePerInterval = FFT1_BIN_COUNT / this.sampleRate;
this.minSkipTime = this.timePerInterval * 4;
this.results = [];
this.processedResults = false;

//If using fixed noise sample, just use this
if (!referenceLineFeatures && options.useFixedNoiseSample) {
referenceLineFeatures = [
[
{lowerBound: 5.222302787585955, upperBound: 8.18209849619599},
{lowerBound: -2.720560653024017, upperBound: 14.561054287714768},
{lowerBound: -4.433624334513411, upperBound: 21.18500421078679},
{lowerBound: -13.13957874661612, upperBound: 47.54697782432633},
{lowerBound: -64.13284327395473, upperBound: 228.51541204913292}
],
[
{lowerBound: 5.210286374498044, upperBound: 8.191514976778304},
{lowerBound: -2.7224707609363428, upperBound: 14.563473340592378},
{lowerBound: -4.435583830295101, upperBound: 21.187714859610132},
{lowerBound: -13.162070808534374, upperBound: 47.53771603431636},
{lowerBound: -64.23850958165923, upperBound: 228.47060367552376}
]
];
if (!referenceLineFeatures && options.useFixedNoiseSample !== 0) {
switch (options.useFixedNoiseSample) {
//in case we want to extend it to more options
default: referenceLineFeatures = [
[
{lowerBound: 5.222302787585955, upperBound: 8.18209849619599},
{lowerBound: -2.720560653024017, upperBound: 14.561054287714768},
{lowerBound: -4.433624334513411, upperBound: 21.18500421078679},
{lowerBound: -13.13957874661612, upperBound: 47.54697782432633},
{lowerBound: -64.13284327395473, upperBound: 228.51541204913292}
],
[
{lowerBound: 5.210286374498044, upperBound: 8.191514976778304},
{lowerBound: -2.7224707609363428, upperBound: 14.563473340592378},
{lowerBound: -4.435583830295101, upperBound: 21.187714859610132},
{lowerBound: -13.162070808534374, upperBound: 47.53771603431636},
{lowerBound: -64.23850958165923, upperBound: 228.47060367552376}
]
];
break;
}
}

//Reserved values
Expand All @@ -110,6 +115,8 @@ VADProcessor = (() => {
* @returns {NoiseResult|NormalResult} If is noise sample: (2x5 matrix; 2 arrays 5 var). If is not, it will return Array.<{isSpeaking: Boolean, time: Number}>
*/
process() {
//this.isNoiseSample = true;
//referenceLineFeatures = null;
if (this.processedResults) return this.results;
//Start from designated point
let initialOffset = Math.floor(this.startProcessingFrom / this.duration * this.float32Length);
Expand Down Expand Up @@ -497,16 +504,21 @@ VADProcessor = (() => {
}

/**
* The threshold is now variant. Using recordDistance instead
* The threshold is now variant. Factors in minimum skip time to avoid stuttering.
* Store into results upon changing speech
* @param {Boolean} startedSpeech isSpeaking
* @returns {undefined}
*/
changedSpeech(startedSpeech) {
this.results.push({
isSpeaking: startedSpeech,
time: this.startTime + this.currentTime - this.lagTime
});
let now = this.startTime + this.currentTime - this.lagTime;
if (this.results.length <= 0 || now - this.results[this.results.length - 1].time > this.minSkipTime) {
this.results.push({
isSpeaking: startedSpeech,
time: now
});
} else {
this.results.pop();
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions PanoptoPlus/dev/panopto/js/jsmpeg/vad-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ onmessage = (event) => {
const vadProcessor = new VADProcessor(data, options);
const results = vadProcessor.process();
const msgEnum = options.isNoiseSample ? MessageEnums.NOISE_RESULTS : MessageEnums.NORMAL_RESULTS;
//const msgEnum = MessageEnums.NOISE_RESULTS;
vadProcessor.cleanUp();
//Send results back
postMessage({data: {results: results, interval: vadProcessor.calculateLagTime()}, options: options, msgEnum: msgEnum});
Expand Down
6 changes: 3 additions & 3 deletions PanoptoPlus/dev/panopto/js/ui/settings-page-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let SettingsPage = (() => {
let zValueDivClassName = "";
if (form) {
let value = form.elements["settings_silencethreshold"].value;
zValueDivClassName = form.elements["settings_noisedetection"].value == 1 ? "tempDisabled" : "";
zValueDivClassName = form.elements["settings_staticnoisedetection"].value == 0 ? "" : "tempDisabled";
index = Math.round(parseFloat(value) * 100);
}
let zValuePercentage = (zValuePercentages[index] || "Invalid") + "%";
Expand Down Expand Up @@ -284,8 +284,8 @@ let SettingsPage = (() => {
</div>
</div>
<div onChange={this.settingsChange.bind(this)}>
<label class="settings-checkbox"><input type="radio" required name="settings_noisedetection" value="0"/><i>Dynamic</i></label>
<label class="settings-checkbox"><input type="radio" required name="settings_noisedetection" value="1"/><i>Based on sample</i></label>
<label class="settings-checkbox"><input type="radio" required name="settings_staticnoisedetection" value="0"/><i>Dynamic</i></label>
<label class="settings-checkbox"><input type="radio" required name="settings_staticnoisedetection" value="1"/><i>Based on sample</i></label>
</div>
<div className={zValueDivClassName}>
<div>Silence z-value
Expand Down
6 changes: 3 additions & 3 deletions PanoptoPlus/dev/panopto/js/ui/settings-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ let SettingsPage = (() => {

if (form) {
let value = form.elements["settings_silencethreshold"].value;
zValueDivClassName = form.elements["settings_noisedetection"].value == 1 ? "tempDisabled" : "";
zValueDivClassName = form.elements["settings_staticnoisedetection"].value == 0 ? "" : "tempDisabled";
index = Math.round(parseFloat(value) * 100);
}

Expand Down Expand Up @@ -380,14 +380,14 @@ let SettingsPage = (() => {
}, preact.h("input", {
type: "radio",
required: true,
name: "settings_noisedetection",
name: "settings_staticnoisedetection",
value: "0"
}), preact.h("i", null, "Dynamic")), preact.h("label", {
class: "settings-checkbox"
}, preact.h("input", {
type: "radio",
required: true,
name: "settings_noisedetection",
name: "settings_staticnoisedetection",
value: "1"
}), preact.h("i", null, "Based on sample"))), preact.h("div", {
className: zValueDivClassName
Expand Down
2 changes: 1 addition & 1 deletion PanoptoPlus/dev/panopto/js/ui/silence-cue-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let SilenceCueManager = (() => {
lastSynced = 0;
console.info("Synced using Panopto API");
}
console.log(offset, lastSynced)
//console.log(offset, lastSynced)
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/Cache.html
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/CarouselManager.html
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/ContextBridge.html
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/DelayDisabler.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/LoggerDisabler.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion jsdocs/MinHeap.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cache.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Fri Aug 16 2019 02:21:14 GMT+0800 (Singapore Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.2</a> on Wed Aug 28 2019 16:58:39 GMT+0800 (Singapore Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 43c9816

Please sign in to comment.