private void TestAudio_Click(object sender, EventArgs e)
        {
            saveFileDialog1.ShowDialog();
            string FilePath = saveFileDialog1.FileName;

            signal = AudioOperations.OpenAudioFile(FilePath);
            Sequence TestSequence = AudioOperations.ExtractFeatures(signal);

            Sequence VoiceSequence;

            FileStream   FS = new FileStream("test2.txt", FileMode.Open, FileAccess.Read);
            StreamReader SR = new StreamReader(FS);

            int NoOfVoices = (int)FS.ReadByte();

            ReadVoices = new RWFile(NoOfVoices);

            DTW.VoiceDifferences = new double[NoOfVoices];

            for (int i = 0; i < NoOfVoices; i++)
            {
                VoiceSequence           = new Sequence();
                VoiceSequence           = ReadVoices.ReadFromFile(FS, SR, i);
                K                       = Math.Abs(TestSequence.NoOfFrames - VoiceSequence.NoOfFrames);
                DTW.VoiceDifferences[i] = DTW.Compare(TestSequence, VoiceSequence, 2);
            }
            FS.Close();
            SR.Close();



            string SpeakerName = DTW.GetSpeakerName(ReadVoices.UserNames, NoOfVoices);

            MessageBox.Show("Identified Speaker is " + SpeakerName);
            //   MessageBox.Show(SpeakerName);
            this.Hide();
            StartUpForm.Show();
        }
Example #2
0
//===========================================================================================================================================//
        private void SaveAudio_Click(object sender, EventArgs e)
        {
            //Save the signal in a wave file
            saveFileDialog1.ShowDialog(this);
            string name = saveFileDialog1.FileName;


            //Extract the Features for saving
            signal = AudioOperations.OpenAudioFile(name);
            Sequence S = AudioOperations.ExtractFeatures(signal);

            //Write the Sequence in file
            RWFile Write = new RWFile();

            Write.WriteInFile(S, UserName);

            MessageBox.Show("Voice Recorded Successfully");

            //Re-direct the user to the start up form
            StartUpForm.Show();

            //hide the current form
            this.Hide();
        }