あなたのテレビにさえあなたのPCに音声認識を加えてください
19399 ワード
私の提出の概要
コンピュータの私達の日々の使用のほとんどは私たちのコンピュータを健全な装置として使用するので、私はどうにか、私がどうにかデフォルトの音声出力を音声認識に接続するならば、それが良いと思いました、あなたがすべての語を使用するソフトウェアが独立して認識されるように?チーム、Youtube、Tiktok、Twitter、EDGE、VLC、…あなたはそれを残念なことにWindows☹ ) . そして、どれくらい我々はケーブルテレビのために字幕のようにそれを押すことができますか😊
提出カテゴリ
アクセシビリティ
Githubのコードへのリンク
ブライビュー / ディープグラムウィンシス
すべてのサウンドのテキストコンバータに
ディープグラムウィンシス
すべてのサウンドのテキストコンバータに
このリポジトリで何を見つけることができますか?
追加情報
システム全体の音声認識を必要とするために、基本的に、Deepgramのような音声認識装置サービスとPCからの盗聴された音への若干の方法を2つの構成要素が必要とします.Windowsにおいてループバック(自己サウンドシステムに接続するための技術的な用語)には、WASAPIドライバを使用します.私はWindowsシステムのNaudioライブラリを選んだ.
そして、いくつかの結果です.
チームで働く
ブラウザで動作する
システムが設定、透明である間、最も重要なシステムはオーディオを得て、それを認識しています.
private async void ConvertAndTranscript()
{
//enter credentials for deepgram
var credentials = new Credentials(textBoxApiKey.Text);
//Create our export folder to record sound and CSV file
var outputFolder = CreateRecordingFolder();
//File settings
var dateTimeNow = DateTime.Now;
var fileName = $"{dateTimeNow.Year}_{dateTimeNow.Month}_{dateTimeNow.Day}#{dateTimeNow.Hour}_{dateTimeNow.Minute}_{dateTimeNow.Minute}_record";
var soundFileName = $"{fileName}.mp3";
var csvFileName = $"{fileName}.csv";
var outputSoundFilePath = Path.Combine(outputFolder, soundFileName);
var outputCSVFilePath = Path.Combine(outputFolder, csvFileName);
//init deepgram
var deepgramClient = new DeepgramClient(credentials);
//init loopback interface
_WasapiLoopbackCapture = new WasapiLoopbackCapture();
//generate memory stream and deepgram client
using (var memoryStream = new MemoryStream())
using (var deepgramLive = deepgramClient.CreateLiveTranscriptionClient())
{
//the format that will we send to deepgram is 24 Khz 16 bit 2 channels
var waveFormat = new WaveFormat(24000, 16, 2);
var deepgramWriter = new WaveFileWriter(memoryStream, waveFormat);
//mp3 writer if we wanted to save audio
LameMP3FileWriter? mp3Writer = checkBoxSaveMP3.Checked ?
new LameMP3FileWriter(outputSoundFilePath, _WasapiLoopbackCapture.WaveFormat, LAMEPreset.STANDARD_FAST) : null;
//file writer if we wanted to save as csv
StreamWriter? csvWriter = checkBoxSaveAsCSV.Checked ? File.CreateText(outputCSVFilePath) : null;
//deepgram options
var options = new LiveTranscriptionOptions()
{
Punctuate = true,
Diarize = true,
Encoding = Deepgram.Common.AudioEncoding.Linear16,
ProfanityFilter = checkBoxProfinityAllowed.Checked,
Language = _SelectedLanguage.LanguageCode,
Model = _SelectedModel.ModelCode,
};
//connect
await deepgramLive.StartConnectionAsync(options);
//when we receive data from deepgram this is mostly taken from their samples
deepgramLive.TranscriptReceived += (s, e) =>
{
try
{
if (e.Transcript.IsFinal &&
e.Transcript.Channel.Alternatives.First().Transcript.Length > 0)
{
var transcript = e.Transcript;
var text = $"{transcript.Channel.Alternatives.First().Transcript}";
_CaptionForm?.captionLabel.BeginInvoke((Action)(() =>
{
csvWriter?.WriteLine($@"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss \"GMT\"zzz")},""{text}""");
_CaptionForm.captionLabel.Text = text;
_CaptionForm?.captionLabel.Refresh();
}));
}
}
catch (Exception ex)
{
}
};
deepgramLive.ConnectionError += (s, e) =>
{
};
//when windows tell us that there is sound data ready to be processed
//better than polling
_WasapiLoopbackCapture.DataAvailable += (s, a) =>
{
mp3Writer?.Write(a.Buffer, 0, a.BytesRecorded);
var buffer = ToPCM16(a.Buffer, a.BytesRecorded, _WasapiLoopbackCapture.WaveFormat);
deepgramWriter.Write(buffer, 0, buffer.Length);
deepgramLive.SendData(memoryStream.ToArray());
memoryStream.Position = 0;
};
//when recording stopped release and flush all file pointers
_WasapiLoopbackCapture.RecordingStopped += (s, a) =>
{
if (mp3Writer != null)
{
mp3Writer.Dispose();
mp3Writer = null;
}
if (csvWriter != null)
{
csvWriter.Dispose();
csvWriter = null;
}
_WasapiLoopbackCapture.Dispose();
};
_WasapiLoopbackCapture.StartRecording();
while (_WasapiLoopbackCapture.CaptureState != NAudio.CoreAudioApi.CaptureState.Stopped)
{
if (_CancellationTokenSource?.IsCancellationRequested == true)
{
_CancellationTokenSource?.Dispose();
_CancellationTokenSource = null;
return;
}
Thread.Sleep(500);
}
}
}
コードの残りの部分は、コード隠れ家フォームをexexuteに準備を得るためです.それで、結局、あなたはテレビで字幕を持つことができますか?これを達成するために、あなたはどうにかPCにテレビ信号を入力する必要があります.私はUSBキャプチャカードを使用します.それから、私はテレビに信号を送るために、コンピュータHDMI出力を使います.テレビやケーブルの箱には何の違いもない.
PS :あなたのネットワーク接続の遅れをチェックするいくつかの問題がある場合もHackyソリューションで満足していないメモリストリームの問題があるようです.どんなPRも歓迎します.
Reference
この問題について(あなたのテレビにさえあなたのPCに音声認識を加えてください), 我々は、より多くの情報をここで見つけました https://dev.to/bleakview/add-speech-recognition-to-your-pc-even-to-your-tv-4j0nテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol