Transcription web app: How to handle audio chunks

1 points by amohajerani1 ↗ HN
I am creating a web application for transcribing conversations. The client sends chunks of data to the server every 30 seconds. At the end of recording, the server would use whisper library to transcribe the whole audio and return the text.

I am comfortable working with a single audio file. But how could I transcribe chunks of audio? Do you know of any code examples?

2 comments

[ 3.1 ms ] story [ 12.2 ms ] thread
Concatenate the chunks at the end? Then you have a single audio file.
The stream example in whisper.cpp solves this problem effectively by running the inference on a sequence of chunks and then keeping around the last chunk as context for the next sequence of chunks for the next inference. Ideally as many chunks as possible should be combined into a sequence as this would minimize the amount of redundant computation and edge effects should the speaker have an utterance that is more than 30 seconds long. But just doing 2 chunks at a time would also work though it would double the processing required.