| 1233 | std::optional<std::vector<float>>(std::move(normalized_whisper))); |
| 1234 | } |
| 1235 | |
| 1236 | Vevo2TokenSequence Vevo2CocoContentStyleTokenizerRuntime::encode_style_reference( |
| 1237 | const std::optional<runtime::AudioBuffer> & style_ref_audio, |
| 1238 | const std::optional<std::vector<float>> & whisper_features, |
| 1239 | int64_t feature_frames, |
| 1240 | const Vevo2GenerationOptions & generation) const { |
| 1241 | if (!style_ref_audio.has_value()) { |
| 1242 | return {}; |
| 1243 | } |
| 1244 | if (!whisper_features.has_value()) { |
| 1245 | throw std::runtime_error("Vevo2 style reference tokenization requires Whisper features"); |
| 1246 | } |
| 1247 | return encode_feature_frames( |
| 1248 | *whisper_features, |
| 1249 | compute_vevo2_chromagram( |
| 1250 | *style_ref_audio, |
| 1251 | feature_frames, |
| 1252 | 1.0, |
| 1253 | generation.use_pitch_shift, |
| 1254 | generation.use_pitch_shift ? generation.style_shift_steps : 0), |
| 1255 | feature_frames); |
| 1256 | } |
| 1257 | |
| 1258 | Vevo2TokenSequence Vevo2CocoContentStyleTokenizerRuntime::encode_shifted_reference( |
| 1259 | const runtime::AudioBuffer & audio, |
| 1260 | const std::vector<float> & whisper_features, |
| 1261 | int64_t feature_frames, |
| 1262 | int pitch_shift_steps) const { |
| 1263 | return encode_feature_frames( |
| 1264 | whisper_features, |
| 1265 | compute_vevo2_chromagram(audio, feature_frames, 1.0, true, pitch_shift_steps), |
| 1266 | feature_frames); |
| 1267 | } |
| 1268 | |
| 1269 | Vevo2TokenSequence Vevo2CocoContentStyleTokenizerRuntime::encode_timbre_reference( |
| 1270 | const runtime::AudioBuffer & timbre_ref_audio, |