|
|
|
@ -46,8 +46,6 @@ EMSCRIPTEN_BINDINGS(whisper) {
|
|
|
|
|
|
|
|
|
|
struct whisper_full_params params = whisper_full_default_params(whisper_sampling_strategy::WHISPER_SAMPLING_GREEDY);
|
|
|
|
|
|
|
|
|
|
printf("full_default: available threads %d\n", std::thread::hardware_concurrency());
|
|
|
|
|
|
|
|
|
|
params.print_realtime = true;
|
|
|
|
|
params.print_progress = false;
|
|
|
|
|
params.print_timestamps = true;
|
|
|
|
@ -57,9 +55,6 @@ EMSCRIPTEN_BINDINGS(whisper) {
|
|
|
|
|
params.n_threads = std::min(8, (int) std::thread::hardware_concurrency());
|
|
|
|
|
params.offset_ms = 0;
|
|
|
|
|
|
|
|
|
|
printf("full_default: using %d threads\n", params.n_threads);
|
|
|
|
|
printf("full_default: language '%s'\n", params.language);
|
|
|
|
|
|
|
|
|
|
std::vector<float> pcmf32;
|
|
|
|
|
const int n = audio["length"].as<int>();
|
|
|
|
|
|
|
|
|
@ -71,6 +66,20 @@ EMSCRIPTEN_BINDINGS(whisper) {
|
|
|
|
|
emscripten::val memoryView = audio["constructor"].new_(memory, reinterpret_cast<uintptr_t>(pcmf32.data()), n);
|
|
|
|
|
memoryView.call<void>("set", audio);
|
|
|
|
|
|
|
|
|
|
// print system information
|
|
|
|
|
{
|
|
|
|
|
printf("system_info: n_threads = %d / %d | %s\n",
|
|
|
|
|
params.n_threads, std::thread::hardware_concurrency(), whisper_print_system_info());
|
|
|
|
|
|
|
|
|
|
printf("%s: processing %d samples, %.1f sec, %d threads, %d processors, lang = %s, task = %s ...\n",
|
|
|
|
|
__func__, int(pcmf32.size()), float(pcmf32.size())/WHISPER_SAMPLE_RATE,
|
|
|
|
|
params.n_threads, 1,
|
|
|
|
|
params.language,
|
|
|
|
|
params.translate ? "translate" : "transcribe");
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ret = whisper_full(g_contexts[index], params, pcmf32.data(), pcmf32.size());
|
|
|
|
|
|
|
|
|
|
whisper_print_timings(g_contexts[index]);
|
|
|
|
|