Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/generated/data-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ export interface DeepgramTtsSettings {
useSentenceSplitter?: boolean;
/**
* Speaking rate multiplier (0.25 to 4.0, default: 1.0)
* @min 0.25
* @max 4
* @min 0.75
* @max 1.5
*/
speed?: number;
[key: string]: any;
Expand Down
4 changes: 2 additions & 2 deletions src/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1273,8 +1273,8 @@
},
"speed": {
"type": "number",
"minimum": 0.25,
"maximum": 4,
"minimum": 0.75,
"maximum": 1.5,
"description": "Speaking rate multiplier (0.25 to 4.0, default: 1.0)"
}
},
Expand Down
49 changes: 29 additions & 20 deletions src/components/TtsProviderSettingsPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue'
import { computed, watch } from 'vue'
import { Plus, X } from 'lucide-vue-next'
import FormField from '@/components/FormField.vue'
import type {
Expand Down Expand Up @@ -48,6 +48,28 @@ const emotionTagsInput = computed({
},
})

const deepgramAudioFormat = computed(() => {
if (!isDeepgram.value) return undefined
return (model.value as DeepgramTtsSettings).audioFormat
})

watch(deepgramAudioFormat, (newFormat) => {
if (!isDeepgram.value) return
const settings = model.value as DeepgramTtsSettings
if (!newFormat) {
settings.audioFormat = 'pcm_16000'
settings.sampleRate = 16000
return
}
if (newFormat.startsWith('pcm_')) {
const parts = newFormat.split('_')
settings.sampleRate = parts.length > 1 ? parseInt(parts[1] ?? '16000', 10) : 16000
}
else if (newFormat === 'mulaw' || newFormat === 'alaw') {
settings.sampleRate = 8000
}
}, { immediate: true })

function addNoSpeechMarker() {
const settings = model.value as any
if (!settings.noSpeechMarkers) {
Expand All @@ -65,7 +87,7 @@ function removeNoSpeechMarker(index: number) {
</script>

<template>
<!-- Voice Settings Section (OpenAI) -->
<!-- Voice Settings Section (OpenAI) -->
<div v-if="isOpenAI" class="mt-8 pt-6 border-t border-gray-200 dark:border-gray-700">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Voice Settings (OpenAI)</h3>

Expand All @@ -81,7 +103,7 @@ function removeNoSpeechMarker(index: number) {
</FormField>

<!-- Speed -->
<FormField :label="`Speed: ${((model as any).speed ?? 1.0).toFixed(2)}`" class="w-full" help="Speech speed (0.25-4.0), defaults to 1.0">
<FormField :label="`Speed: ${((model as OpenAiTtsSettings).speed ?? 1.0).toFixed(2)}`" class="w-full" help="Speech speed (0.25-4.0), defaults to 1.0">
<input
v-model.number="(model as any).speed"
type="range"
Expand All @@ -99,32 +121,19 @@ function removeNoSpeechMarker(index: number) {
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Voice Settings (Deepgram)</h3>

<!-- Speed -->
<FormField :label="`Speed: ${((model as any).speed ?? 1.0).toFixed(2)}`" class="w-full" help="Speech speed (0.25-4.0), defaults to 1.0">
<FormField :label="`Speed: ${((model as DeepgramTtsSettings).speed ?? 1.0).toFixed(2)}`" class="w-full" help="Speech speed (0.75-1.5), defaults to 1.0">
<input
v-model.number="(model as DeepgramTtsSettings).speed"
type="range"
min="0.25"
max="4.0"
min="0.75"
max="1.5"
step="0.01"
class="block min-w-64 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"
:disabled="isLoading"
/>
</FormField>

<!-- Sample Rate -->
<FormField label="Sample Rate (Hz)" class="w-full" help="Audio sample rate in Hz. Higher values provide better quality but larger file sizes. Common values: 8000, 16000, 24000, 48000.">
<select
v-model.number="(model as DeepgramTtsSettings).sampleRate"
class="form-select-auto min-w-64"
:disabled="isLoading"
>
<option :value="undefined">Default</option>
<option :value="8000">8000 Hz</option>
<option :value="16000">16000 Hz</option>
<option :value="24000">24000 Hz (Recommended)</option>
<option :value="48000">48000 Hz</option>
</select>
</FormField>

</div>

<!-- Voice Settings Section (Cartesia) -->
Expand Down
Loading