private void OnGetVoicesResp(RESTConnector.Request req, RESTConnector.Response resp) { Voices voices = new Voices(); if (resp.Success) { try { fsData data = null; fsResult r = fsJsonParser.Parse(Encoding.UTF8.GetString(resp.Data), out data); if (!r.Succeeded) { throw new WatsonException(r.FormattedMessages); } object obj = voices; r = sm_Serializer.TryDeserialize(data, obj.GetType(), ref obj); if (!r.Succeeded) { throw new WatsonException(r.FormattedMessages); } } catch (Exception e) { Log.Error("NLC", "GetVoices Exception: {0}", e.ToString()); resp.Success = false; } } if (((GetVoicesReq)req).Callback != null) { ((GetVoicesReq)req).Callback(resp.Success ? voices : null); } }
/// <summary> /// List voices. /// /// Lists all voices available for use with the service. The information includes the name, language, gender, /// and other details about the voice. To see information about a specific voice, use the **Get a voice** /// method. /// </summary> /// <param name="customData">Custom data object to pass data including custom request headers.</param> /// <returns><see cref="Voices" />Voices</returns> public Voices ListVoices(Dictionary <string, object> customData = null) { Voices result = null; try { IClient client; if (_tokenManager == null) { client = this.Client.WithAuthentication(this.UserName, this.Password); } else { client = this.Client.WithAuthentication(_tokenManager.GetToken()); } var restRequest = client.GetAsync($"{this.Endpoint}/v1/voices"); if (customData != null) { restRequest.WithCustomData(customData); } result = restRequest.As <Voices>().Result; if (result == null) { result = new Voices(); } result.CustomData = restRequest.CustomData; } catch (AggregateException ae) { throw ae.Flatten(); } return(result); }
private void ExecuteMoveUpCommand() { VoiceViewModel[] sortedSelectedVoices = SelectedVoices.OrderBy(voice => voice.Index).ToArray(); foreach (VoiceViewModel voice in sortedSelectedVoices) { Voices.Move(voice.Index, voice.Index - 1); VoiceViewModel voiceAbove = Voices.Single(v => v.Index == voice.Index - 1); if (voiceAbove.LiveSetIndex < 8) { voiceAbove.LiveSetIndex++; } else { voiceAbove.LiveSetIndex = 1; voiceAbove.LiveSetPage++; } if (voice.LiveSetIndex > 1) { voice.LiveSetIndex--; } else { voice.LiveSetIndex = 8; voice.LiveSetPage--; } } }
private void LoadFile(string path) { try { x9aFile = ParseX9A(path); } catch (Exception ex) { TaskDialog taskDialog = new TaskDialog(); taskDialog.MainIcon = TaskDialogIcon.Error; taskDialog.Content = "X9A Editor cannot read this file, most likely because it was created using an unsupported CP88/CP73 firmware version.\r\n\r\nPlease report this issue on <a href=\"https://github.com/chausner/X9AEditor\">GitHub</a>."; taskDialog.ExpandedInformation = ex.ToString(); taskDialog.EnableHyperlinks = true; taskDialog.AllowDialogCancellation = true; taskDialog.WindowTitle = "Error opening file"; taskDialog.Buttons.Add(new TaskDialogButton(ButtonType.Ok)); taskDialog.HyperlinkClicked += (sender, e) => Process.Start(e.Href); taskDialog.ShowDialog(); return; } LoadedFilePath = path; Voices.Clear(); for (int i = 0; i < x9aFile.Voices.Length; i++) { Voices.Add(new VoiceViewModel((X9aFile.Voice)x9aFile.Voices[i].Clone(), (i / 8) + 1, (i % 8) + 1, this)); } }
private void SetVoiceLevel(Voices level, bool net = true) { voiceLevel = level; if (voiceLevel == Voices.Whisper) { voiceLevelStr = $"Whisper ({levelWhisper}m)"; } else if (voiceLevel == Voices.Default) { voiceLevelStr = $"Default ({levelDefault}m)"; } else if (voiceLevel == Voices.Shout) { voiceLevelStr = $"Shout ({levelShout}m)"; } nuiModule.SetVoiceLevel(voiceLevelStr); if (net) { Client.TriggerServerEvent("Voice.PlayerVoiceLevelChanged", (int)voiceLevel); } script.Log($"Voice level set to {voiceLevelStr}"); }
public static async void SpeakContentAsync (String content, Boolean isSsml, String voiceId) { if (String.IsNullOrWhiteSpace(content)) { return; } // Find the voice with the matching Id or just use the default var voice = Voices.FirstOrDefault(x => x.Id == voiceId) ?? DefaultVoice; using (var synthesizer = new SpeechSynthesizer { Voice = voice }) { // NOTE - if Synthesize___ToStreamAsync throws an Access Denied exception, // there is a known problem with some fresh Windows 8.1 installations. // Additional information about the problem and its remedy (clearing // a bad permission entry for a registry value) can be found at http://j.mp/1o2eeJL // Get the voice stream for the given text var voiceStream = isSsml ? await synthesizer.SynthesizeSsmlToStreamAsync(content) : await synthesizer.SynthesizeTextToStreamAsync(content); // Create a new MediaElement and use it to play the voice stream var mediaElement = new MediaElement(); mediaElement.SetSource(voiceStream, voiceStream.ContentType); mediaElement.Play(); } }
//! @cond NODOC /// Remove AudioSource not playing /// </summary> protected IEnumerator <float> ThreadDestroyAllVoice() { try { fluid_voice[] voicesList = GetComponentsInChildren <fluid_voice>(); //Debug.LogFormat("DestroyAllVoice {0}", (voicesList != null ? voicesList.Length.ToString() : "no voice found")); if (voicesList != null) { foreach (fluid_voice voice in voicesList) { try { // Debug.Log("Destroy " + voice.IdVoice + " " + (voice.Audiosource.clip != null ? voice.Audiosource.clip.name : "no clip")); // Don't delete audio source template if (voice.name.StartsWith("VoiceId_")) { Destroy(voice.gameObject); } } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } } Voices.Clear(); } //audiosources = new List<AudioSource>(); } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } yield return(0); }
public bool GenerateAudioFromText(string text, Voices voice) { if (isPlaying || voice == null) { return(false); } SpeachToTextCommand command = new SpeachToTextCommand { action = "speechSynthesis", activityAddress = MagicRoomManager.instance.HttpListenerForMagiKRoom.Address + ":" + MagicRoomManager.instance.HttpListenerForMagiKRoom.Port + "/" + endpoint, text = text, voice = voice.name }; MagicRoomManager.instance.Logger.AddToLogNewLine("ServerTTSO", text + "," + voice.name + " started"); StartCoroutine(SendCommand(command, (body) => { isPlaying = true; StartSpeak?.Invoke(); }, () => { StartSpeak?.Invoke(); EndSpeak?.Invoke(); isPlaying = false; })); return(true); }
private void OnCheckService(Voices voices) { if (m_Callback != null) { m_Callback(SERVICE_ID, voices != null); } }
//method used to take the voice id of this line manager, and cycle it by 1 along the list of voices. public void cycleVoices() { int voiceID = (int)voice; voiceID = (voiceID + 1) % Voices.GetNames(typeof(Voices)).Length; voice = (Voices)voiceID; setVoiceColour(); }
private void button2_Click(object sender, EventArgs e) { int index = listView1.SelectedIndices[0]; Legends.RemoveAt(index); Voices.RemoveAt(index); amount_voices -= 1; LoadLegends(); }
private void OnGetVoices(Voices voices) { Log.Debug("ExampleTextToSpeech", "-----OnGetVoices-----"); foreach (Voice voice in voices.voices) { Log.Debug("ExampleTextToSpeech", "Voice | name: {0} | gender: {1} | language: {2} | customizable: {3} | description: {4}.", voice.name, voice.gender, voice.language, voice.customizable, voice.description); } Log.Debug("ExampleTextToSpeech", "-----OnGetVoices-----"); }
public bool GenerateAudioFromText(string text) { Voices voice = ListOfVoice.FirstOrDefault(x => x.alias == "Magika"); if (voice != null) { return(GenerateAudioFromText(text, voice)); } return(false); }
private void button3_Click(object sender, EventArgs e) { Legends.RemoveRange(0, Legends.Count); Voices.RemoveRange(0, Voices.Count); amount_voices = 0; LoadLegends(); pictureBox1.BackColor = Color.FromArgb(240, 240, 240); mode = 0; textBox1.Text = "Статистика:"; }
public void GetVoices() { var installedVoices = _synth.GetInstalledVoices(); // Variable for debug. var installedVoicesCount = installedVoices.Count; //installedVoicesCount = 0; if (installedVoicesCount == 0) { throw new Exception(@"No se encontraron voces instaladas"); } if (Voices == null) { Voices = new List <string>(); } // Output information about all of the installed voices. Debug.WriteLine(@"Installed voices -"); foreach (var voice in installedVoices) { var info = voice.VoiceInfo; var infoDescription = info.Description; string auxvoice; if (infoDescription.StartsWith("Microsoft")) { auxvoice = infoDescription; } else { //auxvoice = info.Name; continue; } if (!Voices.Contains(auxvoice)) { Voices.Add(auxvoice); } var audioFormats = ""; foreach (var fmt in info.SupportedAudioFormats) { audioFormats += $"{fmt.EncodingFormat.ToString()}\n"; } Debug.WriteLine(@" Name: " + info.Name); Debug.WriteLine(@" Culture: " + info.Culture); Debug.WriteLine(@" Age: " + info.Age); Debug.WriteLine(@" Gender: " + info.Gender); Debug.WriteLine(@" Description: " + infoDescription); Debug.WriteLine(@" ID: " + info.Id); Debug.WriteLine(@" Enabled: " + voice.Enabled); Debug.WriteLine(info.SupportedAudioFormats.Count != 0 ? $@" Audio formats: {audioFormats}" : @" No supported audio formats found"); Debug.WriteLine($@" Additional Info - {info.AdditionalInfo.Keys.Aggregate("", (current, key) => current + $" {key}: {info.AdditionalInfo[key]}\n")}"); } }
public Measure(Track track = null, MeasureHeader header = null) : this() { if (Voices.Count == 0) { for (int x = 0; x < MaxVoices; x++) { Voices.Add(new Voice(this)); } } this.Header = header; this.Track = track; }
private void button1_Click(object sender, EventArgs e) { if (amount_voices >= 10) { MessageBox.Show("Превышено количество добавлений"); } else { Legends.Add(textBox3.Text); Voices.Add(int.Parse(textBox2.Text)); amount_voices++; LoadLegends(); } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(gameObject); return; } audioSource = GetComponent <AudioSource>(); }
public void Clear() { IsUpdate = false; VoiceType = PlayerInformation.Info.PType; BehType = BehaviorType.None; Targets.Clear(); Damages.Clear(); Abnormals.Clear(); IsHit.Clear(); //IsDeath.Clear(); KillList.Clear(); Effects.Clear(); Sounds.Clear(); Voices.Clear(); Messages.Clear(); }
private void SetNextVoiceLevel() { if (voiceLevel == Voices.Whisper) { voiceLevel = Voices.Default; } else if (voiceLevel == Voices.Default) { voiceLevel = Voices.Shout; } else if (voiceLevel == Voices.Shout) { voiceLevel = Voices.Whisper; } SetVoiceLevel(voiceLevel); }
public NotificationSettingsViewModel(Languages languages) { random = new Random(); Languages = languages; testState = new State(JsonConvert.DeserializeObject <List <EntryData> >(IOUtils.GetEntryDatasJson()), languages, "Count"); testState.Blueprints = new List <Blueprint>(JsonConvert.DeserializeObject <List <Blueprint> >(IOUtils.GetBlueprintsJson(), new BlueprintConverter(testState.Cargo))); testCommanderNotifications = new CommanderNotifications(testState); testCommanderNotifications.SubscribeNotifications(); NotificationKindThresholdReached = SettingsManager.NotificationKindThresholdReached; NotificationKindCargoAlmostFull = SettingsManager.NotificationKindCargoAlmostFull; NotificationKindBlueprintReady = SettingsManager.NotificationKindBlueprintReady; SelectedVoice = Voices.FirstOrDefault(v => v.Item2 == SettingsManager.NotificationVoice) ?? Voices.FirstOrDefault(); }
/// <summary> /// Retrieves all voices available for speech synthesis. Lists information about all available voices. To see information about a specific voice, use the `GET /v1/voices/{voice}` method. /// </summary> /// <returns><see cref="Voices" />Voices</returns> public Voices ListVoices() { Voices result = null; try { var request = this.Client.WithAuthentication(this.UserName, this.Password) .GetAsync($"{this.Endpoint}/v1/voices"); result = request.As <Voices>().Result; } catch (AggregateException ae) { throw ae.Flatten(); } return(result); }
private void GetVoices() { var voices = SpeechSynthesizer.AllVoices; var defaultVoice = SpeechSynthesizer.DefaultVoice; // Put the VoiceInformation into an VoiceModel foreach (VoiceInformation voice in voices) { var voiceModel = new VoiceModel(voice); Voices.Add(voiceModel); // Check for the default voice of the system and if true set it as the currently selected voice if (voiceModel.VoiceId == defaultVoice.Id) { SelectedVoice = voiceModel; } } }
//public bool IsSpeaking => _synth.State == SynthesizerState.Speaking; public Voice(Action speakCompleted) { try { _synth = new SpeechSynthesizer(); GetVoices(); // Load an spanish voice or the first. ChangeCurrentVoice(Voices.FirstOrDefault(x => x.Contains("Spanish")) ?? Voices[0]); Msgs = new Queue <string>(); SpkCompleted = speakCompleted; _synth.StateChanged += SynthStateChanged; TskLoadVolController = Task.Run(LoadVolumeSett); } catch (Exception exc) { throw new Exception($"Error en la configuración de la voz de la aplicación:\n{exc.Message}"); } }
private void DrawDownDiagram(Graphics g) { int all_voice = Voices.Sum(); float sweepAngle, startAngle = 0; for (int i = 0; i < Voices.Count; i++) { if (i == Voices.Count - 1) { sweepAngle = 360 - startAngle; } else { sweepAngle = (Voices[i] * 360) / all_voice; } g.FillPie(HatchBrushes[i], 375, 350, 300, 300, startAngle, sweepAngle); startAngle += sweepAngle; } }
public void Play(string words) { if (string.IsNullOrEmpty(words)) { return; } if (Speaking) { Queue.Add(words); } else { Speaking = true; Queue.RemoveAll(words.Equals); speaker.SelectVoice(Voices.Contains(SelectedVoice) ? SelectedVoice : Voices.FirstOrDefault()); speaker.SpeakAsync(words); } }
public bool ParseAllVoices() { Voices.Load(); for (int i = 0; i < Voices.VoiceList.Count; i++) { Voice voicelist = Voices.VoiceList[i]; if (Utils.Parse("123", voicelist.VoiceFile) == "") { TestContext.Progress.WriteLine($"[{i+1}/{Voices.VoiceList.Count}] {voicelist.Name} NOT PASSED"); return(false); } else { TestContext.Progress.WriteLine($"[{i+ 1}/{Voices.VoiceList.Count}]" + voicelist.Name + " PASSED"); } } return(true); }
public Voice(Action speakCompleted) { //TODO:Check Voices.Count>0 try { _synth = new SpeechSynthesizer(); GetVoices(); ChangeCurrentVoice(Voices.FirstOrDefault(x => x.Contains("Spanish")) ?? Voices[0]); _msgs = new Queue <string>(); _spkCompleted = speakCompleted; _synth.StateChanged += SynthStateChanged; ThVolumeSett = new Thread(ThLoadVolumeSett); ThVolumeSett.Start(); } catch (Exception exc) { throw new Exception($"Error en la configuración de la voz de la aplicación:\n{exc.Message}"); } }
private void DrawUpDiagram(Graphics g) { Font f = new Font("Arial", 10, FontStyle.Bold); g.DrawLine(new Pen(Color.Black, 5), 30, 250, 30, 75); g.DrawLine(new Pen(Color.Black, 5), 30, 75, 20, 85); g.DrawLine(new Pen(Color.Black, 5), 30, 75, 40, 85); g.DrawLine(new Pen(Color.Black, 5), 30, 250, 700, 250); g.DrawLine(new Pen(Color.Black, 5), 700, 250, 690, 240); g.DrawLine(new Pen(Color.Black, 5), 700, 250, 690, 260); g.DrawString("V", f, Brushes.Red, 15, 45); g.DrawString("L", f, Brushes.Red, 710, 230); int max_voice = Voices.Max(), x = 0, height; for (int i = 0; i < Voices.Count; i++) { height = (Voices[i] * 150) / max_voice; g.FillRectangle(HatchBrushes[i], 50 + x, 250 - height, 40, height); x += 60; } }
public IEnumerator TestListVoices() { Log.Debug("TextToSpeechServiceV1IntegrationTests", "Attempting to ListVoices..."); Voices listVoicesResponse = null; service.ListVoices( callback: (DetailedResponse <Voices> response, IBMError error) => { Log.Debug("TextToSpeechServiceV1IntegrationTests", "ListVoices result: {0}", response.Response); listVoicesResponse = response.Result; Assert.IsNotNull(listVoicesResponse); Assert.IsNotNull(listVoicesResponse._Voices); Assert.IsTrue(listVoicesResponse._Voices.Count > 0); Assert.IsNull(error); } ); while (listVoicesResponse == null) { yield return(null); } }