Commit 5acd0e5
committed
Support speaker names in voice assignment
Allow voices to be assigned using speaker names/roles in addition
to speaker order (e.g., speaker_1, speaker_2).
Speaker names are case-insensitive, so "Doctor", "DOCTOR",
and "doctor" are treated equivalently.
Examples:
```python
# Assigning voices using speaker names / roles
dialog.to_audio(
"path/to/output/audio",
voices={
"Doctor": "path/to/doctor_voice_reference.wav",
"Patient": "path/to/patient_voice_reference.wav",
}
)
# Assigning voices using speaker orders (speaker_1, speaker_2)
dialog.to_audio(
"path/to/output/audio",
voices={
"speaker_1": "path/to/doctor_voice_reference.wav",
"speaker_2": "path/to/patient_voice_reference.wav",
}
)
```
Speaker names are case insensitive, so this will also work exactly the same as the first example:
```python
dialog.to_audio(
"path/to/output/audio",
voices={
"DOCTOR": "path/to/doctor_voice_reference.wav",
"PATIENT": "path/to/patient_voice_reference.wav",
}
)
```
This keeps backward compatibility while making voice
configuration more flexible and readable.1 parent 16123a7 commit 5acd0e5
4 files changed
Lines changed: 38 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | 180 | | |
183 | 181 | | |
184 | | - | |
185 | | - | |
| 182 | + | |
| 183 | + | |
186 | 184 | | |
187 | 185 | | |
188 | | - | |
189 | | - | |
| 186 | + | |
| 187 | + | |
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
| |||
478 | 476 | | |
479 | 477 | | |
480 | 478 | | |
481 | | - | |
482 | | - | |
| 479 | + | |
| 480 | + | |
483 | 481 | | |
484 | 482 | | |
485 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
546 | 550 | | |
547 | 551 | | |
548 | 552 | | |
| |||
| 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 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
427 | 451 | | |
428 | 452 | | |
429 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
696 | | - | |
| 696 | + | |
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
| |||
0 commit comments