savbell / whisper-writer

💬📝 A small dictation app using OpenAI's Whisper speech recognition model.
GNU General Public License v3.0
244 stars 40 forks source link

Pulseaudio #7

Closed korjavin closed 6 months ago

korjavin commented 1 year ago

Is there a way to specify the device for recording?

uberkael commented 11 months ago

I'm using Pipewire but it will be the same, I solved it by doing this:

  1. Check the device number with python -m sounddevice

  2. Edit src/transcription.py: line ~45~ and add your device number as device with sd.InputStream(samplerate=sample_rate, channels=1, dtype='int16', blocksize=sample_rate * frame_duration // 1000, device=8, callback=lambda indata, frames, time, status: buffer.extend(indata[:, 0])):

I needed to change the sample rate too ie. sample_rate = 48000 checking it with pactl list short sinks

image

image

Maybe I should add some code to do it from the program arguments...

savbell commented 6 months ago

Hi there,

Thank you @uberkael for your response! In my latest commit, I've added config options for choosing the sound device and sample rate. :)