question/feature_request(python): pause/resume
- Langage dominant
- Jupyter Notebook
- Étoiles
- 15.1k
- Forks
- 1.8k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### 1. Summary
I can't found, how I can pause and resume Vosk.
### 2. Argumentation
Me and my team uses Speech-To-Text technology for automatically (instead of manual) writing questions from intellectual games like “[**What? Where? When?**](https://en.wikipedia.org/wiki/What%3F_Where%3F_When%3F)”. How does this happen:
1. We start Speech-To-Text. The game host reads a question, which we write via Speech-To-Text.
1. When the host finishes reading the question, we stop Speech-To-Text and begin to discuss the question.
1. We use Speech-To-Text to peek into a question, if we forgot something in it. Using Speech-To-Text for our discussions interferes with this, creates additional difficulties.
1. When the host begin to read new question, we start Speech-To-Text again and so on.
We need pause/resume Speech-To-Text for this purpose. We don't know how we can do this in Vosk.
### 3. Examples in another apps
I can get the expected behavior if I use the [**Web Speech API**](https://developer.mozilla.org/ru/docs/Web/API/Web_Speech_API). I open [**Web Speech API demo page**](https://www.google.com/intl/en/chrome/demos/speech.html) in Chromium → I press to `Microphone` button, when I need start/restart or stop Speech-To-Text.

### 4. Not helped
1. I can't found anything about pause/resume in [**Vosk documentation**](https://alphacephei.com/vosk/) and [**`vosk_api.h`**](https://github.com/alphacep/vosk-api/blob/master/src/vosk_api.h) file.
1. I tried Pause/Break, Ctrl+S, Ctrl+Z F10 keys as described in [**this**](https://superuser.com/q/1145483/572069) and [**this**](https://stackoverflow.com/q/8359317/5951529) answers — no effect.
### 5. Do not offer
> Close your console and run `python test_microphone.py` again
Vosk does not load instantly for use, users must wait. Frequent restart Vosk takes users time.
Using the Web Speech API (see section 3) users don't wait for anything.
### 6. Data
#### 6.1. Environment
1. Windows 10.0.18363 Pro N for Workstations 64-bit EN
1. Python 3.8.3
1. Vosk 0.3.7
#### 6.2. Script
Slightly modified [**`test_microphone.py`**](https://github.com/alphacep/vosk-api/blob/master/python/example/test_microphone.py):
```python
"""Test Vosk microphone."""
import json
import os
import sys
import pyaudio
from vosk import KaldiRecognizer
from vosk import Model
if not os.path.exists("model"):
print("Please download the model and unpack as 'model' in the current folder.")
sys.exit()
MODEL = Model("model")
REC = KaldiRecognizer(MODEL, 16000)
P = pyaudio.PyAudio()
STREAM = P.open(
format=pyaudio.paInt16,
channels=1,
rate=16000,
input=True,
frames_per_buffer=8000)
STREAM.start_stream()
while True:
DATA = STREAM.read(14000)
if len(DATA) == 0:
pass
if REC.AcceptWaveform(DATA):
KIRA_RESULT = REC.Result()
KIRA_PARSED_JSON = json.loads(KIRA_RESULT)
print(KIRA_PARSED_JSON['text'])
```
Thanks.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.