目前使用 AWS 服务通过 Polly 创建一个 PCM 音频文件并将其存储到 S3 存储桶中。该应用程序使用 AWS lambda 完成所有这些工作。
我正在使用“StartSpeechSynthesisTaskRequest”,它允许用户向 amazon Polly 创建一个请求,并将文件直接传送到用户选择的指定 S3 存储桶中。
我遇到的问题是,一旦运行代码,我最终会得到一个像这样的文件名:
“MY_FILE_NAME.a1f9999f-f00r-6h45-j2ks-pd7fcc9sfw77.pcm”
我想要的是:
“MY_FILE_NAME.pcm”
为什么会发生这种额外的事情?有人得到这个问题的答案吗?
我已经发布了下面的代码。
StartSpeechSynthesisTaskRequest startSpeechSynthesisRequest = new StartSpeechSynthesisTaskRequest()
// Required parameters
.withOutputFormat(PCM_FORMAT)
.withOutputS3BucketName(s3BucketName) <--- S3 bucket location/name
.withText(GREETING_FORMAT)
.withVoiceId(EMMA_VOICE_ID)
// Optional parameters
.withOutputS3KeyPrefix("MY_FILE_NAME") <--- my file desired name
.withEngine(NEURAL_ENGINE)
.withLanguageCode(ENGB_LANGUAGE_CODE)
.withSampleRate(SAMPLE_RATE)
.withTextType(SSML_TEXT_TYPE);
pollyClient.startSpeechSynthesisTask(startSpeechSynthesisRequest);
更新:
如果我打印“startSpeechSynthesisRequest”,在它使用所有参数构建后,它将完全按照我的需要打印“withOutputS3KeyPrefix”。polly 和 S3 存储桶之间出现了问题。