/// <summary>
        /// decide if the voice is man's or woman's
        /// </summary>
        public void identification()
        {
            string filename = Environment.CurrentDirectory + "/gamma.txt";
            string gamma    = File.ReadAllText(filename);
            double gamma1   = Convert.ToDouble(gamma);
            int    nf       = 700;

            Console.WriteLine("Start FFT...");
            FFT hitungFft = new FFT();

            Console.WriteLine("waiting for process...");
            Complex[]  X = hitungFft.fft(x, nf, 300);
            getMaxFreq maximumFrequency = new getMaxFreq();
            int        max = maximumFrequency.MaxFreq(X);

            Console.WriteLine("");
            Console.WriteLine("Maximum frequency is " + max + " Hz");
            if ((double)max < gamma1)
            {
                Console.Write("Result = ");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write("male voice");
                Console.ResetColor();
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("=====================================");
                Console.WriteLine("");
                genderResult hasil = new genderResult {
                    name = "GenderIdentification", gender = "male"
                };
                string body = JsonConvert.SerializeObject(hasil);                           //serialisasi data menjadi string
                byte[] a    = Encoding.UTF8.GetBytes(body);
                channelSendGender.BasicPublish("amq.topic", channelKeySendGender, null, a); //mengirim data ke RabbitMQ
            }
            else
            {
                Console.Write("Result = ");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("female voice");
                Console.ResetColor();
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("=====================================");
                Console.WriteLine("");
                genderResult hasil = new genderResult {
                    name = "GenderIdentification", gender = "female"
                };
                string body = JsonConvert.SerializeObject(hasil);                           //serialisasi data menjadi string
                byte[] a    = Encoding.UTF8.GetBytes(body);
                channelSendGender.BasicPublish("amq.topic", channelKeySendGender, null, a); //mengirim data ke RabbitMQ
            }
        }
        /// <summary>
        /// produce gamma and write maximum frequency to csv file
        /// </summary>
        public void machineLearning()
        {
            Console.WriteLine("================================================================================");
            Console.WriteLine("                           Gender Training Program");
            Console.WriteLine("");
            Console.WriteLine("================================================================================");

            // Preparing wave file
            Console.WriteLine("preparing wave file...");
            Console.WriteLine("");
            getAudioData getWave = new getAudioData();

            Console.WriteLine("wave file is ready.");
            Console.WriteLine("");
            Console.WriteLine("================================================================================");
            long          totalFreqFe = 0;
            int           totalNFe    = 0;
            string        csvPath     = Environment.CurrentDirectory + "/frequency.csv";
            StringBuilder sb          = new StringBuilder();

            sb.Append(string.Format("female,"));
            int nf = 700;

            Console.WriteLine("processing female frequency...");
            for (int i = 1; i <= 5; i++)
            {
                string     filename         = Environment.CurrentDirectory + @"/female/" + i + "_female.wav";
                double[]   x                = getWave.WaveReady(filename);
                FFT        hitungFft        = new FFT();
                Complex[]  X                = hitungFft.fft(x, nf, 300);
                getMaxFreq maximumFrequency = new getMaxFreq();
                int        max              = maximumFrequency.MaxFreq(X);
                Console.WriteLine("Maximum Frequency of number " + i + " is " + max + " Hz");
                sb.Append(string.Format("{0},", max.ToString()));
                totalFreqFe = totalFreqFe + max;
                totalNFe++;
            }
            sb.Append(string.Format("{0}", Environment.NewLine));
            double feAvg       = totalFreqFe / totalNFe;
            long   totalFreqMa = 0;
            int    totalNMa    = 0;

            sb.Append(string.Format("male,"));
            Console.WriteLine("");
            Console.WriteLine("processing male frequency...");
            for (int i = 1; i <= 5; i++)
            {
                string     filename         = Environment.CurrentDirectory + @"/male/" + i + "_male.wav";
                double[]   x                = getWave.WaveReady(filename);
                FFT        hitungFft        = new FFT();
                Complex[]  X                = hitungFft.fft(x, nf, 300);
                getMaxFreq maximumFrequency = new getMaxFreq();
                int        max              = maximumFrequency.MaxFreq(X);
                Console.WriteLine("Maximum Frequency of number " + i + " is " + max + " Hz");
                sb.Append(string.Format("{0},", max.ToString()));
                totalFreqMa = totalFreqMa + max;
                totalNMa++;
            }
            double maAvg = totalFreqMa / totalNMa;
            double gamma = (feAvg + maAvg) / 2;

            Console.WriteLine("");
            Console.WriteLine("Treshold value: " + gamma);
            string txtPath = Environment.CurrentDirectory + "/gamma.txt";

            File.WriteAllText(txtPath, gamma.ToString());
            File.WriteAllText(csvPath, sb.ToString());
            Console.WriteLine("");
            Console.WriteLine("Press any key to continue..");
            Console.ReadKey();
        }