From 2d4fc217e7f036eb720c1566a08e5ad99663d443 Mon Sep 17 00:00:00 2001 From: David vonThenen <12752197+dvonthenen@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:45:43 -0700 Subject: [PATCH] Remove from Examples --- examples/prerecorded/Program.cs | 2 +- examples/streaming/Program.cs | 64 +-------------------------------- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/examples/prerecorded/Program.cs b/examples/prerecorded/Program.cs index 3799db88..473eb9c6 100644 --- a/examples/prerecorded/Program.cs +++ b/examples/prerecorded/Program.cs @@ -8,7 +8,7 @@ class Program { static async Task Main(string[] args) { - var apiKey = "0b0c71c7f752646e8499ac72a0d72ae3267ca8fa"; + var apiKey = "REPLACE-WITH-YOUR-API-KEY"; var deepgramClient = new PreRecordedClient(apiKey); var response = await deepgramClient.TranscribeUrl( diff --git a/examples/streaming/Program.cs b/examples/streaming/Program.cs index 28585a1f..c2af692d 100644 --- a/examples/streaming/Program.cs +++ b/examples/streaming/Program.cs @@ -1,65 +1,3 @@ -/* -using System.Net.WebSockets; -using Deepgram.Constants; -using Deepgram.DeepgramEventArgs; -using Deepgram.Models; - -const string DEEPGRAM_API_KEY = ""; - -using (var deepgramLive = new LiveClient(DEEPGRAM_API_KEY)) -{ - deepgramLive.ConnectionOpened += HandleConnectionOpened; - deepgramLive.ConnectionClosed += HandleConnectionClosed; - deepgramLive.LiveError += HandleConnectionError; - deepgramLive.TranscriptReceived += HandleTranscriptReceived; - - // Connection opened so start sending audio. - async void HandleConnectionOpened(object? sender, ConnectionOpenEventArgs e) - { - byte[] buffer; - - using (FileStream fs = File.OpenRead(@"\preamble.wav")) - { - buffer = new byte[fs.Length]; - fs.Read(buffer, 0, (int)fs.Length); - } - - var chunks = buffer.Chunk(1000); - - foreach (var chunk in chunks) - { - deepgramLive.Send(chunk); - await Task.Delay(50); - } - } - - void HandleTranscriptReceived(object? sender, TranscriptReceivedEventArgs e) - { - if (e.Transcript.IsFinal && e.Transcript.Channel.Alternatives.First().Transcript.Length > 0) - { - var transcript = e.Transcript; - Console.WriteLine($"[Speaker: {transcript.Channel.Alternatives.First().Words.First()}] {transcript.Channel.Alternatives.First().Transcript}"); - } - } - - void HandleConnectionClosed(object? sender, ConnectionClosedEventArgs e) - { - Console.Write("Connection Closed"); - } - - void HandleConnectionError(object? sender, LiveErrorEventArgs e) - { - Console.WriteLine(e.Exception.Message); - } - - var options = new LiveSchema() { Punctuate = true, Diarize = true, Encoding = AudioEncoding.Linear16 }; - await deepgramLive.Connect(options); - - while (deepgramLive.State() == WebSocketState.Open) { } -} -*/ - - using Deepgram; using Deepgram.Constants; using Deepgram.Models.Authenticate.v1; @@ -76,7 +14,7 @@ class Program static async Task Main(string[] args) { // Initialize the LiveClient with your API key and options - var apiKey = "0b0c71c7f752646e8499ac72a0d72ae3267ca8fa"; + var apiKey = "REPLACE-WITH-YOUR-API-KEY"; var options = new DeepgramClientOptions(); var liveClient = new LiveClient(apiKey, options);