Clone a voice on-the-fly without creating a persistent model using ReferenceAudio:
Copy
Ask AI
from fishaudio import FishAudiofrom fishaudio.types import ReferenceAudiofrom fishaudio.utils import playclient = FishAudio()# Clone from reference audiowith open("reference_voice.wav", "rb") as f: audio = client.tts.convert( text="This will sound like the reference voice", references=[ReferenceAudio( audio=f.read(), text="Text spoken in the reference audio" )] )play(audio)
Instant voice cloning is perfect for one-time use cases. For repeated use of the same voice, create a persistent voice model instead.
Providing transcripts is faster and more accurate than automatic transcription. When you provide transcripts, the system skips running ASR (speech recognition), resulting in better performance and quality:
Copy
Ask AI
from fishaudio import FishAudioclient = FishAudio()# Voice samples with transcriptssamples = [ ("voice1.wav", "This is the first sample"), ("voice2.wav", "This is the second sample"), ("voice3.wav", "This is the third sample")]voices = []texts = []for audio_file, transcript in samples: with open(audio_file, "rb") as f: voices.append(f.read()) texts.append(transcript)# Create voice with transcriptsvoice = client.voices.create( title="High Quality Voice", voices=voices, texts=texts, description="Voice with accurate transcripts", enhance_audio_quality=True)print(f"Created voice: {voice.id}")
Enable automatic audio enhancement to clean up noisy reference audio:
Copy
Ask AI
voice = client.voices.create( title="Enhanced Voice", voices=voice_samples, enhance_audio_quality=True # Clean up background noise and normalize levels)
Audio enhancement helps process noisy or lower-quality reference audio. If your audio is already clean and well-recorded, this may not provide additional benefit.
Discover available voices with filtering using voices.list():
Copy
Ask AI
from fishaudio import FishAudioclient = FishAudio()# List all voicesvoices = client.voices.list(page_size=20)print(f"Total voices: {voices.total}")for voice in voices.items: print(f"{voice.title}: {voice.id}")
from fishaudio import FishAudioclient = FishAudio()# Filter by tagsmale_voices = client.voices.list( tags=["male", "english"], page_size=10)# Filter by languagechinese_voices = client.voices.list( language="zh", page_size=10)# Get only your own voicesmy_voices = client.voices.list( self_only=True, page_size=20)