| 56 | } |
| 57 | if (value == "style_preserved_svc") { |
| 58 | return {Vevo2InferencePath::SourceAudioToTargetVoice, Vevo2RouteKind::StylePreservedSingingConversion}; |
| 59 | } |
| 60 | if (value == "style_converted_vc") { |
| 61 | return {Vevo2InferencePath::TextProsodyToTargetVoice, Vevo2RouteKind::StyleConvertedVoiceConversion}; |
| 62 | } |
| 63 | if (value == "style_converted_svc") { |
| 64 | return {Vevo2InferencePath::TextProsodyToTargetVoice, Vevo2RouteKind::StyleConvertedSingingConversion}; |
| 65 | } |
| 66 | if (value == "editing") { |
| 67 | return {Vevo2InferencePath::TextProsodyToTargetVoice, Vevo2RouteKind::Editing}; |
| 68 | } |
| 69 | if (value == "singing_style_conversion") { |
| 70 | return {Vevo2InferencePath::TextProsodyToTargetVoice, Vevo2RouteKind::SingingStyleConversion}; |
| 71 | } |
| 72 | if (value == "humming_to_singing" || value == "instrument_to_singing") { |
| 73 | return {Vevo2InferencePath::TextProsodyToTargetVoice, Vevo2RouteKind::MelodyControl}; |
| 74 | } |
| 75 | throw std::runtime_error( |
| 76 | "invalid Vevo2 route: " + value + |
| 77 | " (expected zero_shot_tts, text_to_singing, svs, style_preserved_vc, " |
| 78 | "style_preserved_svc, style_converted_vc, style_converted_svc, editing, " |
| 79 | "singing_style_conversion, humming_to_singing, or instrument_to_singing)"); |
| 80 | } |
| 81 | |
| 82 | const char * default_route_for_task(runtime::VoiceTaskKind task) { |
| 83 | switch (task) { |
| 84 | case runtime::VoiceTaskKind::Tts: |
| 85 | return "zero_shot_tts"; |
| 86 | case runtime::VoiceTaskKind::VoiceConversion: |
| 87 | return "style_preserved_vc"; |
| 88 | case runtime::VoiceTaskKind::SpeechToSpeech: |
| 89 | return "editing"; |
| 90 | case runtime::VoiceTaskKind::Svc: |
| 91 | return "style_preserved_svc"; |
| 92 | default: |
| 93 | throw std::runtime_error("Vevo2 supports tts, vc, s2s, and svc tasks"); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | bool route_matches_task(const Vevo2RouteKind route, runtime::VoiceTaskKind task) { |