using System; using System.Collections.Generic; using Xamarin.Essentials; using Xamarin.Forms; namespace SampleApp.Views { public partial class Functionality17 : ContentPage { float volume; float pitch; public Functionality17() { InitializeComponent(); volume = 0.5f; pitch = 1.0f; } void Slider_Volume_ValueChanged(System.Object sender, Xamarin.Forms.ValueChangedEventArgs e) { volume = Convert.ToSingle(e.NewValue); var settings = new SpeechOptions() { Volume = Convert.ToSingle(e.NewValue) }; } void Slider_Pitch_ValueChanged(System.Object sender, Xamarin.Forms.ValueChangedEventArgs e) { pitch = Convert.ToSingle(e.NewValue); var settings = new SpeechOptions() { Pitch = Convert.ToSingle(e.NewValue) }; } void Button_Clicked(System.Object sender, System.EventArgs e) { var settings = new SpeechOptions() { Volume = volume, Pitch = pitch }; TextToSpeech.SpeakAsync(TextToRead.Text, settings); } } }