dpo_reader.voices

Voice assignment for TTS backends.

Functions

get_backend_voice(voice_id, engine)

Map generic voice ID to backend-specific voice.

Classes

TTSEngine

Available TTS engines.

VoiceAssignment

Maps authors to voice IDs.

class dpo_reader.voices.TTSEngine[source]

Bases: Enum

Available TTS engines.

BARK = 'bark'
PIPER = 'piper'
dpo_reader.voices.get_backend_voice(voice_id, engine)[source]

Map generic voice ID to backend-specific voice.

Parameters:
Return type:

str

class dpo_reader.voices.VoiceAssignment[source]

Bases: object

Maps authors to voice IDs.

assignments: dict[str, str]
engine: TTSEngine = 'bark'
assign(username)[source]

Get or assign a voice for an author.

Parameters:

username (str)

Return type:

str

get_voice(username)[source]

Get the assigned backend-specific voice for an author.

Parameters:

username (str)

Return type:

str

get_generic_voice(username)[source]

Get the generic voice ID for an author.

Parameters:

username (str)

Return type:

str

classmethod from_author_counts(author_counts, engine=TTSEngine.BARK, prioritize_active=True)[source]

Create voice assignments from author post counts.

Parameters:
Return type:

VoiceAssignment

summary()[source]

Get a summary of voice assignments.

Return type:

list[tuple[str, str, str]]

__init__(assignments=<factory>, engine=TTSEngine.BARK, _next_idx=0)
Parameters:
Return type:

None