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

Function semantic_downsample_factor

src/models/omnivoice/audio_tokenizer.cpp:467–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467int64_t semantic_downsample_factor(const OmniVoiceAudioTokenizerConfig & config) {
468 const double factor =
469 static_cast<double>(checked_positive(config.hop_length, "hop_length")) /
470 (static_cast<double>(checked_positive(config.sample_rate, "sample_rate")) /
471 static_cast<double>(checked_positive(config.semantic_sample_rate, "semantic_sample_rate"))) /
472 static_cast<double>(checked_positive(config.downsample_factor, "downsample_factor"));
473 const auto rounded = static_cast<int64_t>(std::llround(factor));
474 if (rounded <= 0 || std::fabs(factor - static_cast<double>(rounded)) > 1.0e-6) {
475 throw std::runtime_error("OmniVoice semantic_downsample_factor is not an integer");
476 }
477 return rounded;
478}
479
480int64_t semantic_feature_frames(const OmniVoiceAudioTokenizerConfig & config, int64_t semantic_samples) {
481 const auto & semantic = config.semantic_model;

Callers 2

EncoderGraphMethod · 0.85

Calls 1

checked_positiveFunction · 0.70

Tested by

no test coverage detected