private void StartSpeech(AssignedVoice vb, string outputfile) { WinAvailableVoice wv = (WinAvailableVoice)vb.root; // Find the best audio format to use for this voice. System.Collections.ObjectModel.ReadOnlyCollection <SpeechAudioFormatInfo> formats = wv.winVoice.VoiceInfo.SupportedAudioFormats; format = formats.FirstOrDefault(); if (format == null) { // The voice did not tell us its parameters, so we pick some. format = new SpeechAudioFormatInfo( 16000, // Samples per second AudioBitsPerSample.Sixteen, AudioChannel.Mono); } // First set up to synthesize the message into a WAV file. mstream = new FileStream(outputfile, FileMode.Create, FileAccess.Write); syn.SetOutputToWaveStream(mstream); pb = new PromptBuilder(); mainStyle = new PromptStyle(); // mainStyle.Volume = promptVol; syn.SelectVoice(wv.winVoice.VoiceInfo.Name); pb.StartStyle(mainStyle); }
public VoiceAssignment(PluginControl pc, string name, UUID id) { control = pc; avatarName = name; avatarId = id; InitializeComponent(); control.talker.SayMore("Assign a voice for " + avatarName, BeepType.Open); // Inhibit demonstrations until constructore is done. doDemo = false; // Populate the fixed fields avName.Text = avatarName; library = control.talker.voices.voiceLibrary; foreach (string vname in library.Keys) { AvailableVoice v = library[vname]; voiceList.Items.Add(v.Name); } // Set the current name, if any. voiceList.ClearSelected(); voiceName = null; AssignedVoice av = null; // First check the assigned voices. av = control.talker.voices.VoiceFor(id, false); // A voice has been assigned, so indicate that. if (av != null) { voiceName = av.root.Name; voice = library[voiceName]; rateSelector.SelectedIndex = av.rateModification + 1; pitchSelector.SelectedIndex = av.pitchModification + 1; SelectByName(voiceName); } doDemo = true; Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); }