summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/panels/assets/views
diff options
context:
space:
mode:
authorkcfancher <keli@keisi.co>2026-03-28 14:06:40 -0400
committerGitHub <noreply@github.com>2026-03-28 19:06:40 +0100
commit63496d05a2f78b061f6d848fd00ece223acd7514 (patch)
tree2f53a05a7d8285430b62831318ce9118bef0e1ef /apps/web/src/components/editor/panels/assets/views
parentf2eed05d36846cd771458b20e77840e907084bc5 (diff)
downloadopencut-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/components/editor/panels/assets/views')
-rw-r--r--apps/web/src/components/editor/panels/assets/views/captions.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/web/src/components/editor/panels/assets/views/captions.tsx b/apps/web/src/components/editor/panels/assets/views/captions.tsx
index 7a3b16bf..a73fd693 100644
--- a/apps/web/src/components/editor/panels/assets/views/captions.tsx
+++ b/apps/web/src/components/editor/panels/assets/views/captions.tsx
@@ -11,7 +11,10 @@ import { useState, useRef } from "react";
import { extractTimelineAudio } from "@/lib/media/mediabunny";
import { useEditor } from "@/hooks/use-editor";
import { DEFAULT_TEXT_ELEMENT } from "@/constants/text-constants";
-import { TRANSCRIPTION_LANGUAGES } from "@/constants/transcription-constants";
+import {
+ DEFAULT_TRANSCRIPTION_SAMPLE_RATE,
+ TRANSCRIPTION_LANGUAGES,
+} from "@/constants/transcription-constants";
import type {
TranscriptionLanguage,
TranscriptionProgress,
@@ -52,7 +55,10 @@ export function Captions() {
});
setProcessingStep("Preparing audio...");
- const { samples } = await decodeAudioToFloat32({ audioBlob });
+ const { samples } = await decodeAudioToFloat32({
+ audioBlob,
+ sampleRate: DEFAULT_TRANSCRIPTION_SAMPLE_RATE,
+ });
const result = await transcriptionService.transcribe({
audioData: samples,