All problems
TTS Duration Prediction
Problem
Predict the total TTS duration in frames: sum over characters of char_durations[ch], where unknown characters add 0, divided by speed.
Return 0.0 when speed is not positive.
Hint
A higher speaking rate divides the total duration down.
Test cases
case 1
in: ["abc",{"a":2,"b":3,"c":4},1]
expected: 9
case 2
in: ["abc",{"a":2,"b":3,"c":4},1.5]
expected: 6
case 3
in: ["ax",{"a":2},1]
expected: 2
case 4
in: ["",{},1]
expected: 0
case 5
in: ["ab",{"a":1,"b":1},0]
expected: 0
Starter codePython
def tts_duration_prediction(text, char_durations, speed):
# Your code here
pass5 test cases · run your code against them in the editor