Commit 94eb1a3
crispasr integration
feat(api,#432): set the reference voice from in-memory samples
rslife: passing a reference only as a path "forces going through filesystem IO
and creating temporary files when a segment of a wav file needs to be passed".
You have already decoded the audio and sliced out the segment you want; the API
then makes you write it back to disk to hand it over.
crispasr_session_set_voice_samples(s, pcm, n_samples, sample_rate, ref_text)
Session::set_voice_samples(&[f32], sample_rate, ref_text) // Rust
WHY IT DELEGATES THROUGH THE PATH FUNCTION INSTEAD OF CALLING BACKENDS DIRECTLY,
which is the one interesting decision here. Seven backends already accept PCM
(f5_tts_set_reference, pocket_tts_set_voice, moss_tts_set_reference_wav,
miotts_set_reference, irodori_tts_set_reference, ...), so routing straight to
them is both tempting and obvious, and would avoid the write entirely.
It would also bypass crispasr_session_set_voice's consent and Art. 50(4) marking
logic, which is keyed on the reference's provenance and emits the [CONSENT]
audit line. That would make the compliance trail depend on WHICH OVERLOAD a
caller happened to reach for — a clone acquiring a different audit trail for
arriving as a buffer rather than a path. That is the same shape as the #435
phonemizer gap fixed earlier today: a second code path that quietly skips what
the first one guarantees. One behaviour, one audit trail.
So the serialisation still happens — but inside the library, once, in the system
temp directory, with cleanup on every exit path including failure. The caller's
actual problem (materialising and reaping temp files around a Vec<f32>) is
solved. The library's own IO is an implementation detail that per-backend PCM
routes can remove later WITHOUT changing this signature, which is why the
signature takes samples rather than a path.
Temp names combine a steady-clock stamp with an in-process atomic counter rather
than a PID, so concurrent calls in one process cannot collide and no
getpid()/GetCurrentProcessId() split is needed. A leftover file from a crashed
run can never be adopted as this call's reference.
Compiles clean (g++ -fsyntax-only over the full TU). Behavioural coverage comes
from CI's Rust binding tests; a local end-to-end needs a cloning-capable TTS
model, which this box does not have.1 parent 07fda1c commit 94eb1a3
4 files changed
Lines changed: 129 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
444 | 452 | | |
445 | 453 | | |
446 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
922 | 969 | | |
923 | 970 | | |
924 | 971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
427 | 438 | | |
428 | 439 | | |
429 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
8453 | 8456 | | |
8454 | 8457 | | |
8455 | 8458 | | |
| 8459 | + | |
| 8460 | + | |
| 8461 | + | |
| 8462 | + | |
| 8463 | + | |
| 8464 | + | |
| 8465 | + | |
| 8466 | + | |
| 8467 | + | |
| 8468 | + | |
| 8469 | + | |
| 8470 | + | |
| 8471 | + | |
| 8472 | + | |
| 8473 | + | |
| 8474 | + | |
| 8475 | + | |
| 8476 | + | |
| 8477 | + | |
| 8478 | + | |
| 8479 | + | |
| 8480 | + | |
| 8481 | + | |
| 8482 | + | |
| 8483 | + | |
| 8484 | + | |
| 8485 | + | |
| 8486 | + | |
| 8487 | + | |
| 8488 | + | |
| 8489 | + | |
| 8490 | + | |
| 8491 | + | |
| 8492 | + | |
| 8493 | + | |
| 8494 | + | |
| 8495 | + | |
| 8496 | + | |
| 8497 | + | |
| 8498 | + | |
| 8499 | + | |
| 8500 | + | |
| 8501 | + | |
| 8502 | + | |
| 8503 | + | |
| 8504 | + | |
| 8505 | + | |
| 8506 | + | |
| 8507 | + | |
| 8508 | + | |
| 8509 | + | |
| 8510 | + | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + | |
| 8515 | + | |
| 8516 | + | |
| 8517 | + | |
| 8518 | + | |
8456 | 8519 | | |
8457 | 8520 | | |
8458 | 8521 | | |
| |||
0 commit comments