docs: add ai-voice-changer playground example (#2708)

This commit is contained in:
Dailin
2026-03-23 14:23:30 +08:00
committed by GitHub
parent 34bf2799b6
commit 3451bab09f
2 changed files with 25 additions and 0 deletions
+6
View File
@@ -169,6 +169,12 @@ const examples = [
slug: 'ai-txt2speech-elevenlabs',
source: '/playground/examples/ai-txt2speech-elevenlabs.html',
},
{
title: 'Voice Changer',
description: 'Swap a sample clip into a new voice using Puter.js AI speech-to-speech helpers.',
slug: 'ai-voice-changer',
source: '/playground/examples/ai-voice-changer.html',
},
{
title: 'ElevenLabs Voice changer with a sample clip',
description: 'Transform an audio clip into a new voice using Puter.js speech-to-speech helper.',
@@ -0,0 +1,19 @@
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<button id="swap">Convert voice</button>
<script>
document.getElementById('swap').addEventListener('click', async ()=>{
const audio = await puter.ai.speech2speech(
'https://puter-sample-data.puter.site/tts_example.mp3',
{
voice: '21m00Tcm4TlvDq8ikWAM',
model: 'eleven_multilingual_sts_v2',
output_format: 'mp3_44100_128'
}
);
audio.play();
});
</script>
</body>
</html>