Beispiel #1
0
        static void audioGraph_FFTCalculated(object sender, SampleProcessor.FftEventArgs e)
        {
            var gainer = new MFCCGainer(26, e.Result.Count, e.SampleRate);

            buffer.Add(gainer.getCoefficents(e.Result));
            var notes = classifier.getNotes(e.Result);

            //Console.WriteLine(String.Join(", ", notes.Distinct()));
            if (buffer.Count == 15)
            {
                if (!isTest)
                {
                    Console.WriteLine("Current ErrorSum: {0}", network.errorSum);
                    var results = network.Teach(buffer, MarkedValues[currentInstrument]);
                    for (int i = 0; i < results.Count; i++)
                    {
                        Console.WriteLine("{0} - {1:00.00}%", instruments[i], results[i] * 100);
                    }
                }
                else
                {
                    var results = network.GetResults(buffer);
                    for (int i = 0; i < results.Count; i++)
                    {
                        if (results[i] > 0.5)
                        {
                            testMap[currentInstrument].Add(instruments[i]);
                            //Console.WriteLine("{0} - {1}", currentInstrument, instruments[i]);
                        }
                    }
                }
                buffer.RemoveAt(0);
            }
        }
Beispiel #2
0
        static void audioGraph_FFTCalculated(object sender, SampleProcessor.FftEventArgs e)
        {
            var gainer = new MFCCGainer(26, e.Result.Count, e.SampleRate);

            buffer.Add(gainer.getCoefficents(e.Result));

            if (buffer.Count == 10)
            {
                var result = network.GetResults(buffer);
                for (int i = 0; i < result.Count; i++)
                {
                    if (result[i] > 0.4)
                    {
                        Console.WriteLine("{0} - {1}%", instruments[i], result[i] * 100);
                    }
                }
                buffer.Clear();
            }
        }