private void Timer_Tick(object sender, EventArgs e) { if (learningProcess) { prgBar.Value = lPr; if (lPr > 99) { this.Close(); } } else if (timer.Interval == new TimeSpan(0, 0, 20)) { testedNote++; lbNote.Content = "Pause"; capturer.StopRecording(); if (testedNote.ToInt() == 0) { learningProcess = true; capturer.StopRecording(); btnStart.IsEnabled = false; btnStop.IsEnabled = false; lbNote.Content = "End"; prgBar.Value = 0; Task.Factory.StartNew(() => Learn()); } timer.Interval = new TimeSpan(0, 0, 2); prgBar.Value = testedNote.ToInt() * 100 / 61; samplesOneType = 0; lbSampleCount.Content = samplesOneType; } else { timer.Interval = new TimeSpan(0, 0, 20); lbNote.Content = testedNote.ToString(); capturer.StartRecording(); } }
static public NeuralNet.Sample GetSampleFromModel(FrequencyModel model, Note n) { double[] data = new double[model.Data.Count]; int i = 0; foreach (var x in model.GetHighestData()) { data[i] = x.Value; i++; } double[] pred = new double[61]; pred[n.ToInt()] = 1; return(new NeuralNet.Sample(data, pred)); }