Adipta commited on
Commit
5479293
·
verified ·
1 Parent(s): 49e6a25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -8,6 +8,14 @@ from google.cloud import speech
8
  from microphone import MicrophoneStream
9
  from utils import listen_print_loop
10
 
 
 
 
 
 
 
 
 
11
  # process of getting credentials
12
  def get_credentials():
13
  creds_json_str = os.getenv("GOOGLE")
@@ -42,6 +50,7 @@ streaming_config = speech.StreamingRecognitionConfig(
42
  async def main(audio) -> None:
43
 
44
  print("Streaming started ...")
 
45
 
46
  with MicrophoneStream(RATE, CHUNK) as stream:
47
  audio_generator = stream.generator()
 
8
  from microphone import MicrophoneStream
9
  from utils import listen_print_loop
10
 
11
+ import pyaudio
12
+
13
+ def list_audio_devices():
14
+ audio = pyaudio.PyAudio()
15
+ for i in range(audio.get_device_count()):
16
+ device_info = audio.get_device_info_by_index(i)
17
+ print(f"Device {i}: {device_info['name']}")
18
+
19
  # process of getting credentials
20
  def get_credentials():
21
  creds_json_str = os.getenv("GOOGLE")
 
50
  async def main(audio) -> None:
51
 
52
  print("Streaming started ...")
53
+ print(list_audio_devices())
54
 
55
  with MicrophoneStream(RATE, CHUNK) as stream:
56
  audio_generator = stream.generator()