public static void Main(string[] args)
        {
            var speechLanguageInfos = CognitiveTranslatorService.GetSpeechLanguageInfo();
            var readOnlyCollection  = CognitiveTranslatorService.GetSpeechTextInfo();
            var speechTtsInfos      = CognitiveTranslatorService.GetSpeechTtsInfo();

            var service = new CognitiveTranslatorService(SUNSCRIPTION_KEY);

            //TODO: Modify Translate Language settings.
            service.InitializeTranslatorService("en", "ja", "ja-JP-Watanabe");
            service.OnOpen         += OnOpen;
            service.OnError        += OnError;
            service.OnRootMessage  += OnRootMessage;
            service.OnVoiceMessage += OnVoiceMessage;
            service.OnTextMessage  += OnTextMessage;

#if DEBUG
            service.LogLevel = LogLevel.Trace;
#endif

            service.StartStreaming();

            Thread.Sleep(1000);

            _thread = new Thread(() =>
            {
                //TODO: change file name.sampling rate-16Khz 16bit 1channel.
                using (var reader = new WaveFileReader("something.wav"))
                {
                    Thread.Sleep(1000);
                    var samplesL = new float[reader.Length / reader.BlockAlign];
                    for (var i = 0; i < samplesL.Length; i++)
                    {
                        var sample = reader.ReadNextSampleFrame();

                        var bytes = BitConverter.GetBytes(FloatToInt16(sample[0]));
                        service.AddSamples(bytes, 0, bytes.Length);
                    }
                    for (int i = 0; i < 32000; i++)
                    {
                        service.AddSamples(new byte[] { 0, 0 }, 0, 2);
                    }
                }
            });
            _thread.Start();

            _thread2 = new Thread(new ThreadStart(() =>
            {
                Console.ReadLine(); service.StopStreaming(); Thread.Sleep(1000); Environment.Exit(0);
            }));
            _thread2.Start();
            while (true)
            {
            }
        }
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            var service        = new CognitiveTranslatorService(SUBSCRIPTION_KEY, 1, 16000, 16);
            var speechTextInfo = await CognitiveTranslatorService.GetSpeechTextInfo();

            service.OnRootMessage  += OnRootMessage;
            service.OnVoiceMessage += OnVoiceMessage;
            service.OnTextMessage  += OnTextMessage;
            //TODO: Modify Translate Language settings.
            await service.Connect("en", "ja", "ja-JP-Watanabe");


            Task.Delay(1000);
            _task = new Task(async() =>
            {
                var currentInstalledLocation = ApplicationData.Current.LocalFolder.Path;
                //TODO: change file name.sampling rate-16Khz 16bit 1channel.
                var file = currentInstalledLocation + @"\something.wav";

                using (var waveStream = new FileStream(file, FileMode.Open))
                {
                    var reader = new RawSourceWaveStream(waveStream, new WaveFormat(16000, 16, 1));

                    var buffer    = new byte[reader.Length];
                    var bytesRead = reader.Read(buffer, 0, buffer.Length);

                    var samplesL = new float[bytesRead / reader.BlockAlign];

                    switch (reader.WaveFormat.BitsPerSample)
                    {
                    case 8:
                        for (var i = 0; i < samplesL.Length; i++)
                        {
                            samplesL[i] = (buffer[i * reader.BlockAlign] - 128) / 128f;
                        }
                        break;

                    case 16:
                        for (var i = 0; i < samplesL.Length; i++)
                        {
                            samplesL[i] = BitConverter.ToInt16(buffer, i * reader.BlockAlign) / 32768f;
                        }
                        break;

                    case 32:
                        for (var i = 0; i < samplesL.Length; i++)
                        {
                            samplesL[i] = BitConverter.ToSingle(buffer, i * reader.BlockAlign);
                        }
                        break;
                    }
                    var w = new byte[16000];
                    for (var i = 0; i < w.Length; i++)
                    {
                        w[i] = 0;
                    }
                    var data = 1000;
                    service.AddSamplingData(buffer, 0, 32000);
                    await Task.Delay(data);
                    service.AddSamplingData(buffer, 32000, 32000);
                    await Task.Delay(data);
                    service.AddSamplingData(buffer, 64000, 32000);
                    await Task.Delay(data);
                    service.AddSamplingData(buffer, 96000, buffer.Length - 96000);
                    await Task.Delay(data);
                    service.AddSamplingData(w, 0, w.Length);
                }
            });
            _task.Start();
        }