Ejemplo n.º 1
0
        /// <summary>
        /// Streams raw audio data and returns captured intent and entities
        /// </summary>
        /// <param name="witPipedStream">Audio stream</param>
        /// <param name="type">Type</param>
        /// <param name="encoding">Encoding</param>
        /// <param name="bits">Bits per sample</param>
        /// <param name="rate">Samples per second</param>
        /// <param name="order">Bytes order</param>
        /// <returns>Captured data</returns>
        public async Task <WitResponse> StreamRawAudio(WitPipedStream witPipedStream, string type, string encoding, int bits, int rate, ByteOrder order)
        {
            WitSpeechRequestTask witSpeechRequestTask = new WitSpeechRequestTask(accessToken, witPipedStream, type, encoding, bits, rate, order);

            string result = await witSpeechRequestTask.UploadAsync();

            if (result != null)
            {
                WitResponse witResponse = JsonConvert.DeserializeObject <WitResponse>(result);

                return(witResponse);
            }

            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Streams raw audio data and returns captured intent and entities
        /// </summary>
        /// <param name="witPipedStream">Audio stream</param>
        /// <param name="type">Type</param>
        /// <param name="encoding">Encoding</param>
        /// <param name="bits">Bits per sample</param>
        /// <param name="rate">Samples per second</param>
        /// <param name="order">Bytes order</param>
        /// <returns>Captured data</returns>
        public async Task<WitResponse> StreamRawAudio(WitPipedStream witPipedStream, string type, string encoding, int bits, int rate, ByteOrder order)
        {
            WitSpeechRequestTask witSpeechRequestTask = new WitSpeechRequestTask(accessToken, witPipedStream, type, encoding, bits, rate, order);

            string result = await witSpeechRequestTask.UploadAsync();

            if (result != null)
            {
                WitResponse witResponse = JsonConvert.DeserializeObject<WitResponse>(result);

                return witResponse;
            }

            return null;
        }