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

Function mono_from_audio

src/models/omnivoice/postprocess.cpp:246–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246std::vector<float> mono_from_audio(const runtime::AudioBuffer & audio) {
247 if (audio.sample_rate <= 0 || audio.channels <= 0) {
248 throw std::runtime_error("OmniVoice postprocess requires valid audio metadata");
249 }
250 if (audio.samples.empty()) {
251 return {};
252 }
253 if (audio.samples.size() % static_cast<size_t>(audio.channels) != 0) {
254 throw std::runtime_error("OmniVoice postprocess received invalid interleaved audio");
255 }
256 return engine::audio::mixdown_interleaved_to_mono_average(audio.samples, audio.channels);
257}
258
259runtime::AudioBuffer make_audio_buffer(std::vector<float> mono, int sample_rate) {
260 runtime::AudioBuffer out;

Callers 1

finalizeMethod · 0.85

Calls 3

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected