]> wolfpit.net Git - hardware/bopit/.git/commitdiff
Integrated speech recognition master origin/HEAD origin/master
authormichael <michaelreeves808@gmail.com>
Sun, 18 Feb 2018 03:01:04 +0000 (17:01 -1000)
committermichael <michaelreeves808@gmail.com>
Sun, 18 Feb 2018 03:01:04 +0000 (17:01 -1000)
BopIt/App.config
BopIt/BopIt.csproj
BopIt/MainForm.Designer.cs
BopIt/MainForm.cs
BopIt/packages.config

index 731f6de6c291e303814b02808f34140fe560e8e4..896f669fb6fd21a44e92f107b72cd1cf2fe252e4 100644 (file)
@@ -1,6 +1,30 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
     </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.29.1.0" newVersion="1.29.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Google.Apis.Auth.PlatformServices" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.29.1.0" newVersion="1.29.1.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
 </configuration>
\ No newline at end of file
index 76d5aa03d470a361d0a7345b91afbcbd64cfb64d..00005c1d975f2bc4780121587be937dcc35ebdc3 100644 (file)
     <Reference Include="Accord.Video, Version=3.8.0.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
       <HintPath>..\packages\Accord.Video.3.8.0\lib\net46\Accord.Video.dll</HintPath>
     </Reference>
+    <Reference Include="Google.Api.CommonProtos, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Api.CommonProtos.1.1.0\lib\net45\Google.Api.CommonProtos.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Api.Gax, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Api.Gax.2.1.0\lib\net45\Google.Api.Gax.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Api.Gax.Grpc, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Api.Gax.Grpc.2.1.0\lib\net45\Google.Api.Gax.Grpc.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis, Version=1.29.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Apis.1.29.1\lib\net45\Google.Apis.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Auth, Version=1.29.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Apis.Auth.1.29.1\lib\net45\Google.Apis.Auth.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Auth.PlatformServices, Version=1.29.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Apis.Auth.1.29.1\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.Core, Version=1.29.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Apis.Core.1.29.1\lib\net45\Google.Apis.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Apis.PlatformServices, Version=1.29.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Apis.1.29.1\lib\net45\Google.Apis.PlatformServices.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Cloud.Speech.V1, Version=1.0.1.0, Culture=neutral, PublicKeyToken=185c282632e132a0, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Cloud.Speech.V1.1.0.1\lib\net45\Google.Cloud.Speech.V1.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.LongRunning, Version=1.0.0.0, Culture=neutral, PublicKeyToken=185c282632e132a0, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.LongRunning.1.0.0\lib\net45\Google.LongRunning.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="Grpc.Auth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
+      <HintPath>..\packages\Grpc.Auth.1.6.1\lib\net45\Grpc.Auth.dll</HintPath>
+    </Reference>
+    <Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
+      <HintPath>..\packages\Grpc.Core.1.6.1\lib\net45\Grpc.Core.dll</HintPath>
+    </Reference>
     <Reference Include="NAudio, Version=1.8.4.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\NAudio.1.8.4\lib\net35\NAudio.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net46\System.Interactive.Async.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Net.Http.4.3.1\lib\net46\System.Net.Http.dll</HintPath>
+    </Reference>
     <Reference Include="System.Numerics" />
     <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
+    </Reference>
     <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data" />
     <Reference Include="System.Deployment" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
   </ItemGroup>
       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
     </PropertyGroup>
     <Error Condition="!Exists('..\packages\Accord.3.8.0\build\Accord.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Accord.3.8.0\build\Accord.targets'))" />
+    <Error Condition="!Exists('..\packages\Grpc.Core.1.6.1\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.6.1\build\net45\Grpc.Core.targets'))" />
   </Target>
+  <Import Project="..\packages\Grpc.Core.1.6.1\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.6.1\build\net45\Grpc.Core.targets')" />
 </Project>
\ No newline at end of file
index 70e01f8175803c99bc678a8f8041218cb2beb7a0..c330424e30c82db1a02dd47f4562ac2a95b2de0d 100644 (file)
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
-            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
             this.progressBar = new System.Windows.Forms.ProgressBar();
             this.waveform = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+            this.textBox1 = new System.Windows.Forms.TextBox();
             ((System.ComponentModel.ISupportInitialize)(this.waveform)).BeginInit();
             this.tableLayoutPanel1.SuspendLayout();
             this.SuspendLayout();
             this.progressBar.MarqueeAnimationSpeed = 1;
             this.progressBar.Maximum = 50;
             this.progressBar.Name = "progressBar";
-            this.progressBar.Size = new System.Drawing.Size(1297, 96);
+            this.progressBar.Size = new System.Drawing.Size(1297, 45);
             this.progressBar.Step = 1;
             this.progressBar.TabIndex = 0;
             // 
             // waveform
             // 
-            chartArea1.AxisX.Interval = 2D;
-            chartArea1.AxisX.LabelStyle.Enabled = false;
-            chartArea1.AxisX.LineColor = System.Drawing.Color.DarkGray;
-            chartArea1.AxisX.MajorGrid.Enabled = false;
-            chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
-            chartArea1.AxisX.MajorTickMark.Enabled = false;
-            chartArea1.AxisY.Interval = 5D;
-            chartArea1.AxisY.LabelStyle.Enabled = false;
-            chartArea1.AxisY.LineColor = System.Drawing.Color.DarkGray;
-            chartArea1.AxisY.MajorGrid.Enabled = false;
-            chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
-            chartArea1.AxisY.MajorTickMark.Enabled = false;
-            chartArea1.AxisY.Maximum = 700D;
-            chartArea1.AxisY.Minimum = -700D;
-            chartArea1.BorderColor = System.Drawing.Color.LightGray;
-            chartArea1.Name = "ChartArea1";
-            this.waveform.ChartAreas.Add(chartArea1);
+            chartArea2.AxisX.Interval = 2D;
+            chartArea2.AxisX.LabelStyle.Enabled = false;
+            chartArea2.AxisX.LineColor = System.Drawing.Color.DarkGray;
+            chartArea2.AxisX.MajorGrid.Enabled = false;
+            chartArea2.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
+            chartArea2.AxisX.MajorTickMark.Enabled = false;
+            chartArea2.AxisY.Interval = 5D;
+            chartArea2.AxisY.LabelStyle.Enabled = false;
+            chartArea2.AxisY.LineColor = System.Drawing.Color.DarkGray;
+            chartArea2.AxisY.MajorGrid.Enabled = false;
+            chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
+            chartArea2.AxisY.MajorTickMark.Enabled = false;
+            chartArea2.AxisY.Maximum = 700D;
+            chartArea2.AxisY.Minimum = -700D;
+            chartArea2.BorderColor = System.Drawing.Color.LightGray;
+            chartArea2.Name = "ChartArea1";
+            this.waveform.ChartAreas.Add(chartArea2);
             this.waveform.Dock = System.Windows.Forms.DockStyle.Fill;
-            legend1.Enabled = false;
-            legend1.Name = "Legend1";
-            this.waveform.Legends.Add(legend1);
-            this.waveform.Location = new System.Drawing.Point(3, 105);
+            legend2.Enabled = false;
+            legend2.Name = "Legend1";
+            this.waveform.Legends.Add(legend2);
+            this.waveform.Location = new System.Drawing.Point(3, 54);
             this.waveform.Name = "waveform";
-            series1.ChartArea = "ChartArea1";
-            series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series1.Legend = "Legend1";
-            series1.Name = "Series1";
-            this.waveform.Series.Add(series1);
-            this.waveform.Size = new System.Drawing.Size(1297, 406);
+            series2.ChartArea = "ChartArea1";
+            series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series2.Legend = "Legend1";
+            series2.Name = "Series1";
+            this.waveform.Series.Add(series2);
+            this.waveform.Size = new System.Drawing.Size(1297, 353);
             this.waveform.TabIndex = 1;
             this.waveform.Text = "chart1";
             // 
             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
             this.tableLayoutPanel1.Controls.Add(this.progressBar, 0, 0);
             this.tableLayoutPanel1.Controls.Add(this.waveform, 0, 1);
+            this.tableLayoutPanel1.Controls.Add(this.textBox1, 0, 2);
             this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
             this.tableLayoutPanel1.Name = "tableLayoutPanel1";
-            this.tableLayoutPanel1.RowCount = 2;
+            this.tableLayoutPanel1.RowCount = 3;
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F));
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
-            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
             this.tableLayoutPanel1.Size = new System.Drawing.Size(1303, 514);
             this.tableLayoutPanel1.TabIndex = 2;
             // 
+            // textBox1
+            // 
+            this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.textBox1.Location = new System.Drawing.Point(3, 413);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.ReadOnly = true;
+            this.textBox1.Size = new System.Drawing.Size(1297, 98);
+            this.textBox1.TabIndex = 2;
+            // 
             // MainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
             this.Load += new System.EventHandler(this.MainForm_Load);
             ((System.ComponentModel.ISupportInitialize)(this.waveform)).EndInit();
             this.tableLayoutPanel1.ResumeLayout(false);
+            this.tableLayoutPanel1.PerformLayout();
             this.ResumeLayout(false);
 
         }
         private System.Windows.Forms.ProgressBar progressBar;
         private System.Windows.Forms.DataVisualization.Charting.Chart waveform;
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+        private System.Windows.Forms.TextBox textBox1;
     }
 }
 
index 056d0abdff6ca45d756647e237b571186fd0419d..b6609d2f2e00f81eb9332ecbf34e3b799bb162f3 100644 (file)
@@ -1,8 +1,10 @@
-using System;
+using Google.Cloud.Speech.V1;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
+using System.IO;
 using System.IO.Ports;
 using System.Linq;
 using System.Text;
@@ -36,11 +38,26 @@ namespace BopIt
                     short[] waveValues = new short[(int)(e.BytesRecorded * .55)];
                     for (int i = 0 ; i < e.BytesRecorded; i += 2)
                         waveValues[(i / 2) + ((waveValues.Length - e.BytesRecorded / 2) / 2)] = (short)(BitConverter.ToInt16(e.Buffer, i) / 50);
-                    waveform.Invoke((MethodInvoker)(() => waveform.Series[0].Points.DataBindY(waveValues)));
-                    UpdateVolumeMeter(Math.Abs(waveValues[waveValues.Length / 2]));
+                    try
+                    {
+                        waveform.Invoke((MethodInvoker)(() => waveform.Series[0].Points.DataBindY(waveValues)));
+                        UpdateVolumeMeter(Math.Abs(waveValues[waveValues.Length / 2]));
+                    }
+                    catch (Exception ex)
+                    {
+                        Console.WriteLine(ex.Message);
+                    }
                 };
             waveIn.StartRecording();
 
+
+
+            new Thread((ThreadStart)delegate
+            {
+                while (true)
+                    StreamingMicRecognizeAsync(10).Wait();
+            }).Start();
+
             //Volume meter de-incrimenter
             #region
             progressReset.Interval = 50;
@@ -62,10 +79,103 @@ namespace BopIt
             if(data < progressBar.Maximum && data > progressBar.Value)
                 progressBar.Invoke((MethodInvoker)(() => progressBar.Value = data));
         }
-        
         private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
         {
             progressReset.Dispose();
         }
+
+        private string currentSentance = String.Empty;
+        private string lastTrigger = String.Empty;
+        async Task<object> StreamingMicRecognizeAsync(int seconds)
+        {
+            if (NAudio.Wave.WaveIn.DeviceCount < 1)
+            {
+                Console.WriteLine("No Mic");
+                return -1;
+            }
+            var speech = SpeechClient.Create();
+            var streamingCall = speech.StreamingRecognize();
+
+            // Write the initial request with the config.
+            await streamingCall.WriteAsync(
+                new StreamingRecognizeRequest()
+                {
+                    StreamingConfig = new StreamingRecognitionConfig()
+                    {
+                        Config = new RecognitionConfig()
+                        {
+                            Encoding =
+                            RecognitionConfig.Types.AudioEncoding.Linear16,
+                            SampleRateHertz = 16000,
+                            LanguageCode = "en",
+                        },
+                        InterimResults = true,
+                    }
+                });
+            Task printResponses = Task.Run(async () =>
+            {
+                while (await streamingCall.ResponseStream.MoveNext(
+                    default(CancellationToken)))
+                {
+                    foreach (var result in streamingCall.ResponseStream
+                        .Current.Results)
+                    {
+                        var sentanceResult = result.Alternatives.Last().Transcript;
+                        var newWordList = sentanceResult.Split(' ');
+                        var currentWordList = currentSentance.Split(' ');
+
+                        if (newWordList.Length > currentWordList.Length ||
+                            newWordList.First() != currentWordList.First())
+                        {
+                            currentSentance = sentanceResult;
+                            textBox1.Invoke((MethodInvoker)(() => textBox1.AppendText(newWordList.Last() + Environment.NewLine)));
+                            if ( newWordList.Last() != lastTrigger)
+                            {
+                                textBox1.Invoke((MethodInvoker)(() => textBox1.AppendText("TRIGGER: " + newWordList.Last() + Environment.NewLine)));
+                                lastTrigger = newWordList.Last();
+                            }
+                            Console.WriteLine(newWordList.Last());
+                        }
+                    }
+                }
+            });
+
+            object writeLock = new object();
+            bool writeMore = true;
+            var waveIn = new NAudio.Wave.WaveInEvent();
+            waveIn.DeviceNumber = 0;
+            waveIn.WaveFormat = new NAudio.Wave.WaveFormat(16000, 1);
+            waveIn.DataAvailable +=
+                (object sender, NAudio.Wave.WaveInEventArgs args) =>
+                {
+                    lock (writeLock)
+                    {
+                        if (!writeMore) return;
+                        streamingCall.WriteAsync(
+                            new StreamingRecognizeRequest()
+                            {
+                                AudioContent = Google.Protobuf.ByteString
+                                    .CopyFrom(args.Buffer, 0, args.BytesRecorded)
+                            }).Wait();
+                    }
+                };
+            waveIn.StartRecording();
+            Console.WriteLine("Reconnecting stream");
+            await Task.Delay(TimeSpan.FromSeconds(seconds));
+            // Stop recording and shut down.
+            waveIn.StopRecording();
+            lock (writeLock) writeMore = false;
+            await streamingCall.WriteCompleteAsync();
+            await printResponses;
+            return 0;
+        }
+
+        private static bool IsTrigger(string word)
+        {
+            foreach (var trigger in File.ReadAllLines("beeMovie.txt"))
+                if (word == trigger)
+                    return true;
+            return false;
+        }
     }
 }
index 4e392d329ab14cd72f1bc2194fcda982fa7860ab..7895f66acdf5b5066ab4ebcf8f0466ba0c72edb6 100644 (file)
@@ -6,5 +6,23 @@
   <package id="Accord.Math" version="3.8.0" targetFramework="net461" />
   <package id="Accord.Statistics" version="3.8.0" targetFramework="net461" />
   <package id="Accord.Video" version="3.8.0" targetFramework="net461" />
+  <package id="Google.Api.CommonProtos" version="1.1.0" targetFramework="net461" />
+  <package id="Google.Api.Gax" version="2.1.0" targetFramework="net461" />
+  <package id="Google.Api.Gax.Grpc" version="2.1.0" targetFramework="net461" />
+  <package id="Google.Apis" version="1.29.1" targetFramework="net461" />
+  <package id="Google.Apis.Auth" version="1.29.1" targetFramework="net461" />
+  <package id="Google.Apis.Core" version="1.29.1" targetFramework="net461" />
+  <package id="Google.Cloud.Speech.V1" version="1.0.1" targetFramework="net461" />
+  <package id="Google.LongRunning" version="1.0.0" targetFramework="net461" />
+  <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+  <package id="Grpc.Auth" version="1.6.1" targetFramework="net461" />
+  <package id="Grpc.Core" version="1.6.1" targetFramework="net461" />
   <package id="NAudio" version="1.8.4" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
+  <package id="System.Interactive.Async" version="3.1.1" targetFramework="net461" />
+  <package id="System.Net.Http" version="4.3.1" targetFramework="net461" />
+  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
+  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
+  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
+  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
 </packages>
\ No newline at end of file