-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
substudy: Add more transcription prompt opts
You can now use: --example-text (vaguely related text) --expected-text (expected results of transcription, good for songs) Or you can pass neither, in which case the transcriber will do its best. This PR also adds test cases for the OpenAI-based features. The "poem" in fixtures was written by ChatGPT-4 and was voiced by their TTS.
- Loading branch information
Showing
10 changed files
with
280 additions
and
34 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dotenv import load_dotenv | ||
from openai import OpenAI | ||
|
||
load_dotenv() | ||
|
||
def text_to_speech(input_text, output_file): | ||
client = OpenAI() | ||
|
||
response = client.audio.speech.create( | ||
model="tts-1", | ||
voice="shimmer", | ||
input=input_text | ||
) | ||
|
||
response.stream_to_file(output_file) | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
if len(sys.argv) != 3: | ||
print("Usage: python tts.py <input_text> <output_mp3_file>") | ||
sys.exit(1) | ||
text_to_speech(sys.argv[1], sys.argv[2]) |
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
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,7 @@ | ||
0 | ||
00:00:00,000 --> 00:00:03,840 | ||
En el bosque se escucha un susurro, el viento entre los árboles murmuro. | ||
|
||
1 | ||
00:00:04,247 --> 00:00:08,580 | ||
Bajo su sombra, todo es puro, en su abrazo, el mundo se siente seguro. |
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,2 @@ | ||
En el bosque se escucha un susurro, el viento entre los árboles murmuro. | ||
Bajo su sombra, todo es puro, en su abrazo, el mundo se siente seguro. |
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
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
Oops, something went wrong.