Skip to content

Commit

Permalink
Merge branch 'dataset_wavs' of https://github.com/Mattk70/Chirpity-El…
Browse files Browse the repository at this point in the history
…ectron into dataset_wavs
  • Loading branch information
Mattk70 committed Mar 28, 2024
2 parents 6f53298 + b1f3758 commit 00240d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
19 changes: 9 additions & 10 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2923,16 +2923,15 @@ function onChartData(args) {
// DIAGNOSTICS:
t1_analysis = Date.now();
const analysisTime = ((t1_analysis - t0_analysis) / 1000).toFixed(2);
if (! STATE.selection){
DIAGNOSTICS['Analysis Duration'] = analysisTime + ' seconds';
const rate = (DIAGNOSTICS['Audio Duration'] / analysisTime);
DIAGNOSTICS['Analysis Rate'] = rate.toFixed(0) + 'x faster than real time performance.';
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Audio Duration', config.backend, Math.round(DIAGNOSTICS['Audio Duration']));
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Analysis Duration', config.backend, parseInt(analysisTime));
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Analysis Rate', config.backend, parseInt(rate));
generateToast({ message:'Analysis complete.'})
activateResultFilters();
}
const duration = STATE.selection ? STATE.selection.end - STATE.selection.start : DIAGNOSTICS['Audio Duration'];
DIAGNOSTICS['Analysis Duration'] = analysisTime + ' seconds';
const rate = duration / analysisTime;
DIAGNOSTICS['Analysis Rate'] = rate.toFixed(0) + 'x faster than real time performance.';
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Audio Duration', config.backend, Math.round(duration));
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Analysis Duration', config.backend, parseInt(analysisTime));
trackEvent(config.UUID, `${config.model}-${config.backend}`, 'Analysis Rate', config.backend, parseInt(rate));
STATE.selection || generateToast({ message:'Analysis complete.'})
STATE.selection || activateResultFilters();
}

/*
Expand Down
17 changes: 8 additions & 9 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ const getPredictBuffers = async ({
else {
error.message = error.message + '|' + error.stack;
}
reject(console.warn('Error in ffmpeg extracting audio segment:', error.message));
reject(console.warn('getPredictBuffers: Error in ffmpeg extracting audio segment:', error.message));
});
command.on('start', function (commandLine) {
DEBUG && console.log('FFmpeg command: ' + commandLine);
Expand All @@ -1309,12 +1309,10 @@ const getPredictBuffers = async ({
console.log('STREAM ended, destroyed')
}
else {
// try/catch may no longer be necessary
try {
concatenatedBuffer = concatenatedBuffer.length ? Buffer.concat([concatenatedBuffer, chunk]) : chunk;
} catch (error) {
console.warn(error)
console.warn('concat bugger length', concatenatedBuffer.length, 'chunk.length', chunk.length, chunk.buffer.detached, concatenatedBuffer.buffer.detached)
}

// if we have a full buffer
Expand Down Expand Up @@ -1403,7 +1401,7 @@ const fetchAudioBuffer = async ({
}
command.on('error', error => {
UI.postMessage({event: 'generate-alert', message: error.message})
reject(new Error('Error extracting audio segment:', error));
reject(new Error('fetchAudioBuffer: Error extracting audio segment:', error));
});
command.on('start', function (commandLine) {
DEBUG && console.log('FFmpeg command: ' + commandLine);
Expand Down Expand Up @@ -2113,11 +2111,12 @@ async function parseMessage(e) {
if (remaining === 0) {
if (filesBeingProcessed.length) {
processNextFile({ worker: worker });
} else if ( !STATE.selection) {
getSummary() //.then(() => UI.postMessage({event: "analysis-complete"}));
} else {
UI.postMessage({event: "analysis-complete"});
}
}
// else if ( !STATE.selection) {
// getSummary() //.then(() => UI.postMessage({event: "analysis-complete"}));
// } else {
// UI.postMessage({event: "analysis-complete"});
// }
}
}
break;
Expand Down

0 comments on commit 00240d6

Please sign in to comment.