Skip to content

Commit

Permalink
defined channeldata
Browse files Browse the repository at this point in the history
fixed dropup button width on filename panel
unset analysis done in  loadModel
  • Loading branch information
Mattk70 committed Oct 30, 2024
1 parent 466f867 commit e345c0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
5 changes: 4 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,12 @@ footer {
max-height: 30vh;
}

#fileContainer {
max-width: 40vw;
}

.filename,
.dropdown-menu-dark>a {
max-width: 40%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
1 change: 1 addition & 0 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2667,6 +2667,7 @@ function onChartData(args) {
const loadModel = () => {
PREDICTING = false;
t0_warmup = Date.now();
STATE.analysisDone = false;
worker.postMessage({
action: 'load-model',
model: config.model,
Expand Down
29 changes: 9 additions & 20 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,9 +1237,7 @@ const setMetadata = async ({ file, source_file = file }) => {
// savedMeta may just have a locationID if it was set by onSetCUstomLocation
if (! savedMeta?.duration) {
try {
console.time('get duration')
METADATA[file].duration = await getDuration(file)
console.timeEnd('get duration')
} catch (e) {
throw new Error('Unable to determine file duration ', e);
}
Expand Down Expand Up @@ -1418,14 +1416,6 @@ async function processAudio (file, start, end, chunkStart, highWaterMark, sample
DEBUG && console.log('progress: ', progress.timemark)
checkBacklog(command)
})
command.on('codecData', function(data) {
if ( ! ['N/A', Infinity].includes(data.duration)) {
// Update Metadata with accurate duration
const [hours, minutes, seconds] = data.duration.split(':').map(parseFloat);
const totalSeconds = (hours * 3600) + (minutes * 60) + seconds;
METADATA[file].duration = totalSeconds;
}
})
const STREAM = command.pipe();
STREAM.on('data', (chunk) => {
if (aborted) {
Expand All @@ -1445,14 +1435,13 @@ async function processAudio (file, start, end, chunkStart, highWaterMark, sample

});
STREAM.on('end', () => {
// wait for the ffpmegstream to close: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/1171#issuecomment-1361524138
//EOF: deal with part-full buffers
if (concatenatedBuffer.byteLength){
prepareWavForModel(concatenatedBuffer, file, end, chunkStart);
feedChunksToModel(...predictQueue.shift());
}
DEBUG && console.log('All chunks sent for ', file);
return resolve()
//EOF: deal with part-full buffers
if (concatenatedBuffer.byteLength){
prepareWavForModel(concatenatedBuffer, file, end, chunkStart);
feedChunksToModel(...predictQueue.shift());
}
DEBUG && console.log('All chunks sent for ', file);
return resolve()
})

STREAM.on('error', err => {
Expand All @@ -1478,7 +1467,7 @@ function getMonoChannelData(audio){

function prepareWavForModel(audio, file, end, chunkStart) {
predictionsRequested[file]++;
channelData = getMonoChannelData(audio);
const channelData = getMonoChannelData(audio);
// Send the channel data to the model
predictQueue.push([channelData, chunkStart, file, end]);
AUDIO_BACKLOG++;
Expand Down Expand Up @@ -2192,7 +2181,7 @@ const parsePredictions = async (response) => {

return response.worker
}

let SEEN_MODEL_READY = false;
async function parseMessage(e) {
const response = e.data;
Expand Down

0 comments on commit e345c0e

Please sign in to comment.