Skip to content

Instantly share code, notes, and snippets.

@ggerganov
Last active November 4, 2022 19:24
Show Gist options
  • Save ggerganov/faf5268b54263a52f8e8ca65d37905bc to your computer and use it in GitHub Desktop.
Save ggerganov/faf5268b54263a52f8e8ca65d37905bc to your computer and use it in GitHub Desktop.
Transcribe mic audio using Whisper
#!/bin/bash
# record some raw audio
sox -d rec.wav
# resample to 16kHz
ffmpeg -y -i ./rec.wav -ar 16000 -ac 1 -c:a pcm_s16le ./rec16.wav > /dev/null 2>&1
# run Whisper
echo "Processing ..."
./main -m models/ggml-base.en.bin rec16.wav -owts > /dev/null 2>&1
# generate Karaoke video
source rec16.wav.wts > /dev/null 2>&1
# play the video
ffplay -loglevel 0 -autoexit ./rec16.wav.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment