private void ShowSpeechTypeVariation(SpeechVisualizer visualizer, SpeechTypeSpecification speechTypeSpecification, double deltaTime) { double time = 0; double lastTime = speechTypeSpecification.TimeSpeechTypeTupleList.Last().Item1; visualizer.MarkerList = new List <SoundMarker>(); while (time < lastTime) { SoundMarker marker = new SoundMarker(); marker.Type = SoundMarkerType.HorizontalLine; marker.Thickness = 4; marker.Start = (float)(time - 0.25 * deltaTime); marker.End = (float)(time + 0.25 * deltaTime); SpeechType speechType = speechTypeSpecification.GetSpeechType(time); if (speechType == SpeechType.Silence) { marker.Color = Color.Yellow; marker.Level = 28000; } else if (speechType == SpeechType.Voiced) { marker.Color = Color.Lime; marker.Level = 32000; } else { marker.Color = Color.Red; marker.Level = 30000; } visualizer.MarkerList.Add(marker); time += deltaTime; } visualizer.Invalidate(); }
private void soundTypeIdentificationButton_Click(object sender, EventArgs e) { soundTypeIdentificationButton.Enabled = false; SpeechTypeEstimator speechTypeEstimator = speechModifier.SpeechTypeEstimator; speechTypeEstimator.FindSpeechTypeVariation(currentSound); // , 0, 0.020, 0.010, 550, 0.02, 250000, 2500); // speechTypeEstimator.Adjust(3); // speechTypeEstimator.Adjust(3); // repeat the adjustment to remove double errors. ShowSpeechTypeVariation(speechVisualizer, speechTypeEstimator.SpeechTypeSpecification, 0.01); speechTypeSpecification = speechTypeEstimator.SpeechTypeSpecification; findPitchPeriodsButton.Enabled = true; }