예제 #1
0
        public override async Task <TextRespone> Invork(VoiceRequest request)
        {
            var time = DateTime.Now;

            //AudioConvertor
            byte[] testSequence = request.VoiceData;

            using (RawSourceWaveStream reader = new RawSourceWaveStream(new MemoryStream(testSequence), new WaveFormat(16000, 1)))
                using (WaveStream convertedStream = WaveFormatConversionStream.CreatePcmStream(reader))
                {
                    request.VoiceData = convertedStream.ToByteArray();
                }
            var respone = await _googleSpeechService.Invork(request);

            Log.LogInformation(request.Id.Value, 0, this.GetType().ToString(), $"service end work in {(DateTime.Now - time).Milliseconds} ms");
            return(respone);
        }