diff options
| author | yum <yum.food.vr@gmail.com> | 2025-05-29 19:45:48 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-05-29 19:45:48 -0700 |
| commit | f97cef182de55b6dbae8d2bc0477acfca6cc1f66 (patch) | |
| tree | 61c9237fb404dcb9749a496be57e6758e7341c2a /app/list_microphones.py | |
| parent | 82a5b3805b2a54faea501ee362419330664c277a (diff) | |
More UI work
1. main STT app works in new project structure
2. UI dumps mics on startup to populate mic list
3. add missing deps (hf-xet, wave)
4. normalize audio volume when transcribing. Probably still wrong tbqh.
5. add checkbox to save audio segments & improve logic so only segments
with speech get saved.
6. add default config settings
Diffstat (limited to 'app/list_microphones.py')
| -rw-r--r-- | app/list_microphones.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/list_microphones.py b/app/list_microphones.py new file mode 100644 index 0000000..a6b1f36 --- /dev/null +++ b/app/list_microphones.py @@ -0,0 +1,24 @@ +import pyaudio +import json +import sys + +try: + p = pyaudio.PyAudio() + info = p.get_host_api_info_by_index(0) + numdevices = info.get('deviceCount') + + microphones = [] + for i in range(0, numdevices): + device_info = p.get_device_info_by_host_api_device_index(0, i) + if device_info.get('maxInputChannels') > 0: + microphones.append({ + 'index': i, + 'name': device_info.get('name'), + 'defaultSampleRate': device_info.get('defaultSampleRate') + }) + + print(json.dumps(microphones)) + p.terminate() +except Exception as e: + print(json.dumps({'error': str(e)}), file=sys.stderr) + sys.exit(1)
\ No newline at end of file |
