Skip to content

Commit be07cec

Browse files
committed
Merge branch 'master' into allow-for-NextSegment-to-be-called-when-Process-is-re-called
2 parents 9fe28e7 + a88b93f commit be07cec

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ endif()
3434
if (EMSCRIPTEN)
3535
set(BUILD_SHARED_LIBS_DEFAULT OFF)
3636

37+
set(CMAKE_CXX_STANDARD 17)
38+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
39+
3740
option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON)
3841

3942
# TODO: without these, we get the following error:
-864 KB
Binary file not shown.
864 KB
Binary file not shown.

src/whisper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6693,7 +6693,7 @@ static bool whisper_vad(
66936693
}
66946694

66956695
segment_start_samples = std::min(segment_start_samples, n_samples - 1);
6696-
segment_end_samples = std::min(segment_end_samples, n_samples);
6696+
segment_end_samples = std::min(segment_end_samples, n_samples - 1);
66976697
int segment_length = segment_end_samples - segment_start_samples;
66986698
if (segment_length > 0) {
66996699
whisper_state::vad_segment_info segment;

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ add_executable(${VAD_TEST} ${VAD_TEST}.cpp)
9494
target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../examples)
9595
target_link_libraries(${VAD_TEST} PRIVATE common)
9696
target_compile_definitions(${VAD_TEST} PRIVATE
97-
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin"
97+
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin"
9898
SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav")
9999
add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
100100
set_tests_properties(${VAD_TEST} PROPERTIES LABELS "unit")
@@ -106,7 +106,7 @@ target_include_directories(${VAD_TEST} PRIVATE ../include ../ggml/include ../exa
106106
target_link_libraries(${VAD_TEST} PRIVATE common)
107107
target_compile_definitions(${VAD_TEST} PRIVATE
108108
WHISPER_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/ggml-base.en.bin"
109-
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v5.1.2-ggml.bin"
109+
VAD_MODEL_PATH="${PROJECT_SOURCE_DIR}/models/for-tests-silero-v6.2.0-ggml.bin"
110110
SAMPLE_PATH="${PROJECT_SOURCE_DIR}/samples/jfk.wav")
111111
add_test(NAME ${VAD_TEST} COMMAND ${VAD_TEST})
112112
set_tests_properties(${VAD_TEST} PROPERTIES LABELS "base;en")

tests/test-vad-full.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ int main() {
4242
const int n_segments = whisper_full_n_segments(wctx);
4343
assert(n_segments == 1);
4444

45+
46+
printf("Segment text:\n%s", whisper_full_get_segment_text(wctx, 0));
4547
assert(strcmp(" And so my fellow Americans, ask not what your country can do for you,"
4648
" ask what you can do for your country.",
4749
whisper_full_get_segment_text(wctx, 0)) == 0);
48-
assert(whisper_full_get_segment_t0(wctx, 0) == 29);
49-
assert(whisper_full_get_segment_t1(wctx, 0) == 1049);
50+
assert(whisper_full_get_segment_t0(wctx, 0) == 32);
51+
assert(whisper_full_get_segment_t1(wctx, 0) == 1051);
5052

5153
whisper_free(wctx);
5254

tests/test-vad.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct whisper_vad_segments * test_detect_timestamps(
3636
struct whisper_vad_context * vctx,
3737
struct whisper_vad_params params) {
3838
struct whisper_vad_segments * timestamps = whisper_vad_segments_from_probs(vctx, params);
39-
assert(whisper_vad_segments_n_segments(timestamps) == 5);
39+
assert(whisper_vad_segments_n_segments(timestamps) == 4);
4040

4141
for (int i = 0; i < whisper_vad_segments_n_segments(timestamps); ++i) {
4242
printf("VAD segment %d: start = %.2f, end = %.2f\n", i,

0 commit comments

Comments
 (0)