예제 #1
0
파일: Program.cs 프로젝트: Luqaz/NoteGen
        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);
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: Luqaz/NoteGen
        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();
            }
        }
예제 #3
0
        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 == 15)
            {
                var notes             = classifier.getNotes(e.Result);
                var instrumentsValues = network.GetResults(buffer);
                notesLabel.Content = String.Join("\n", notes);
                String instrs = "";
                for (int i = 0; i < instrumentsValues.Count; i++)
                {
                    instrs += String.Format("{0} - {1}\n", instruments[i], instrumentsValues[i]);
                }
                instrumentsLabel.Content = instrs;
                buffer.RemoveAt(0);
            }
        }