SSML音量属性对输出音频没有影响
以下是ssml
<speak>
<prosody volume = "+0dB"> This is a sentence with volume 10 For GOOGLE. </prosody>
<s><prosody volume = "+6dB"> This is a sentence with volume 6 For GOOGLE. </prosody></s>
<s><prosody volume = "+24dB"> This is a sentence with volume +24 For GOOGLE. </prosody></s>
<s><prosody volume = "+48dB"> This is a sentence with volume +48 For GOOGLE.</prosody></s> <s><prosody volume = "+196dB"> This is a sentence with volume +196 For GOOGLE.</prosody></s>
</speak>
这是示例代码
String ssml = $"<speak><prosody volume = \"+0dB\"> This is a sentence with volume 10 For GOOGLE.</prosody>" +
$" <s><prosody volume = \"+6dB\"> This is a sentence with volume 6 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+24dB\"> This is a sentence with volume +24 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+48dB\"> This is a sentence with volume +48 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+196dB\"> This is a sentence with volume +196 For GOOGLE.</prosody></s>" +
$"</speak>";
Dubb(ssml);
public static void Dubb(string ssml)
{
var client = TextToSpeechClient.Create();
// The input to be synthesized, can be provided as text or SSML.
var input = new SynthesisInput
{
Ssml = ssml
};
// Build the voice request.
var voiceSelection = new VoiceSelectionParams
{
LanguageCode = "en-US",
SsmlGender = SsmlVoiceGender.Female
};
// Specify the type of audio file.
var audioConfig = new AudioConfig
{
AudioEncoding = AudioEncoding.Linear16
};
// Perform the text-to-speech request.
var response = client.SynthesizeSpeech(input, voiceSelection, audioConfig);
// Write the response to the output file.
using (var output = File.Create("output.wav"))
{
response.AudioContent.WriteTo(output);
}
}
我希望每行的音量都会增加,但不会增加。