Commit a41d7cb
committed
fix(voice): anchor siliconflow subtitle timeline end to full audio duration
siliconflow_tts built its subtitle offsets with an ad-hoc loop that
computed each sentence's duration independently using integer division:
sentence_duration = int(sentence_chars * char_duration)
Accumulated truncation meant the last subtitle always ended a few
100-nanosecond units before the real audio end, leaving a subtitle gap
at the tail of every SiliconFlow-generated video.
The root cause is the same one that was already fixed for all other TTS
providers (gemini_tts, mimo_tts, minimax_tts): use the shared
populate_legacy_submaker_with_full_text helper, which explicitly
anchors the last sentence to audio_duration_100ns.
Also removed the redundant `from moviepy import AudioFileClip` local
import (AudioFileClip is already imported at module level) and wrapped
audio_clip.close() in a finally block so it cannot be skipped on error.
Added a unit test that mocks the HTTP response and AudioFileClip and
asserts the last subtitle offset equals the full audio duration.1 parent 465b8b3 commit a41d7cb
2 files changed
Lines changed: 61 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
951 | | - | |
952 | 951 | | |
953 | 952 | | |
954 | | - | |
955 | 953 | | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | 954 | | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
999 | 959 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
| 960 | + | |
| 961 | + | |
1012 | 962 | | |
1013 | 963 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
1017 | 968 | | |
1018 | | - | |
1019 | 969 | | |
1020 | 970 | | |
1021 | 971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1318 | 1318 | | |
1319 | 1319 | | |
1320 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1321 | 1371 | | |
1322 | 1372 | | |
1323 | 1373 | | |
1324 | | - | |
| 1374 | + | |
0 commit comments