Esempio n. 1
0
        private RequestBody GetRequestBody(string inputAudio, string gender)
        {
            InputAudioConfig inputAudioConfig = new InputAudioConfig();

            inputAudioConfig.audioEncoding   = InputAudioEncoding.Linear16;
            inputAudioConfig.sampleRateHertz = 16000;
            inputAudioConfig.languageCode    = "nl-NL";

            VoiceConfig voiceConfig = new VoiceConfig();

            voiceConfig.ssmlGender = gender;

            SynthesizeSpeechConfig synthesizeSpeechConfig = new SynthesizeSpeechConfig();

            synthesizeSpeechConfig.voice = voiceConfig;

            OutputAudioConfig outputAudioConfig = new OutputAudioConfig();

            outputAudioConfig.audioEncoding          = OutputAudioEncoding.Linear16;
            outputAudioConfig.synthesizeSpeechConfig = synthesizeSpeechConfig;

            QueryInput queryInput = new QueryInput();

            queryInput.audioConfig = inputAudioConfig;

            RequestBody requestBody = new RequestBody();

            requestBody.outputAudioConfig = outputAudioConfig;
            requestBody.queryInput        = queryInput;
            requestBody.inputAudio        = inputAudio;

            return(requestBody);
        }
Esempio n. 2
0
        private RequestBody GetRequestBody(string inputAudio, string gender)
        {
            InputAudioConfig inputAudioConfig = new InputAudioConfig
            {
                audioEncoding   = InputAudioEncoding.Linear16,
                sampleRateHertz = 16000,
                languageCode    = "nl-NL",
            };

            VoiceConfig voiceConfig = new VoiceConfig
            {
                ssmlGender = gender,
            };

            SynthesizeSpeechConfig synthesizeSpeechConfig = new SynthesizeSpeechConfig
            {
                voice = voiceConfig,
            };

            OutputAudioConfig outputAudioConfig = new OutputAudioConfig
            {
                audioEncoding          = OutputAudioEncoding.Linear16,
                synthesizeSpeechConfig = synthesizeSpeechConfig,
            };

            QueryInput queryInput = new QueryInput
            {
                audioConfig = inputAudioConfig,
            };

            RequestBody requestBody = new RequestBody
            {
                outputAudioConfig = outputAudioConfig,
                queryInput        = queryInput,
                inputAudio        = inputAudio,
            };

            return(requestBody);
        }