examples: add mic docs and limit mic example to unix
This commit is contained in:
parent
31f154ff26
commit
3ba2906db0
|
|
@ -842,6 +842,7 @@ Some of the examples are even ported to run in the browser using WebAssembly. Ch
|
||||||
| [whisper-cli](examples/cli) | [whisper.wasm](examples/whisper.wasm) | Tool for translating and transcribing audio using Whisper |
|
| [whisper-cli](examples/cli) | [whisper.wasm](examples/whisper.wasm) | Tool for translating and transcribing audio using Whisper |
|
||||||
| [whisper-bench](examples/bench) | [bench.wasm](examples/bench.wasm) | Benchmark the performance of Whisper on your machine |
|
| [whisper-bench](examples/bench) | [bench.wasm](examples/bench.wasm) | Benchmark the performance of Whisper on your machine |
|
||||||
| [whisper-stream](examples/stream) | [stream.wasm](examples/stream.wasm) | Real-time transcription of raw microphone capture |
|
| [whisper-stream](examples/stream) | [stream.wasm](examples/stream.wasm) | Real-time transcription of raw microphone capture |
|
||||||
|
| [whisper-mic](examples/mic) | | Manual start/stop microphone transcription with interactive device selection |
|
||||||
| [whisper-command](examples/command) | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic |
|
| [whisper-command](examples/command) | [command.wasm](examples/command.wasm) | Basic voice assistant example for receiving voice commands from the mic |
|
||||||
| [whisper-server](examples/server) | | HTTP transcription server with OAI-like API |
|
| [whisper-server](examples/server) | | HTTP transcription server with OAI-like API |
|
||||||
| [whisper-talk-llama](examples/talk-llama) | | Talk with a LLaMA bot |
|
| [whisper-talk-llama](examples/talk-llama) | | Talk with a LLaMA bot |
|
||||||
|
|
|
||||||
11
build_mic.sh
11
build_mic.sh
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Build script for examples/mic/whisper-mic.cpp
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
mkdir -p build_mic
|
|
||||||
cd build_mic
|
|
||||||
|
|
||||||
cmake ../examples/mic
|
|
||||||
cmake --build . -j$(nproc)
|
|
||||||
|
|
@ -118,7 +118,9 @@ else()
|
||||||
endif (WHISPER_SDL2)
|
endif (WHISPER_SDL2)
|
||||||
|
|
||||||
add_subdirectory(deprecation-warning)
|
add_subdirectory(deprecation-warning)
|
||||||
add_subdirectory(mic)
|
if (UNIX AND NOT WIN32)
|
||||||
|
add_subdirectory(mic)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WHISPER_SDL2)
|
if (WHISPER_SDL2)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
# whisper.cpp/examples/mic
|
||||||
|
|
||||||
|
This example captures live microphone audio and performs manual start/stop transcription.
|
||||||
|
Unlike `whisper-stream`, it records a full segment first and then transcribes that segment.
|
||||||
|
|
||||||
|
## Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build/bin/whisper-mic -m ./models/ggml-base.bin
|
||||||
|
```
|
||||||
|
|
||||||
|
Press Enter to start recording, then press Enter again to stop and transcribe.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
```text
|
||||||
|
-h, --help show help and exit
|
||||||
|
-m F, --model F model path
|
||||||
|
-t N, --timeout N max recording time in seconds
|
||||||
|
-c N, --capture N capture device ID
|
||||||
|
-l S, --language S language (for example: zh, en)
|
||||||
|
-ng, --no-gpu disable GPU inference
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -B build
|
||||||
|
cmake --build build --config Release -j
|
||||||
|
```
|
||||||
|
|
||||||
|
## GPU build (optional)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -S . -B build_gpu -DGGML_CUDA=ON
|
||||||
|
cmake --build build_gpu --config Release -j
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build_gpu/bin/whisper-mic -m ./models/ggml-base.bin
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue