elevenlabs 1.0.5 elevenlabs: ^1.0.5 copied to clipboard
A simple wrapper for accessing ElevenLabs's Text-To-Speech API and converting the results to MP3 files.
ElevenLabsTTS #
A simple wrapper for ElevenLabs's Text-To-Speech API.
Usage #
-
Add the package as a dependency to your
pubspec.yaml
file. -
Initialize ElevenLabsTTS:
ElevenLabsTTS elevenlabs = ElevenLabsTTS(apiKey: 'API_KEY');
VoiceId's can be found here: https://api.elevenlabs.io/v1/voices
- Convert your text to a File object (api key required):
elevenlabs.textToSpeech(
// Your Input
text: text,
// The Voice Id for the Voice.
// See: https://api.elevenlabs.io/v1/voices
voiceId: "ErXwobaYiN019PkySvjV",
// Checks if the file exists by name
// If it exists it gets called from cache, instead from the API.
fileName: "Hello World",
// Higher stability ensures consistency but may result in monotony, therefore
// for longer text, it is recommended to decrease stability.
stability: 1.0,
// Boosting voice clarity and target speaker similarity is achieved by high
// enhancement; however, very high values can produce artifacts, so it's
// essential to find the optimal setting.
similarityBoost: 1.0,
);