shirayu / whispering

Streaming transcriber with whisper
MIT License
685 stars 53 forks source link

Cannot run whispering: Error opening InputStream: Invalid sample rate [PaErrorCode -9997] #78

Closed hippylover closed 1 year ago

hippylover commented 1 year ago
[2023-01-07 02:32:33,394] cli.get_wshiper:225 DEBUG -> WhisperConfig: model_name='tiny' device='cpu' language='en' fp16=True
[2023-01-07 02:32:33,795] transcriber._set_dtype:35 INFO -> Using FP32 because FP16 is not supported on CPU
Using cache found in /home/kris/.cache/torch/hub/snakers4_silero-vad_master
[2023-01-07 02:32:34,701] cli.get_context:239 DEBUG -> Context: protocol_version=6003 timestamp=0.0 buffer_tokens=[] buffer_mel=None nosoeech_skip_count=None temperatures=[0.0, 0.2, 0.4, 0.6, 0.8, 1.0] patience=None compression_ratio_threshold=2.4 logprob_threshold=-1.0 no_captions_threshold=0.6 best_of=5 beam_size=5 no_speech_threshold=0.6 buffer_threshold=0.5 vad_threshold=0.5 max_nospeech_skip=16 mel_frame_min_num=3000 data_type='float32'
[2023-01-07 02:32:34,701] cli.transcribe_from_mic:56 INFO -> Ready to transcribe
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2050
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2721
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2845
Traceback (most recent call last):
  File "/home/kris/.local/bin/whispering", line 8, in <module>
    sys.exit(main())
  File "/home/kris/.local/lib/python3.10/site-packages/whispering/cli.py", line 343, in main
    for text in transcribe_from_mic(
  File "/home/kris/.local/lib/python3.10/site-packages/whispering/cli.py", line 57, in transcribe_from_mic
    with sd.InputStream(
  File "/home/kris/.local/lib/python3.10/site-packages/sounddevice.py", line 1421, in __init__
    _StreamBase.__init__(self, kind='input', wrap_callback='array',
  File "/home/kris/.local/lib/python3.10/site-packages/sounddevice.py", line 898, in __init__
    _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
  File "/home/kris/.local/lib/python3.10/site-packages/sounddevice.py", line 2747, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening InputStream: Invalid sample rate [PaErrorCode -9997]

I tried adding another sample rate to ~/.asoundrc to mic(i hate alsa config though and this shouldnt be neccessary in the first place), but it didnt work. Not sure i am doing the right thing...

shirayu commented 1 year ago

The sampling rate of whisper is fixed to 16000. I'm sorry but not sure the setting of alsa.

hippylover commented 1 year ago

whisper alone works on my computer. perhaps i do not have a good enough graphics card? I have this: https://ark.intel.com/content/www/us/en/ark/products/196603/intel-core-i51035g1-processor-6m-cache-up-to-3-60-ghz.html#tab-blade-1-0-4

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 21 days with no activity.