Skip to content

Commit

Permalink
ticket VS-1603
Browse files Browse the repository at this point in the history
add support for audio transcribe - debugging
  • Loading branch information
rbucek committed Jun 17, 2024
1 parent 732a190 commit 6d1cee0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions transcribe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,10 @@ bool Transcribe::runWhisperNative(const char *wav, const char *language, const c
bool Transcribe::runWhisperNative(float *pcm_data, size_t pcm_data_samples, const char *language, const char *model, int threads,
string *language_detect, list<sSegment> *segments, string *error,
bool log, sTranscribeWavChannelParams *params) {
if(strcasecmp(language, "auto") && whisper_lang_id(language) == -1) {
*error = "unknown language";
return(false);
}
float max_sample = 0;
for(size_t i = 0; i < pcm_data_samples; i++) {
if(fabs(pcm_data[i]) > max_sample) {
Expand Down Expand Up @@ -768,10 +772,6 @@ bool Transcribe::runWhisperNative(float *pcm_data, size_t pcm_data_samples, cons
if(!log) {
whisper_log_set(whisper_native_cb_log_disable, NULL);
}
if(strcasecmp(language, "auto") && whisper_lang_id(language) == -1) {
*error = "unknown language";
return(false);
}
struct whisper_context_params cparams = whisper_context_default_params();
struct whisper_context *ctx = whisper_init_from_file_with_params(model, cparams);
if(!ctx) {
Expand Down Expand Up @@ -858,7 +858,7 @@ bool Transcribe::runWhisperNative(float *pcm_data, size_t pcm_data_samples, cons
if(log) {
cout << "max sample: " << max_sample << " - BLANK DATA" << endl;
}
*language_detect = "--";
*language_detect = strcasecmp(language, "auto") ? language : "--";
sSegment segment;
segment.start = 0;
segment.stop = 0;
Expand Down

0 comments on commit 6d1cee0

Please sign in to comment.