anyvoice 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anyvoice/__init__.py +55 -0
- anyvoice/base.py +106 -0
- anyvoice/log.py +25 -0
- anyvoice/providers/__init__.py +6 -0
- anyvoice/providers/edge.py +155 -0
- anyvoice/providers/openai.py +149 -0
- anyvoice/py.typed +0 -0
- anyvoice/sinks.py +172 -0
- anyvoice/stream.py +198 -0
- anyvoice-0.0.2.dist-info/METADATA +67 -0
- anyvoice-0.0.2.dist-info/RECORD +13 -0
- anyvoice-0.0.2.dist-info/WHEEL +4 -0
- anyvoice-0.0.2.dist-info/licenses/LICENSE +22 -0
anyvoice/__init__.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""AnyVoice: A streaming-friendly Text-to-Speech library.
|
|
2
|
+
|
|
3
|
+
This library provides a clean, composable API for TTS synthesis with:
|
|
4
|
+
- Multiple provider backends (OpenAI, Edge TTS)
|
|
5
|
+
- Pluggable audio sinks (speakers, file, callback)
|
|
6
|
+
- Streaming support with sentence buffering
|
|
7
|
+
- Configurable synchronization modes
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
from anyvoice import TTSStream, OpenAITTSProvider, SoundDeviceSink
|
|
11
|
+
|
|
12
|
+
provider = OpenAITTSProvider(api_key="...")
|
|
13
|
+
session = provider.session(voice="nova")
|
|
14
|
+
|
|
15
|
+
async with TTSStream(session, sink=SoundDeviceSink()) as tts:
|
|
16
|
+
await tts.feed("Hello ")
|
|
17
|
+
await tts.feed("world!")
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from importlib.metadata import version
|
|
23
|
+
|
|
24
|
+
from anyvoice.base import AudioSink, TTSProvider, TTSSession
|
|
25
|
+
from anyvoice.providers import EdgeTTSProvider, OpenAITTSProvider
|
|
26
|
+
from anyvoice.sinks import CallbackSink, FileSink, SoundDeviceSink
|
|
27
|
+
from anyvoice.stream import TTSMode, TTSStream
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__version__ = version("anyvoice")
|
|
31
|
+
__title__ = "AnyVoice"
|
|
32
|
+
|
|
33
|
+
__author__ = "Philipp Temminghoff"
|
|
34
|
+
__author_email__ = "philipptemminghoff@googlemail.com"
|
|
35
|
+
__copyright__ = "Copyright (c) 2025 Philipp Temminghoff"
|
|
36
|
+
__license__ = "MIT"
|
|
37
|
+
__url__ = "https://github.com/phil65/anyvoice"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
# Base classes
|
|
42
|
+
"AudioSink",
|
|
43
|
+
# Sinks
|
|
44
|
+
"CallbackSink",
|
|
45
|
+
# Providers
|
|
46
|
+
"EdgeTTSProvider",
|
|
47
|
+
"FileSink",
|
|
48
|
+
"OpenAITTSProvider",
|
|
49
|
+
"SoundDeviceSink",
|
|
50
|
+
# Orchestrator
|
|
51
|
+
"TTSMode",
|
|
52
|
+
"TTSProvider",
|
|
53
|
+
"TTSSession",
|
|
54
|
+
"TTSStream",
|
|
55
|
+
]
|
anyvoice/base.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Base classes for TTS providers and audio sinks."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Self
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from collections.abc import AsyncIterator
|
|
11
|
+
from types import TracebackType
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AudioSink(ABC):
|
|
15
|
+
"""Abstract base class for audio output backends.
|
|
16
|
+
|
|
17
|
+
Audio sinks receive PCM audio chunks and handle output
|
|
18
|
+
(playback, file writing, etc.).
|
|
19
|
+
|
|
20
|
+
Usage as context manager:
|
|
21
|
+
async with SoundDeviceSink() as sink:
|
|
22
|
+
await sink.write(audio_chunk)
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
async def __aenter__(self) -> Self:
|
|
26
|
+
"""Enter the sink context, prepare for receiving audio."""
|
|
27
|
+
return self
|
|
28
|
+
|
|
29
|
+
async def __aexit__( # noqa: B027
|
|
30
|
+
self,
|
|
31
|
+
exc_type: type[BaseException] | None,
|
|
32
|
+
exc_val: BaseException | None,
|
|
33
|
+
exc_tb: TracebackType | None,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Exit the sink context, finalize and cleanup."""
|
|
36
|
+
|
|
37
|
+
@abstractmethod
|
|
38
|
+
async def write(self, chunk: bytes) -> None:
|
|
39
|
+
"""Write a PCM audio chunk to the sink.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
chunk: Raw PCM audio data (16-bit signed, mono).
|
|
43
|
+
"""
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class TTSSession(ABC):
|
|
48
|
+
"""Abstract base class for TTS synthesis sessions.
|
|
49
|
+
|
|
50
|
+
A session represents a single synthesis context with specific
|
|
51
|
+
configuration (voice, speed, etc.). Sessions are lightweight
|
|
52
|
+
and created by providers.
|
|
53
|
+
|
|
54
|
+
Usage:
|
|
55
|
+
session = provider.session(voice="nova")
|
|
56
|
+
async for chunk in session.synthesize("Hello world"):
|
|
57
|
+
await sink.write(chunk)
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
async def __aenter__(self) -> Self:
|
|
61
|
+
"""Enter the session context."""
|
|
62
|
+
return self
|
|
63
|
+
|
|
64
|
+
async def __aexit__( # noqa: B027
|
|
65
|
+
self,
|
|
66
|
+
exc_type: type[BaseException] | None,
|
|
67
|
+
exc_val: BaseException | None,
|
|
68
|
+
exc_tb: TracebackType | None,
|
|
69
|
+
) -> None:
|
|
70
|
+
"""Exit the session context, cleanup resources."""
|
|
71
|
+
|
|
72
|
+
@abstractmethod
|
|
73
|
+
def synthesize(self, text: str) -> AsyncIterator[bytes]:
|
|
74
|
+
"""Synthesize text to PCM audio.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
text: Text to synthesize.
|
|
78
|
+
|
|
79
|
+
Yields:
|
|
80
|
+
PCM audio chunks (16-bit signed, mono).
|
|
81
|
+
"""
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class TTSProvider(ABC):
|
|
86
|
+
"""Abstract base class for TTS providers.
|
|
87
|
+
|
|
88
|
+
Providers hold credentials and client configuration, and act
|
|
89
|
+
as factories for lightweight sessions.
|
|
90
|
+
|
|
91
|
+
Usage:
|
|
92
|
+
provider = OpenAITTSProvider(api_key="...")
|
|
93
|
+
session = provider.session(voice="nova", speed=1.0)
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
@abstractmethod
|
|
97
|
+
def session(self, **config: Any) -> TTSSession:
|
|
98
|
+
"""Create a new synthesis session with the given configuration.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
**config: Provider-specific configuration (voice, speed, etc.).
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
A new TTSSession configured with the given parameters.
|
|
105
|
+
"""
|
|
106
|
+
...
|
anyvoice/log.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Logging configuration for anyvoice."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
LogLevel = int | str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_logger(name: str, log_level: LogLevel | None = None) -> logging.Logger:
|
|
12
|
+
"""Get a logger for the given name.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
name: The name of the logger.
|
|
16
|
+
Will be prefixed with 'anyvoice'
|
|
17
|
+
log_level: The logging level to set for the logger
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
A logger instance
|
|
21
|
+
"""
|
|
22
|
+
logger = logging.getLogger(f"anyvoice.{name}")
|
|
23
|
+
if log_level is not None:
|
|
24
|
+
logger.setLevel(log_level)
|
|
25
|
+
return logger
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""Edge TTS provider implementation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Self
|
|
6
|
+
|
|
7
|
+
from anyvoice.base import TTSProvider, TTSSession
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from collections.abc import AsyncIterator
|
|
12
|
+
from types import TracebackType
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class EdgeTTSSession(TTSSession):
|
|
16
|
+
"""TTS session using Microsoft Edge's TTS service.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
voice: Voice name (e.g., "en-US-AriaNeural").
|
|
20
|
+
rate: Speaking rate adjustment (e.g., "+25%", "-10%").
|
|
21
|
+
volume: Volume adjustment (e.g., "+10%", "-20%").
|
|
22
|
+
pitch: Pitch adjustment in Hz (e.g., "+10Hz", "-5Hz").
|
|
23
|
+
sample_rate: Target sample rate for decoded audio.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
voice: str = "en-US-AriaNeural",
|
|
30
|
+
rate: str = "+0%",
|
|
31
|
+
volume: str = "+0%",
|
|
32
|
+
pitch: str = "+0Hz",
|
|
33
|
+
sample_rate: int = 24000,
|
|
34
|
+
) -> None:
|
|
35
|
+
self._voice = voice
|
|
36
|
+
self._rate = rate
|
|
37
|
+
self._volume = volume
|
|
38
|
+
self._pitch = pitch
|
|
39
|
+
self._sample_rate = sample_rate
|
|
40
|
+
|
|
41
|
+
async def synthesize(self, text: str) -> AsyncIterator[bytes]:
|
|
42
|
+
"""Synthesize text to PCM audio using Edge TTS.
|
|
43
|
+
|
|
44
|
+
Edge TTS returns MP3 which is decoded to PCM via miniaudio.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
text: Text to synthesize.
|
|
48
|
+
|
|
49
|
+
Yields:
|
|
50
|
+
PCM audio chunks (16-bit signed, mono).
|
|
51
|
+
"""
|
|
52
|
+
import edge_tts
|
|
53
|
+
import miniaudio # type: ignore[import-untyped]
|
|
54
|
+
|
|
55
|
+
if not text.strip():
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
communicate = edge_tts.Communicate(
|
|
59
|
+
text,
|
|
60
|
+
voice=self._voice,
|
|
61
|
+
rate=self._rate,
|
|
62
|
+
volume=self._volume,
|
|
63
|
+
pitch=self._pitch,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Collect MP3 chunks
|
|
67
|
+
mp3_data = bytearray()
|
|
68
|
+
async for chunk in communicate.stream():
|
|
69
|
+
if chunk["type"] == "audio":
|
|
70
|
+
assert "data" in chunk
|
|
71
|
+
mp3_data.extend(chunk["data"])
|
|
72
|
+
|
|
73
|
+
if mp3_data:
|
|
74
|
+
# Decode MP3 to mono 16-bit PCM at target sample rate
|
|
75
|
+
decoded = miniaudio.decode(
|
|
76
|
+
bytes(mp3_data),
|
|
77
|
+
output_format=miniaudio.SampleFormat.SIGNED16,
|
|
78
|
+
nchannels=1,
|
|
79
|
+
sample_rate=self._sample_rate,
|
|
80
|
+
)
|
|
81
|
+
yield decoded.samples.tobytes()
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class EdgeTTSProvider(TTSProvider):
|
|
85
|
+
"""TTS provider using Microsoft Edge's free TTS service.
|
|
86
|
+
|
|
87
|
+
Uses edge-tts library to access Microsoft's neural TTS voices.
|
|
88
|
+
No API key required.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
default_voice: Default voice name. Defaults to "en-US-AriaNeural".
|
|
92
|
+
sample_rate: Target sample rate for audio output. Defaults to 24000.
|
|
93
|
+
|
|
94
|
+
Example:
|
|
95
|
+
provider = EdgeTTSProvider()
|
|
96
|
+
session = provider.session(voice="en-GB-SoniaNeural", rate="+10%")
|
|
97
|
+
|
|
98
|
+
async with TTSStream(session, sink=SoundDeviceSink()) as tts:
|
|
99
|
+
await tts.feed("Hello world!")
|
|
100
|
+
|
|
101
|
+
Note:
|
|
102
|
+
Use `edge-tts --list-voices` to see all available voices.
|
|
103
|
+
Voice format: {locale}-{Name}Neural (e.g., en-US-AriaNeural)
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
def __init__(
|
|
107
|
+
self,
|
|
108
|
+
*,
|
|
109
|
+
default_voice: str = "en-US-AriaNeural",
|
|
110
|
+
sample_rate: int = 24000,
|
|
111
|
+
) -> None:
|
|
112
|
+
self._default_voice = default_voice
|
|
113
|
+
self._sample_rate = sample_rate
|
|
114
|
+
|
|
115
|
+
async def __aenter__(self) -> Self:
|
|
116
|
+
"""Enter provider context (no-op for Edge TTS)."""
|
|
117
|
+
return self
|
|
118
|
+
|
|
119
|
+
async def __aexit__(
|
|
120
|
+
self,
|
|
121
|
+
exc_type: type[BaseException] | None,
|
|
122
|
+
exc_val: BaseException | None,
|
|
123
|
+
exc_tb: TracebackType | None,
|
|
124
|
+
) -> None:
|
|
125
|
+
"""Exit provider context (no-op for Edge TTS)."""
|
|
126
|
+
|
|
127
|
+
def session(
|
|
128
|
+
self,
|
|
129
|
+
*,
|
|
130
|
+
voice: str | None = None,
|
|
131
|
+
rate: str = "+0%",
|
|
132
|
+
volume: str = "+0%",
|
|
133
|
+
pitch: str = "+0Hz",
|
|
134
|
+
sample_rate: int | None = None,
|
|
135
|
+
**_: Any,
|
|
136
|
+
) -> EdgeTTSSession:
|
|
137
|
+
"""Create a new Edge TTS session.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
voice: Voice name. Defaults to provider's default voice.
|
|
141
|
+
rate: Speaking rate adjustment (e.g., "+25%", "-10%").
|
|
142
|
+
volume: Volume adjustment (e.g., "+10%", "-20%").
|
|
143
|
+
pitch: Pitch adjustment in Hz (e.g., "+10Hz", "-5Hz").
|
|
144
|
+
sample_rate: Target sample rate. Defaults to provider's sample rate.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Configured Edge TTS session.
|
|
148
|
+
"""
|
|
149
|
+
return EdgeTTSSession(
|
|
150
|
+
voice=voice or self._default_voice,
|
|
151
|
+
rate=rate,
|
|
152
|
+
volume=volume,
|
|
153
|
+
pitch=pitch,
|
|
154
|
+
sample_rate=sample_rate or self._sample_rate,
|
|
155
|
+
)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""OpenAI TTS provider implementation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Literal, Self
|
|
6
|
+
|
|
7
|
+
from anyvoice.base import TTSProvider, TTSSession
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from collections.abc import AsyncIterator
|
|
12
|
+
from types import TracebackType
|
|
13
|
+
|
|
14
|
+
from openai import AsyncOpenAI
|
|
15
|
+
|
|
16
|
+
TTSModel = Literal["tts-1", "tts-1-hd"]
|
|
17
|
+
TTSVoice = Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class OpenAITTSSession(TTSSession):
|
|
21
|
+
"""TTS session using OpenAI's streaming API.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
client: OpenAI async client.
|
|
25
|
+
model: TTS model to use.
|
|
26
|
+
voice: Voice for synthesis.
|
|
27
|
+
speed: Speech speed (0.25 to 4.0).
|
|
28
|
+
chunk_size: Size of audio chunks to yield.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
client: AsyncOpenAI,
|
|
34
|
+
*,
|
|
35
|
+
model: TTSModel = "tts-1",
|
|
36
|
+
voice: TTSVoice = "alloy",
|
|
37
|
+
speed: float = 1.0,
|
|
38
|
+
chunk_size: int = 1024,
|
|
39
|
+
) -> None:
|
|
40
|
+
self._client = client
|
|
41
|
+
self._model = model
|
|
42
|
+
self._voice = voice
|
|
43
|
+
self._speed = speed
|
|
44
|
+
self._chunk_size = chunk_size
|
|
45
|
+
|
|
46
|
+
async def synthesize(self, text: str) -> AsyncIterator[bytes]:
|
|
47
|
+
"""Synthesize text to PCM audio using OpenAI's streaming API.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
text: Text to synthesize.
|
|
51
|
+
|
|
52
|
+
Yields:
|
|
53
|
+
PCM audio chunks (16-bit signed, mono, 24kHz).
|
|
54
|
+
"""
|
|
55
|
+
if not text.strip():
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
async with self._client.audio.speech.with_streaming_response.create(
|
|
59
|
+
model=self._model,
|
|
60
|
+
voice=self._voice,
|
|
61
|
+
input=text,
|
|
62
|
+
response_format="pcm",
|
|
63
|
+
speed=self._speed,
|
|
64
|
+
) as response:
|
|
65
|
+
async for chunk in response.iter_bytes(chunk_size=self._chunk_size):
|
|
66
|
+
yield chunk
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class OpenAITTSProvider(TTSProvider):
|
|
70
|
+
"""TTS provider using OpenAI's Text-to-Speech API.
|
|
71
|
+
|
|
72
|
+
Provides high-quality neural TTS with streaming support.
|
|
73
|
+
Requires an OpenAI API key.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
api_key: OpenAI API key. If not provided, uses OPENAI_API_KEY env var.
|
|
77
|
+
base_url: Optional custom API base URL.
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
provider = OpenAITTSProvider(api_key="sk-...")
|
|
81
|
+
session = provider.session(voice="nova", speed=1.0)
|
|
82
|
+
|
|
83
|
+
async with TTSStream(session, sink=SoundDeviceSink()) as tts:
|
|
84
|
+
await tts.feed("Hello world!")
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
def __init__(
|
|
88
|
+
self,
|
|
89
|
+
*,
|
|
90
|
+
api_key: str | None = None,
|
|
91
|
+
base_url: str | None = None,
|
|
92
|
+
) -> None:
|
|
93
|
+
self._api_key = api_key
|
|
94
|
+
self._base_url = base_url
|
|
95
|
+
self._client: AsyncOpenAI | None = None
|
|
96
|
+
|
|
97
|
+
async def __aenter__(self) -> Self:
|
|
98
|
+
"""Initialize the OpenAI client."""
|
|
99
|
+
from openai import AsyncOpenAI
|
|
100
|
+
|
|
101
|
+
self._client = AsyncOpenAI(api_key=self._api_key, base_url=self._base_url)
|
|
102
|
+
return self
|
|
103
|
+
|
|
104
|
+
async def __aexit__(
|
|
105
|
+
self,
|
|
106
|
+
exc_type: type[BaseException] | None,
|
|
107
|
+
exc_val: BaseException | None,
|
|
108
|
+
exc_tb: TracebackType | None,
|
|
109
|
+
) -> None:
|
|
110
|
+
"""Close the OpenAI client."""
|
|
111
|
+
if self._client is not None:
|
|
112
|
+
await self._client.close()
|
|
113
|
+
self._client = None
|
|
114
|
+
|
|
115
|
+
def _get_client(self) -> AsyncOpenAI:
|
|
116
|
+
"""Get the OpenAI client, initializing lazily if needed."""
|
|
117
|
+
if self._client is None:
|
|
118
|
+
from openai import AsyncOpenAI
|
|
119
|
+
|
|
120
|
+
self._client = AsyncOpenAI(api_key=self._api_key, base_url=self._base_url)
|
|
121
|
+
return self._client
|
|
122
|
+
|
|
123
|
+
def session(
|
|
124
|
+
self,
|
|
125
|
+
*,
|
|
126
|
+
model: TTSModel = "tts-1",
|
|
127
|
+
voice: TTSVoice = "alloy",
|
|
128
|
+
speed: float = 1.0,
|
|
129
|
+
chunk_size: int = 1024,
|
|
130
|
+
**_: Any,
|
|
131
|
+
) -> OpenAITTSSession:
|
|
132
|
+
"""Create a new OpenAI TTS session.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
model: TTS model ("tts-1" for speed, "tts-1-hd" for quality).
|
|
136
|
+
voice: Voice to use (alloy, echo, fable, onyx, nova, shimmer).
|
|
137
|
+
speed: Speech speed from 0.25 to 4.0. Defaults to 1.0.
|
|
138
|
+
chunk_size: Size of audio chunks in bytes. Defaults to 1024.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Configured OpenAI TTS session.
|
|
142
|
+
"""
|
|
143
|
+
return OpenAITTSSession(
|
|
144
|
+
self._get_client(),
|
|
145
|
+
model=model,
|
|
146
|
+
voice=voice,
|
|
147
|
+
speed=speed,
|
|
148
|
+
chunk_size=chunk_size,
|
|
149
|
+
)
|
anyvoice/py.typed
ADDED
|
File without changes
|
anyvoice/sinks.py
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""Audio sink implementations for TTS output."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Self
|
|
7
|
+
|
|
8
|
+
from anyvoice.base import AudioSink
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import Awaitable, Callable
|
|
13
|
+
import os
|
|
14
|
+
from types import TracebackType
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SoundDeviceSink(AudioSink):
|
|
18
|
+
"""Audio sink that plays PCM audio through the system speakers.
|
|
19
|
+
|
|
20
|
+
Uses sounddevice for real-time audio playback.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
sample_rate: Audio sample rate in Hz. Defaults to 24000.
|
|
24
|
+
channels: Number of audio channels. Defaults to 1 (mono).
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
sample_rate: int = 24000,
|
|
31
|
+
channels: int = 1,
|
|
32
|
+
) -> None:
|
|
33
|
+
self._sample_rate = sample_rate
|
|
34
|
+
self._channels = channels
|
|
35
|
+
self._stream: Any = None
|
|
36
|
+
|
|
37
|
+
async def __aenter__(self) -> Self:
|
|
38
|
+
"""Start the audio output stream."""
|
|
39
|
+
import sounddevice as sd # type: ignore[import-untyped]
|
|
40
|
+
|
|
41
|
+
self._stream = sd.RawOutputStream(
|
|
42
|
+
samplerate=self._sample_rate,
|
|
43
|
+
channels=self._channels,
|
|
44
|
+
dtype="int16",
|
|
45
|
+
)
|
|
46
|
+
self._stream.start()
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
async def __aexit__(
|
|
50
|
+
self,
|
|
51
|
+
exc_type: type[BaseException] | None,
|
|
52
|
+
exc_val: BaseException | None,
|
|
53
|
+
exc_tb: TracebackType | None,
|
|
54
|
+
) -> None:
|
|
55
|
+
"""Stop and close the audio output stream."""
|
|
56
|
+
if self._stream is not None:
|
|
57
|
+
self._stream.stop()
|
|
58
|
+
self._stream.close()
|
|
59
|
+
self._stream = None
|
|
60
|
+
|
|
61
|
+
async def write(self, chunk: bytes) -> None:
|
|
62
|
+
"""Write audio chunk to the output stream.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
chunk: PCM audio data to play.
|
|
66
|
+
"""
|
|
67
|
+
if self._stream is not None and chunk:
|
|
68
|
+
# Run blocking write in executor to not block async loop
|
|
69
|
+
loop = asyncio.get_running_loop()
|
|
70
|
+
await loop.run_in_executor(None, self._stream.write, chunk)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class FileSink(AudioSink):
|
|
74
|
+
"""Audio sink that writes PCM audio to a WAV file.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
path: Path to the output WAV file.
|
|
78
|
+
sample_rate: Audio sample rate in Hz. Defaults to 24000.
|
|
79
|
+
channels: Number of audio channels. Defaults to 1 (mono).
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
def __init__(
|
|
83
|
+
self,
|
|
84
|
+
path: str | os.PathLike[str],
|
|
85
|
+
*,
|
|
86
|
+
sample_rate: int = 24000,
|
|
87
|
+
channels: int = 1,
|
|
88
|
+
) -> None:
|
|
89
|
+
self._path = path
|
|
90
|
+
self._sample_rate = sample_rate
|
|
91
|
+
self._channels = channels
|
|
92
|
+
self._chunks: list[bytes] = []
|
|
93
|
+
|
|
94
|
+
async def __aenter__(self) -> Self:
|
|
95
|
+
"""Prepare for receiving audio."""
|
|
96
|
+
self._chunks = []
|
|
97
|
+
return self
|
|
98
|
+
|
|
99
|
+
async def __aexit__(
|
|
100
|
+
self,
|
|
101
|
+
exc_type: type[BaseException] | None,
|
|
102
|
+
exc_val: BaseException | None,
|
|
103
|
+
exc_tb: TracebackType | None,
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Write collected audio to WAV file."""
|
|
106
|
+
import wave
|
|
107
|
+
|
|
108
|
+
if not self._chunks:
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
audio_data = b"".join(self._chunks)
|
|
112
|
+
|
|
113
|
+
with wave.open(str(self._path), "wb") as wf:
|
|
114
|
+
wf.setnchannels(self._channels)
|
|
115
|
+
wf.setsampwidth(2) # 16-bit = 2 bytes
|
|
116
|
+
wf.setframerate(self._sample_rate)
|
|
117
|
+
wf.writeframes(audio_data)
|
|
118
|
+
|
|
119
|
+
self._chunks = []
|
|
120
|
+
|
|
121
|
+
async def write(self, chunk: bytes) -> None:
|
|
122
|
+
"""Buffer audio chunk for later writing.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
chunk: PCM audio data to save.
|
|
126
|
+
"""
|
|
127
|
+
if chunk:
|
|
128
|
+
self._chunks.append(chunk)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class CallbackSink(AudioSink):
|
|
132
|
+
"""Audio sink that passes audio chunks to a user-provided callback.
|
|
133
|
+
|
|
134
|
+
Useful for custom audio processing, streaming, or integration
|
|
135
|
+
with other systems.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
callback: Async or sync callable that receives audio chunks.
|
|
139
|
+
on_close: Optional callback invoked when sink closes.
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
def __init__(
|
|
143
|
+
self,
|
|
144
|
+
callback: Callable[[bytes], Awaitable[None]] | Callable[[bytes], None],
|
|
145
|
+
*,
|
|
146
|
+
on_close: Callable[[], Awaitable[None]] | Callable[[], None] | None = None,
|
|
147
|
+
) -> None:
|
|
148
|
+
self._callback = callback
|
|
149
|
+
self._on_close = on_close
|
|
150
|
+
|
|
151
|
+
async def __aexit__(
|
|
152
|
+
self,
|
|
153
|
+
exc_type: type[BaseException] | None,
|
|
154
|
+
exc_val: BaseException | None,
|
|
155
|
+
exc_tb: TracebackType | None,
|
|
156
|
+
) -> None:
|
|
157
|
+
"""Invoke close callback if provided."""
|
|
158
|
+
if self._on_close is not None:
|
|
159
|
+
result = self._on_close()
|
|
160
|
+
if asyncio.iscoroutine(result):
|
|
161
|
+
await result
|
|
162
|
+
|
|
163
|
+
async def write(self, chunk: bytes) -> None:
|
|
164
|
+
"""Pass audio chunk to the callback.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
chunk: PCM audio data.
|
|
168
|
+
"""
|
|
169
|
+
if chunk:
|
|
170
|
+
result = self._callback(chunk)
|
|
171
|
+
if asyncio.iscoroutine(result):
|
|
172
|
+
await result
|
anyvoice/stream.py
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"""TTSStream orchestrator for streaming TTS with buffering and modes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import contextlib
|
|
7
|
+
from typing import TYPE_CHECKING, Literal, Self
|
|
8
|
+
|
|
9
|
+
from anyvoice.sinks import SoundDeviceSink
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from types import TracebackType
|
|
14
|
+
|
|
15
|
+
from anyvoice.base import AudioSink, TTSSession
|
|
16
|
+
|
|
17
|
+
TTSMode = Literal["sync_sentence", "sync_run", "async_queue", "async_cancel"]
|
|
18
|
+
"""TTS synchronization modes.
|
|
19
|
+
|
|
20
|
+
- sync_sentence: Wait for each sentence's audio before continuing (slowest, most synchronized)
|
|
21
|
+
- sync_run: Stream fast, wait for all audio at run end (default)
|
|
22
|
+
- async_queue: Stream fast, audio plays in background, multiple runs queue up
|
|
23
|
+
- async_cancel: Stream fast, audio plays in background, new run cancels previous audio
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TTSStream:
|
|
28
|
+
"""Orchestrator for streaming TTS with sentence buffering and playback.
|
|
29
|
+
|
|
30
|
+
Coordinates a TTS session with an audio sink, handling:
|
|
31
|
+
- Text buffering and sentence boundary detection
|
|
32
|
+
- Synthesis scheduling (sync vs async modes)
|
|
33
|
+
- Audio playback coordination
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
session: TTS session for synthesis.
|
|
37
|
+
sink: Audio sink for output. Defaults to SoundDeviceSink.
|
|
38
|
+
mode: Synchronization mode. Defaults to "sync_run".
|
|
39
|
+
min_text_length: Minimum characters before synthesizing. Defaults to 20.
|
|
40
|
+
sentence_terminators: Characters that end sentences.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
provider = OpenAITTSProvider(api_key="...")
|
|
44
|
+
session = provider.session(voice="nova")
|
|
45
|
+
|
|
46
|
+
async with TTSStream(session) as tts:
|
|
47
|
+
await tts.feed("Hello ")
|
|
48
|
+
await tts.feed("world! ")
|
|
49
|
+
await tts.feed("How are you?")
|
|
50
|
+
# Audio plays and completes before exiting
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
session: TTSSession,
|
|
56
|
+
*,
|
|
57
|
+
sink: AudioSink | None = None,
|
|
58
|
+
mode: TTSMode = "sync_run",
|
|
59
|
+
min_text_length: int = 20,
|
|
60
|
+
sentence_terminators: frozenset[str] | None = None,
|
|
61
|
+
) -> None:
|
|
62
|
+
self._session = session
|
|
63
|
+
self._sink = sink
|
|
64
|
+
self._mode = mode
|
|
65
|
+
self._min_text_length = min_text_length
|
|
66
|
+
self._sentence_terminators = sentence_terminators or frozenset({".", "!", "?", "\n"})
|
|
67
|
+
|
|
68
|
+
# State
|
|
69
|
+
self._text_buffer = ""
|
|
70
|
+
self._sentence_queue: asyncio.Queue[str | None] = asyncio.Queue()
|
|
71
|
+
self._synthesis_task: asyncio.Task[None] | None = None
|
|
72
|
+
self._active = False
|
|
73
|
+
|
|
74
|
+
async def __aenter__(self) -> Self:
|
|
75
|
+
"""Enter the stream context, prepare session and sink."""
|
|
76
|
+
# Initialize sink (default to SoundDeviceSink if not provided)
|
|
77
|
+
if self._sink is None:
|
|
78
|
+
self._sink = SoundDeviceSink()
|
|
79
|
+
|
|
80
|
+
await self._session.__aenter__()
|
|
81
|
+
await self._sink.__aenter__()
|
|
82
|
+
self._active = True
|
|
83
|
+
return self
|
|
84
|
+
|
|
85
|
+
async def __aexit__(
|
|
86
|
+
self,
|
|
87
|
+
exc_type: type[BaseException] | None,
|
|
88
|
+
exc_val: BaseException | None,
|
|
89
|
+
exc_tb: TracebackType | None,
|
|
90
|
+
) -> None:
|
|
91
|
+
"""Exit the stream context, finalize audio and cleanup."""
|
|
92
|
+
try:
|
|
93
|
+
# Process any remaining text in buffer
|
|
94
|
+
if self._text_buffer.strip():
|
|
95
|
+
if self._mode == "sync_sentence":
|
|
96
|
+
await self._synthesize_and_play(self._text_buffer.strip())
|
|
97
|
+
else:
|
|
98
|
+
self._schedule_synthesis(self._text_buffer.strip())
|
|
99
|
+
self._text_buffer = ""
|
|
100
|
+
|
|
101
|
+
# For sync modes, wait for everything to finish
|
|
102
|
+
if self._mode in ("sync_sentence", "sync_run"):
|
|
103
|
+
await self._wait_for_completion()
|
|
104
|
+
finally:
|
|
105
|
+
self._active = False
|
|
106
|
+
await self._session.__aexit__(exc_type, exc_val, exc_tb)
|
|
107
|
+
if self._sink is not None:
|
|
108
|
+
await self._sink.__aexit__(exc_type, exc_val, exc_tb)
|
|
109
|
+
|
|
110
|
+
async def feed(self, text: str) -> None:
|
|
111
|
+
"""Feed text to the TTS stream.
|
|
112
|
+
|
|
113
|
+
Text is buffered until sentence boundaries are detected,
|
|
114
|
+
then synthesized according to the configured mode.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
text: Text chunk to add to the stream.
|
|
118
|
+
"""
|
|
119
|
+
if not self._active:
|
|
120
|
+
msg = "TTSStream must be used as async context manager"
|
|
121
|
+
raise RuntimeError(msg)
|
|
122
|
+
|
|
123
|
+
self._text_buffer += text
|
|
124
|
+
|
|
125
|
+
# Check for sentence boundaries
|
|
126
|
+
if any(term in self._text_buffer for term in self._sentence_terminators):
|
|
127
|
+
last_term = max(
|
|
128
|
+
(self._text_buffer.rfind(term) for term in self._sentence_terminators),
|
|
129
|
+
default=-1,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if last_term > 0 and last_term >= self._min_text_length:
|
|
133
|
+
sentence = self._text_buffer[: last_term + 1].strip()
|
|
134
|
+
self._text_buffer = self._text_buffer[last_term + 1 :]
|
|
135
|
+
|
|
136
|
+
if sentence:
|
|
137
|
+
if self._mode == "sync_sentence":
|
|
138
|
+
await self._synthesize_and_play(sentence)
|
|
139
|
+
else:
|
|
140
|
+
self._schedule_synthesis(sentence)
|
|
141
|
+
|
|
142
|
+
async def cancel(self) -> None:
|
|
143
|
+
"""Cancel all pending synthesis and playback."""
|
|
144
|
+
# Cancel synthesis worker
|
|
145
|
+
if self._synthesis_task and not self._synthesis_task.done():
|
|
146
|
+
self._synthesis_task.cancel()
|
|
147
|
+
with contextlib.suppress(asyncio.CancelledError):
|
|
148
|
+
await self._synthesis_task
|
|
149
|
+
self._synthesis_task = None
|
|
150
|
+
|
|
151
|
+
# Clear sentence queue
|
|
152
|
+
while not self._sentence_queue.empty():
|
|
153
|
+
with contextlib.suppress(asyncio.QueueEmpty):
|
|
154
|
+
self._sentence_queue.get_nowait()
|
|
155
|
+
|
|
156
|
+
# Reset text buffer
|
|
157
|
+
self._text_buffer = ""
|
|
158
|
+
|
|
159
|
+
async def _synthesize_and_play(self, text: str) -> None:
|
|
160
|
+
"""Synthesize text and play audio synchronously.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
text: Text to synthesize.
|
|
164
|
+
"""
|
|
165
|
+
if not text.strip() or self._sink is None:
|
|
166
|
+
return
|
|
167
|
+
|
|
168
|
+
async for chunk in self._session.synthesize(text):
|
|
169
|
+
await self._sink.write(chunk)
|
|
170
|
+
|
|
171
|
+
def _schedule_synthesis(self, text: str) -> None:
|
|
172
|
+
"""Queue text for background synthesis.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
text: Text to synthesize.
|
|
176
|
+
"""
|
|
177
|
+
# Start worker if not running
|
|
178
|
+
if self._synthesis_task is None or self._synthesis_task.done():
|
|
179
|
+
self._synthesis_task = asyncio.create_task(self._synthesis_worker())
|
|
180
|
+
|
|
181
|
+
# Queue the sentence
|
|
182
|
+
self._sentence_queue.put_nowait(text)
|
|
183
|
+
|
|
184
|
+
async def _synthesis_worker(self) -> None:
|
|
185
|
+
"""Background worker that processes sentences from the queue."""
|
|
186
|
+
while True:
|
|
187
|
+
sentence = await self._sentence_queue.get()
|
|
188
|
+
if sentence is None: # Shutdown signal
|
|
189
|
+
break
|
|
190
|
+
await self._synthesize_and_play(sentence)
|
|
191
|
+
|
|
192
|
+
async def _wait_for_completion(self) -> None:
|
|
193
|
+
"""Wait for all pending synthesis and playback to complete."""
|
|
194
|
+
if self._synthesis_task and not self._synthesis_task.done():
|
|
195
|
+
# Signal shutdown and wait
|
|
196
|
+
await self._sentence_queue.put(None)
|
|
197
|
+
await self._synthesis_task
|
|
198
|
+
self._synthesis_task = None
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: anyvoice
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Common interface for streaming tts providers
|
|
5
|
+
Keywords:
|
|
6
|
+
Author: Philipp Temminghoff
|
|
7
|
+
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: Pydantic
|
|
12
|
+
Classifier: Framework :: Pydantic :: 2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Documentation
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Dist: pydantic
|
|
25
|
+
Requires-Dist: schemez
|
|
26
|
+
Requires-Dist: openai>=1.0.0 ; extra == 'openai'
|
|
27
|
+
Requires-Dist: sounddevice>=0.5.0 ; extra == 'openai'
|
|
28
|
+
Requires-Dist: numpy>=1.24.0 ; extra == 'openai'
|
|
29
|
+
Requires-Dist: edge-tts>=7.0.0 ; extra == 'tts-edge'
|
|
30
|
+
Requires-Dist: miniaudio>=1.60 ; extra == 'tts-edge'
|
|
31
|
+
Requires-Dist: sounddevice>=0.5.0 ; extra == 'tts-edge'
|
|
32
|
+
Requires-Python: >=3.13
|
|
33
|
+
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/anyvoice
|
|
34
|
+
Project-URL: Discussions, https://github.com/phil65/anyvoice/discussions
|
|
35
|
+
Project-URL: Documentation, https://phil65.github.io/anyvoice/
|
|
36
|
+
Project-URL: Issues, https://github.com/phil65/anyvoice/issues
|
|
37
|
+
Project-URL: Source, https://github.com/phil65/anyvoice
|
|
38
|
+
Provides-Extra: openai
|
|
39
|
+
Provides-Extra: tts-edge
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# AnyVoice
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/anyvoice/)
|
|
45
|
+
[](https://pypi.org/project/anyvoice/)
|
|
46
|
+
[](https://pypi.org/project/anyvoice/)
|
|
47
|
+
[](https://pypi.org/project/anyvoice/)
|
|
48
|
+
[](https://pypi.org/project/anyvoice/)
|
|
49
|
+
[](https://pypi.org/project/anyvoice/)
|
|
50
|
+
[](https://pypi.org/project/anyvoice/)
|
|
51
|
+
[](https://github.com/phil65/anyvoice/releases)
|
|
52
|
+
[](https://github.com/phil65/anyvoice/graphs/contributors)
|
|
53
|
+
[](https://github.com/phil65/anyvoice/discussions)
|
|
54
|
+
[](https://github.com/phil65/anyvoice/forks)
|
|
55
|
+
[](https://github.com/phil65/anyvoice/issues)
|
|
56
|
+
[](https://github.com/phil65/anyvoice/pulls)
|
|
57
|
+
[](https://github.com/phil65/anyvoice/watchers)
|
|
58
|
+
[](https://github.com/phil65/anyvoice/stars)
|
|
59
|
+
[](https://github.com/phil65/anyvoice)
|
|
60
|
+
[](https://github.com/phil65/anyvoice/commits)
|
|
61
|
+
[](https://github.com/phil65/anyvoice/releases)
|
|
62
|
+
[](https://github.com/phil65/anyvoice)
|
|
63
|
+
[](https://github.com/phil65/anyvoice)
|
|
64
|
+
[](https://codecov.io/gh/phil65/anyvoice/)
|
|
65
|
+
[](https://pyup.io/repos/github/phil65/anyvoice/)
|
|
66
|
+
|
|
67
|
+
[Read the documentation!](https://phil65.github.io/anyvoice/)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
anyvoice/__init__.py,sha256=LcJklcH0xYd0CdqgBarDAn7FTQItwknPIjYBUh1x3VM,1488
|
|
2
|
+
anyvoice/base.py,sha256=7AusPRwn2bVzztmWYFQoLFOriK0l012Y2ooPBWM76ac,2860
|
|
3
|
+
anyvoice/log.py,sha256=cpbTbGT4u2grRjd-TeL94TfLXUSUanuj5OYl0LjlYYg,576
|
|
4
|
+
anyvoice/providers/__init__.py,sha256=aFB40-oytc5eWDPuF65SDjqYED_XBdB8OGhbew0dHFo,197
|
|
5
|
+
anyvoice/providers/edge.py,sha256=JnkOB9ve3fFMu2l9MoQu--fCWxlONCiycNIQEXERtTQ,4573
|
|
6
|
+
anyvoice/providers/openai.py,sha256=N_kUVmWGDVdqRu8sEyOK69bgWdbXc_zjIHYfS3hmdi8,4303
|
|
7
|
+
anyvoice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
anyvoice/sinks.py,sha256=dVMl8dkhujtGjGLzsoJ1juCyIsq2v16vAGVpN4_QfyQ,4806
|
|
9
|
+
anyvoice/stream.py,sha256=vqzAg6CdcLULv4bK8qKVOGggHeBgVxaS8JVxAIeOaC0,7118
|
|
10
|
+
anyvoice-0.0.2.dist-info/licenses/LICENSE,sha256=AteGCH9r177TxxrOFEiOARrastASsf7yW6MQxlAHdwA,1078
|
|
11
|
+
anyvoice-0.0.2.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
12
|
+
anyvoice-0.0.2.dist-info/METADATA,sha256=yqujMzL-9lAHrB3VbMIXIgOgS4cXUAbmGxnqP_4dqzc,4339
|
|
13
|
+
anyvoice-0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Philipp Temminghoff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|