elevenlabs 1.0.9 copy "elevenlabs: ^1.0.9" to clipboard
elevenlabs: ^1.0.9 copied to clipboard

discontinued

Lightweight wrapper for accessing ElevenLabs's Text-To-Speech API and converting the results to MP3 files.

ElevenLabsTTS #

pub package

Lightweight wrapper for ElevenLabs's Text-To-Speech API.

  • Video example with ElevenLabs generated voices:

Usage #

  1. Add the package as a dependency to your pubspec.yaml file.

  2. An audio package is required. I recommend AudioPlayers or just_audio.

  3. Initialize ElevenLabs:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize ElevenLabs
  ElevenLabs(apiKey: dotenv.get("API_KEY"));

  runApp(const MyApp());
}
    File file = await ElevenLabs.instance.create(
      // Required
      // Your Input
      text: text,

      // Optional
      // The Voice Id for the Voice.
      // See: https://api.elevenlabs.io/v1/voices
      voiceId: "ErXwobaYiN019PkySvjV",

      // Optional
      // Creates a cached audio file which can then be called by name.
      fileName: "Hello World",

      // Optional
      // Higher stability ensures consistency but may result in monotony, therefore
      // for longer text, it is recommended to decrease stability.
      stability: 1.0,

      // Optional
      // 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,
    );
  • List voices:
    final voices = await ElevenLabs.instance.listVoices();
    for (var i in voices) {
      print(
          'Voice Name: ${i.name}, Voice ID: ${i.voiceId}, Category: ${i.category}');
    }
  • List history:
    final voices = await ElevenLabs.instance.listHistory();
    for (var i in voices) {
      print(
          'Item Id: ${i.historyItemId}, Voice ID: ${i.voiceId}, Voice Name: ${i.voiceName}, Text: ${i.text},');
    }
  • Create audio file from history item id:
    final file = await ElevenLabs.instance.createHistoryAudioId(
      // Required
      // History Item Id
      itemId: "your-history-item-id",

      // Optional
      // Creates a cached audio file which can then be called by name
      fileName: "your-file-name",
    );

See example for more details.


Notice: This package was initally created to be used in-house, as such the development is first and foremost aligned with the internal requirements.

8
likes
0
pub points
60%
popularity

Publisher

unverified uploader

Lightweight wrapper for accessing ElevenLabs's Text-To-Speech API and converting the results to MP3 files.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, path_provider, plugin_platform_interface

More

Packages that depend on elevenlabs