-
I use gtts-cli installed with pipx. I have a spreadsheet with two columns, first column is a sentence number, second column contains sentences. Like this: For each sentence I want to produce separate audio file. Can you help me and tell me how to use gtts-cli to produce audio output files that as a name have number of the sentence, so that I know which file contains which sentence? It may be exported as csv. I know I need to use:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
To create a single file for each sentence ( import csv
from gtts import gTTS
# mport time # if you want to add pauses because you are worried
filename = 'my_sentences.csv' # name of the spreadsheet file in CSV format
with open(filename, 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
sentence_number, sentence = row
gTTS(sentence, lang='en', lang_check=False, slow=False).save(sentence_number+'.mp3')
# time.sleep(1) # wait 1 second if you are worried If you know how to code, you could also loop the command line you wrote using the BASH language. If you want to create a single file, I gave the code in my question #312. |
Beta Was this translation helpful? Give feedback.
To create a single file for each sentence (
01.mp3
,02.mp3
...), save your spreadsheet in CSV then run this Python script:If you know how to code, you could also loop the command line you wrote using the BASH language. If you want to create a single file, I gave…