MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / run_waveform_case

Function run_waveform_case

tests/unittests/test_rnnoise_utility.cpp:98–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void run_waveform_case(const engine::audio::RnnoiseModel & model, const std::string & checkpoint, int case_index) {
99 const auto fixture = engine::assets::open_tensor_source(
100 asset_path("framework/audio_utilities/rnnoise/" + checkpoint + "_waveform_case" + std::to_string(case_index) + ".safetensors"));
101 const auto input = fixture->require_f32_tensor("waveform_input");
102 const auto expected_output = fixture->require_f32_tensor("waveform_output");
103 const auto expected_vad = fixture->require_f32_tensor("waveform_vad");
104 require(input.shape.rank == 2 && input.shape.dims[0] == 1, "RNNoise waveform input shape mismatch");
105 require(expected_output.shape.rank == 2 && expected_output.shape.dims[0] == 1, "RNNoise waveform output shape mismatch");
106 require(expected_vad.shape.rank == 2 && expected_vad.shape.dims[0] == 1, "RNNoise waveform vad shape mismatch");
107 const auto actual = model.process_mono_48k(input.values);
108 require(actual.sample_rate == 48000, "RNNoise sample rate mismatch");
109 require_close(
110 actual.samples,
111 expected_output.values,
112 2.0e-3f,
113 2.0e-4,
114 checkpoint + " waveform case " + std::to_string(case_index));
115 require_close(
116 actual.vad,
117 expected_vad.values,
118 2.5e-5f,
119 2.0e-6,
120 checkpoint + " waveform vad case " + std::to_string(case_index));
121}
122
123} // namespace
124

Callers 1

mainFunction · 0.85

Calls 7

open_tensor_sourceFunction · 0.85
require_f32_tensorMethod · 0.80
process_mono_48kMethod · 0.80
asset_pathFunction · 0.70
requireFunction · 0.70
require_closeFunction · 0.70
to_stringFunction · 0.50

Tested by

no test coverage detected