Skip to content

Commit

Permalink
Modifications with handling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rupin committed Oct 7, 2019
1 parent 47d4af3 commit 9e93140
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
Binary file added Row_5_56.0.wav
Binary file not shown.
Binary file added Row_6_82.0.wav
Binary file not shown.
Binary file added Row_7_93.0.wav
Binary file not shown.
11 changes: 4 additions & 7 deletions createAudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def convertTTS(engtext):
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(synthesis_input, voice, audio_config)


return response.audio_content

def createFileName(row, timeslot):
Expand Down Expand Up @@ -84,7 +82,7 @@ def generateAudio(myfile,pending_row=-1):
sys.exit(2)
else:

for row in range (1, 5):
for row in range (1, rowcount):
timeslot=sheet.cell_value(row, 0)
sentence=sheet.cell_value(row, 1)
createAudioFile(row,timeslot, sentence)
Expand All @@ -106,7 +104,7 @@ def combineFiles(inputxlsfilename, outputFileName):
combined_sounds = AudioSegment.silent(duration=1)
rowcount=sheet.nrows

for row in range (1, 5):
for row in range (1, rowcount):
timeslot=sheet.cell_value(row, 0)
sentence=sheet.cell_value(row, 1)
filename=createFileName(row, timeslot)
Expand Down Expand Up @@ -170,7 +168,7 @@ def printHelpMessage():
def main(argv):
inputfile = ''
outputfile = ''
specificRowToBeProcessed=False

rownum=0
operationType='GENERATE_AUDIO'
try:
Expand All @@ -187,7 +185,7 @@ def main(argv):
elif opt=="-o":
outputfile = arg
elif opt =='-r':
specificRowToBeProcessed=True

operationType='GENERATE_AUDIO_FOR_ROW'
rownum=int(arg)
elif opt=='-c':
Expand All @@ -200,7 +198,6 @@ def main(argv):
#print ('Output file is "', outputfile)
if(operationType=="GENERATE_AUDIO"):
generateAudio(inputfile)

elif(operationType=="COMBINE_AUDIO"):
combineFiles(inputfile,outputfile)
elif(operationType=='GENERATE_AUDIO_FOR_ROW'):
Expand Down
Binary file modified output.wav
Binary file not shown.

0 comments on commit 9e93140

Please sign in to comment.