Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ target_include_directories(test-moss-audio PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/examples
)
target_compile_definitions(test-moss-audio PRIVATE
SAMPLES_DIR="${PROJECT_SOURCE_DIR}/samples"
)
target_link_libraries(test-moss-audio PRIVATE
Catch2::Catch2WithMain
moss_audio
Expand Down
10 changes: 7 additions & 3 deletions tests/test_moss_audio_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include <string>
#include <vector>

#ifndef SAMPLES_DIR
#define SAMPLES_DIR "samples"
#endif

static std::vector<float> load_wav_16k(const char* path) {
FILE* f = fopen(path, "rb");
if (!f)
Expand Down Expand Up @@ -42,7 +46,7 @@ TEST_CASE("moss-audio transcribe JFK", "[integration][moss-audio]") {
auto* ctx = moss_audio_init_from_file(model_path, params);
REQUIRE(ctx != nullptr);

auto pcm = load_wav_16k("samples/jfk.wav");
auto pcm = load_wav_16k(SAMPLES_DIR "/jfk.wav");
REQUIRE(!pcm.empty());

char* text = moss_audio_transcribe(ctx, pcm.data(), (int)pcm.size());
Expand All @@ -69,7 +73,7 @@ TEST_CASE("moss-audio custom prompt", "[integration][moss-audio]") {
auto* ctx = moss_audio_init_from_file(model_path, params);
REQUIRE(ctx != nullptr);

auto pcm = load_wav_16k("samples/jfk.wav");
auto pcm = load_wav_16k(SAMPLES_DIR "/jfk.wav");
REQUIRE(!pcm.empty());

// Audio understanding: ask a question about the audio
Expand Down Expand Up @@ -97,7 +101,7 @@ TEST_CASE("moss-audio run_encoder_meta valid-frame metadata (issue #344)", "[int
auto* ctx = moss_audio_init_from_file(model_path, params);
REQUIRE(ctx != nullptr);

auto pcm = load_wav_16k("samples/jfk.wav");
auto pcm = load_wav_16k(SAMPLES_DIR "/jfk.wav");
REQUIRE(!pcm.empty());

// 1. mel with truthful pre-pad length
Expand Down
Loading