node : add audio_ctx and audio buffer params (#2123)

* node : add audio_ctx param

* node : support passing audio buffer directly

* node : parse audio_ctx in index.js

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Pedro Probst
2024-05-13 09:22:23 -03:00
committed by GitHub
parent 2ced6f0742
commit 3928dbd206
3 changed files with 48 additions and 9 deletions

View File

@ -16,13 +16,20 @@ const whisperParams = {
comma_in_time: false,
translate: true,
no_timestamps: false,
audio_ctx: 0,
};
const arguments = process.argv.slice(2);
const params = Object.fromEntries(
arguments.reduce((pre, item) => {
if (item.startsWith("--")) {
return [...pre, item.slice(2).split("=")];
const [key, value] = item.slice(2).split("=");
if (key === "audio_ctx") {
whisperParams[key] = parseInt(value);
} else {
whisperParams[key] = value;
}
return pre;
}
return pre;
}, [])