feat: add Edge TTS rate/pitch sliders to voice settings (#629)

Add speed (rate) and pitch controls for Edge TTS provider:
- Frontend: speedToEdgeRate()/hzToEdgePitch() helpers + UI sliders
- Backend: rate/pitch passthrough in OpenaiTtsRequest and controller
- i18n: add edgeRate/edgePitch keys across all 8 languages
- Rate: 0.5x-2.0x slider, Pitch: -20Hz to +20Hz slider
This commit is contained in:
memeflyfly
2026-05-11 21:56:11 +08:00
committed by GitHub
parent 5e608ea338
commit a68b9bf01f
16 changed files with 142 additions and 4 deletions
@@ -38,6 +38,8 @@ export async function openaiProxy(ctx: Context) {
voice?: string
speed?: number
model?: string
rate?: string
pitch?: string
}
if (!body.input || typeof body.input !== 'string') {
@@ -57,6 +59,8 @@ export async function openaiProxy(ctx: Context) {
voice: body.voice,
speed: body.speed,
model: body.model,
rate: body.rate,
pitch: body.pitch,
})
ctx.set('Content-Type', 'audio/mpeg')
+4 -2
View File
@@ -64,6 +64,8 @@ export interface OpenaiTtsRequest {
input: string
voice?: string
speed?: number
rate?: string // Edge TTS rate format, e.g. "+20%". Takes priority over speed.
pitch?: string // Edge TTS pitch format, e.g. "-8Hz"
}
export async function openaiCompatibleTts(
@@ -72,7 +74,7 @@ export async function openaiCompatibleTts(
return textToSpeech({
text: body.input,
voice: body.voice || FIXED_VOICE,
rate: body.speed ? speedToEdgeRate(body.speed) : FIXED_RATE,
pitch: FIXED_PITCH,
rate: body.rate || (body.speed ? speedToEdgeRate(body.speed) : FIXED_RATE),
pitch: body.pitch || FIXED_PITCH,
})
}