mirror of
https://github.com/DinoMalin/paranoia-1.0.git
synced 2025-10-29 19:05:59 +00:00
feat: script to listen
This commit is contained in:
parent
08640b8415
commit
de9187fb48
22
speech.py
Normal file
22
speech.py
Normal file
@ -0,0 +1,22 @@
|
||||
import azure.cognitiveservices.speech as speechsdk
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
load_dotenv()
|
||||
|
||||
speech_config = speechsdk.SpeechConfig(
|
||||
subscription=os.getenv("SPEECH_KEY"), region=os.getenv("REGION"))
|
||||
speech_config.speech_recognition_language = "fr-FR"
|
||||
|
||||
audio_out = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)
|
||||
|
||||
# A filthy shortcut because i have incomprehensible bugs with my libs.
|
||||
# If your pc is normal unlike mine, consider replacing this argument with:
|
||||
# use_default_microphone=True
|
||||
audio_config = speechsdk.audio.AudioConfig(device_name="plughw:2,0") # fuck this man
|
||||
|
||||
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
|
||||
|
||||
print("listen")
|
||||
speech_recognition_result = speech_recognizer.recognize_once_async().get()
|
||||
print(speech_recognition_result.text)
|
||||
Loading…
Reference in New Issue
Block a user