static public NeuralNet.Sample GetSampleFromModel(FrequencyModel model) { double[] data = new double[model.Data.Count]; int i = 0; foreach (var x in model.GetHighestData()) { data[i] = x.Value; i++; } return(new NeuralNet.Sample(data, new double[61])); }
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)); }
private void Capturer_NewPick(object sender, AudioPickEventArgs e) { if (DateTime.Now - lastSound > new TimeSpan(0, 0, 0, 0, 150)) { var t0 = DateTime.Now; FrequencyModel test = new FrequencyModel(new Dictionary <float, float>()); Task t = Task.Factory.StartNew(() => { test = SoundCalculator.GetFrequencyModel(e.pickData); }); renderer.Render(e.pickData, 0); t.Wait(); appInfo.SetFrequency(test.FirstTone); Note n = noteFinder.getNoteFromModel(test); appInfo.SetNote(n); testSong.AddNote(n, t0); } lastSound = DateTime.Now; }
public Note getNoteFromModel(FrequencyModel model) { return((Note)(m_noteNetwork.Predict(SoundCalculator.GetSampleFromModel(model)))); }