Skip to content

Commit 05e2835

Browse files
authored
Merge pull request #2 from allozaur/feature/add-elevenlabs-scribe
Add ElevenLabs Scribe v1 model and set as default
2 parents ffefa1b + a30c789 commit 05e2835

File tree

10 files changed

+416
-326
lines changed

10 files changed

+416
-326
lines changed

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@sveltejs/kit": "^2.0.0",
2424
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
2525
"@types/eslint": "^9.6.0",
26+
"elevenlabs": "^1.56.0",
2627
"eslint": "^9.0.0",
2728
"eslint-config-prettier": "^9.1.0",
2829
"eslint-plugin-svelte": "^2.36.0",

apps/web/src/lib/components/Recorder.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { onMount } from 'svelte';
44
import WaveSurfer from 'wavesurfer.js';
55
import RecordPlugin from 'wavesurfer.js/dist/plugins/record.esm.js';
6+
import { ElevenLabsClient } from 'elevenlabs';
67
78
import Button from './Button.svelte';
89
import ButtonPause from './ButtonPause.svelte';
@@ -18,13 +19,15 @@
1819
recordingUrl?: string;
1920
saveRecording: () => void;
2021
scrollingWaveform?: boolean;
22+
transcriptionModel?: 'elevenlabs-scribe-v1' | 'openai-whisper';
2123
}
2224
2325
let {
2426
discardRecording,
2527
recordingUrl = $bindable(''),
2628
saveRecording,
27-
scrollingWaveform = true
29+
scrollingWaveform = true,
30+
transcriptionModel = 'elevenlabs-scribe-v1'
2831
}: RecorderProps = $props();
2932
3033
let defaultDeviceId: string | undefined = $state(undefined);

apps/web/src/lib/components/RecorderOld.svelte

Lines changed: 0 additions & 291 deletions
This file was deleted.

apps/web/src/lib/components/RecordingTile/RecordingTile.svelte

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
name,
1616
savedRecordings = $bindable([]),
1717
titleSlot,
18-
transcription
18+
transcription,
19+
transcriptionModel = $bindable('elevenlabs-scribe-v1')
1920
}: RecordingTileProps = $props();
2021
22+
$inspect(transcription);
23+
2124
let blob: Blob = $state(base64ToBlob(data));
2225
2326
let isPlaying = $state(false);
@@ -80,7 +83,7 @@
8083
<div class="transcription">
8184
<div class="inner">
8285
<!-- svelte-ignore a11y_click_events_have_key_events -->
83-
{#each transcription.words as { word, start, end }, i}
86+
{#each transcription.words as { word, text, start, end }, i}
8487
<!-- svelte-ignore a11y_click_events_have_key_events -->
8588
<!-- svelte-ignore a11y_no_static_element_interactions -->
8689
<span
@@ -91,11 +94,21 @@
9194
class:read={currentTime >= start}
9295
onclick={() => playFromTime(start)}
9396
>
94-
{#if i !== transcription.words.length - 1}
95-
<span class="word">{word}</span>&nbsp;
96-
{:else}
97-
<span class="word">{word}</span>
98-
{/if}
97+
<span class="word">
98+
{#if text}
99+
{#if text === ' '}
100+
&nbsp;
101+
{:else}
102+
{text}
103+
{/if}
104+
{:else if word}
105+
{#if i !== transcription.words.length - 1}
106+
{word}&nbsp;
107+
{:else}
108+
{word}
109+
{/if}
110+
{/if}
111+
</span>
99112
</span>
100113
{/each}
101114
</div>
@@ -109,6 +122,11 @@
109122
{:else}
110123
<span> You haven't transcribed this recording yet. </span>
111124

125+
<select bind:value={transcriptionModel}>
126+
<option value="elevenlabs-scribe-v1">ElevenLabs Scribe v1</option>
127+
<option value="openai-whisper">OpenAI Whisper</option>
128+
</select>
129+
112130
<Button
113131
kind="secondary"
114132
label="Transcribe"
@@ -119,7 +137,7 @@
119137

120138
isTranscribing = true;
121139

122-
const transcription = await transcribeRecording(blob);
140+
const transcription = await transcribeRecording(blob, transcriptionModel);
123141

124142
isTranscribing = false;
125143

0 commit comments

Comments
 (0)