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

outdated

Flutter implementation of Microsoft Azure Cognitives Text-To-Speech

example/lib/main.dart

import 'package:flutter_azure_tts/flutter_azure_tts.dart';
import 'package:flutter_azure_tts/src/audio/audio_output_format.dart';
import 'package:flutter_azure_tts/src/tts/tts_params.dart';

void main() async {
  await AzureTts.init(
      subscriptionKey: "YOUR SUBSCRIPTION KEY",
      region: "YOUR REGION");

  // Get available voices
  final voicesResponse = await AzureTts.getAvailableVoices() as VoicesSuccess;

  //Pick a Neural voice
  final voice = voicesResponse.voices.where((element) =>
          element.voiceType == "Neural" && element.locale.startsWith("en-"))
      .toList(growable: false)[0];

  //List all available voices
  print("${voicesResponse.voices}");

  final text = "Microsoft Speech Service Text-to-Speech API";

  TtsParams params = TtsParams(voice: voice, audioFormat: AudioOutputFormat.audio16khz32kBitrateMonoMp3, text: text);
  final ttsResponse = await AzureTts.getTts(params) as AudioSuccess;

  //Get the audio bytes.
  print("${ttsResponse.audio}");
}
31
likes
0
pub points
83%
popularity

Publisher

verified publisherghuyfel.com

Flutter implementation of Microsoft Azure Cognitives Text-To-Speech

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

build_runner, equatable, http, json_annotation, json_serializable

More

Packages that depend on flutter_azure_tts