Replies: 2 comments
|
I’m trying to understand how you narrowed down the issue to stem from the conversion of AVAudioPCMBuffer to Float[]. If you haven’t added logging to validate that assumption, that might help. From what I’ve seen, this is likely a sample rate problem, which is relatively common when working with ScreenCaptureKit. Whisper requires audio to be 16kHz mono frames, and will internally resample audio if it’s not in this format. But ScreenCaptureKit gives you audio with a format based on the sampleRate and channelCount set in SCStreamConfiguration, with a default sample rate of 48000 Hz in a stereo format. If you pass that to Whisper as if it were 16kHz, Whisper effectively hears everything 3× too slow and pitched down, and returns nothing. Try resampling to 16kHz mono before passing frames to Whisper and see if that solves your problem. If you’re trying to get live captions/transcripts, you could consider a desktop recording sdk to get speaker-labeled transcripts and make the audio capture process more reliable. |
Uh oh!
There was an error while loading. Please reload this page.
Hi folks,
I'm trying to generate auto-subtitles in real-time using ScreenCaptureKit API and SwiftWhisper, but whisper always returns no transcript to me.
I suspect it is the conversion of
AVAudioPCMBuffertoFloat[], but I have tried to convert in several ways but none were effective.Does anyone know what the problem might be?
Here is my code:
All reactions