Skip to main content

flutter_edge_tts 0.0.3 copy "flutter_edge_tts: ^0.0.3" to clipboard
flutter_edge_tts: ^0.0.3 copied to clipboard

A free Flutter TTS package powered by Microsoft Edge online speech synthesis.

flutter_edge_tts #

Version License: MIT and LGPL-3.0 Platform: Android+iOS+macOS+Windows+Linux

English δΈ­ζ–‡

A free Flutter TTS package powered by Microsoft Edge online speech synthesis.

flutter_edge_tts provides a shared Dart synthesis layer for Android, iOS, macOS, Windows, and Linux, with a consistent API for voice discovery, text and SSML synthesis, file output, and synthesis metadata.

Features #

  • Free and open-source Flutter TTS package
  • Shared Dart implementation for mobile and desktop Flutter apps
  • Live voice discovery from the Microsoft Edge online speech synthesis endpoint
  • Supports text synthesis to bytes, files, or stream events
  • Supports raw SSML synthesis
  • Supports optional sentence and word boundary metadata
  • Supports MP3, WebM, Ogg, and raw PCM output formats, plus local PCM16 WAV file export
  • As of 2026-06-03, the live endpoint returns 322 voices across 142 locales and 75 languages

Platform support #

  • Android
  • iOS
  • macOS
  • Windows
  • Linux

Preview #

Mobile Desktop
iPhone preview 1 iPhone preview 2 macOS preview 1
macOS preview 2

Installation #

dependencies:
  flutter_edge_tts: ^0.0.2
flutter pub get

Quick start #

import 'package:flutter_edge_tts/flutter_edge_tts.dart';

final tts = FlutterEdgeTts(
  voice: 'en-US-AriaNeural',
  outputFormat: EdgeTtsOutputFormat.audio24Khz96KbitrateMonoMp3,
);

final result = await tts.synthesize('Hello from Flutter.');
print(result.audioBytes.length);

await tts.close();

Core API #

Load voices #

final voices = await tts.getVoices();
print(voices.first.shortName);

Synthesize text #

final result = await tts.synthesize(
  'Hello from Flutter.',
  prosody: const EdgeTtsProsody(
    rate: '1.05',
    pitch: '+10Hz',
    volume: '100',
  ),
);

Synthesize to files #

final result = await tts.synthesizeToFile(
  'Hello from Flutter.',
  audioFilePath: '/tmp/edge.mp3',
  metadataFilePath: '/tmp/edge.json',
);

Export a WAV file #

final result = await tts.synthesizeToWavFile(
  'Hello from Flutter.',
  audioFilePath: '/tmp/edge.wav',
  metadataFilePath: '/tmp/edge.json',
);

synthesizeToWavFile and synthesizeSsmlToWavFile request the working 24 kHz Edge MP3 format, decode it locally, then write a standard PCM16 RIFF/WAVE file. The output preserves the decoder-reported sample rate and channel count; it is not a lossless recovery of the source before MP3 compression.

Stream synthesis events #

final stream = tts.synthesizeStream(
  'Hello from Flutter.',
  prosody: const EdgeTtsProsody(rate: '1.1', pitch: '+20Hz'),
);

await for (final event in stream) {
  if (event is EdgeTtsAudioChunkEvent) {
    print(event.chunk.length);
  } else if (event is EdgeTtsMetadataEvent) {
    print(event.metadata.items.length);
  }
}

Synthesize raw SSML #

final ssml = '''
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
  <voice name="en-US-AriaNeural">
    <prosody rate="1.05" pitch="+10Hz">
      Hello from raw SSML.
    </prosody>
  </voice>
</speak>
''';

final result = await tts.synthesizeSsml(ssml);

Configuration #

final tts = FlutterEdgeTts(
  voice: 'en-US-AriaNeural',
  voiceLocale: 'en-US',
  outputFormat: EdgeTtsOutputFormat.audio24Khz96KbitrateMonoMp3,
  enableSentenceBoundary: true,
  enableWordBoundary: true,
);
tts.updateConfig(
  tts.config.copyWith(
    voice: 'en-GB-SoniaNeural',
    enableWordBoundary: true,
  ),
);

Voice naming and compatibility #

Common voice names look like:

  • en-US-AriaNeural
  • en-US-AndrewMultilingualNeural

The locale prefix identifies the primary locale of the voice. The package uses this naming pattern to infer a default voiceLocale when one is not provided explicitly.

The broader Microsoft Azure Speech ecosystem includes voice families such as Neural, MultilingualNeural, Neural HD, and MAI-Voice-1. This package is implemented around the Edge Read Aloud style transport path rather than the full Azure Speech SDK surface, so standard neural voices are the safest default choice. Advanced Azure-only voice families should be validated in your own environment before being exposed as supported options.

The Edge Read Aloud endpoint does not return bytes for direct WAV (riff-24khz-16bit-mono-pcm) requests. Do not use that output format. Use the local WAV file APIs above, raw PCM, or a container format such as MP3, WebM, or Ogg instead.

For production integrations, prefer voices returned by getVoices() over hard-coded assumptions.

Metadata #

When sentence or word boundary metadata is enabled, synthesis can return structured metadata alongside audio. This is useful for read-along highlighting, subtitle timing, accessibility flows, and language learning interfaces.

Example app #

A runnable demo app is included in example/lib/main.dart. It demonstrates voice loading, voice selection, output format selection, metadata toggles, and file synthesis.

Notes #

  • The high-level text API escapes text by default. Raw SSML should still be XML-safe.
  • Audio playback is intentionally left to the host app.
  • Voice and language counts come from the live endpoint and may change over time.
  • Upstream service behavior can change over time. If request headers, websocket framing, or voice endpoints change, the package may need to be updated.

Project #

License #

The package is MIT licensed, except the Edge v2 authentication implementation in lib/src/utils/edge_tts_utils.dart, which is a modified port of rany2/edge-tts and is licensed under LGPL-3.0-or-later. See NOTICE for copyright and source information.

4
likes
150
points
1.09k
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A free Flutter TTS package powered by Microsoft Edge online speech synthesis.

Repository (GitHub)
View/report issues

Topics

#tts #edge-tts #text-to-speech #speech-synthesis #audio

License

MIT (license)

Dependencies

audio_decode, crypto, flutter, http

More

Packages that depend on flutter_edge_tts