diff options
| author | kcfancher <keli@keisi.co> | 2026-03-28 14:06:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-28 19:06:40 +0100 |
| commit | 63496d05a2f78b061f6d848fd00ece223acd7514 (patch) | |
| tree | 2f53a05a7d8285430b62831318ce9118bef0e1ef /apps/web/src/lib | |
| parent | f2eed05d36846cd771458b20e77840e907084bc5 (diff) | |
| download | opencut-63496d05a2f78b061f6d848fd00ece223acd7514.tar.gz | |
Fix transcription sample-rate handling (#740)
Fix for #703.
Adds an optional sampleRate parameter to the decodeAudioToFloat32() function. The caption transcriber passes in a value of 16000 to prepare audio in the format Whisper expects.
Diffstat (limited to 'apps/web/src/lib')
| -rw-r--r-- | apps/web/src/lib/media/audio.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/web/src/lib/media/audio.ts b/apps/web/src/lib/media/audio.ts index 6f789301..e96f158b 100644 --- a/apps/web/src/lib/media/audio.ts +++ b/apps/web/src/lib/media/audio.ts @@ -34,10 +34,12 @@ export interface DecodedAudio { export async function decodeAudioToFloat32({ audioBlob, + sampleRate, }: { audioBlob: Blob; + sampleRate?: number; }): Promise<DecodedAudio> { - const audioContext = createAudioContext(); + const audioContext = createAudioContext({ sampleRate }); const arrayBuffer = await audioBlob.arrayBuffer(); const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); |
