我试图通过python使用Amazon合成3600个字符。目前,我有以下几点:
from boto3 import client as polly_client
polly = polly_client('polly')
response = polly.start_speech_synthesis_task(Engine='neural',
OutputS3KeyPrefix= "InputAudio",
OutputS3BucketName='s3bucketname',
Text= open('script.txt', 'r').read(),
OutputFormat= 'mp3',
VoiceId= 'Amy'
)如何将此响应转换为计算机上的.mp3文件?我已经挣扎了一段时间了。谢谢
发布于 2022-08-29 22:23:22
您是正确的- synthesize_speech()被限制为3000个计费字符,而start_speech_synthesis_task()最多可以处理10万个可计费字符。
start_speech_synthesis_task()是异步,并将文件输出到亚马逊S3桶。来自文档
此操作需要语音合成所需的所有标准信息,以及用于存储合成任务输出的 S3 S3桶的名称。在启动异步合成任务后,SpeechSynthesisTask对象可用72小时。
因此,您的程序需要:
start_speech_synthesis_task()get_speech_synthesis_task()创建一个循环,每隔几秒钟检查一次输出https://stackoverflow.com/questions/73533742
复制相似问题