-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2481417
commit a8caaef
Showing
6 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Simple API | ||
|
||
The Simple API provides an easy way to get started with SimpleTTS without worrying about model selection or configuration. It uses the Kokoro model by default. | ||
|
||
## Usage | ||
|
||
Import the `tts` function: | ||
|
||
```python | ||
from simpletts import tts | ||
``` | ||
|
||
Generate and save audio: | ||
|
||
```python | ||
tts("Hello world!").save("output.wav") | ||
``` | ||
|
||
That's all you need! The Simple API handles all the model initialization and configuration behind the scenes. | ||
|
||
## Example | ||
|
||
Here's a complete example showing natural text-to-speech generation: | ||
|
||
```python | ||
from simpletts import tts | ||
|
||
tts("Enter your text. Supports longform synthesis.").save("output.wav") | ||
``` | ||
|
||
The Simple API is great for basic use cases where you just want to convert text to speech without any special configuration. For more advanced usage like voice cloning or using different models, check out the [Models](models.md) documentation. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from simpletts import tts | ||
|
||
tts("This is a super simple T-T-S example! With just two lines of code, you can use Simple T-T-S to generate natural-sounding speech from text. By default, Simple T-T-S's simple A-P-I uses the Kokoro model.").save("output.wav") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def tts(text: str, **kwargs): | ||
from simpletts.simple import simpletts | ||
return simpletts(text, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Kokoro | ||
|
||
from simpletts.models.kokoro import Kokoro | ||
model = Kokoro(device="auto") | ||
|
||
def simpletts(text: str, **kwargs): | ||
audio, sr = model.longform(text, ref="af", **kwargs) | ||
|
||
class AudioData: | ||
def __init__(self, audio, sr): | ||
self.audio = audio | ||
self.sr = sr | ||
|
||
def save(self, path): | ||
import soundfile as sf | ||
sf.write(path, self.audio, self.sr) | ||
|
||
return AudioData(audio, sr) |