Exemplo n.º 1
0
Arquivo: GMM.cs Projeto: tdav/emocije
        protected override void MakeFeatures()
        {
            mus = new List<Matrix>();
            for (int i = 0; i < 5; i++)
            {
                Matrix m = new Matrix(11, 1);
                for (int j = 0; j < 11; j++)
                {
                    m[j, 0] = mu[j, i];
                }
                mus.Add(m);
            }

            sigmas = new List<Matrix>();
            //sigmas.Add(new Matrix(sigma0));
            //sigmas.Add(new Matrix(sigma1));
            //sigmas.Add(new Matrix(sigma2));
            //sigmas.Add(new Matrix(sigma3));
            //sigmas.Add(new Matrix(sigma4));

            Random rand = new Random();
            for (int i = 0; i < 5; i++)
            {
                Matrix m = new Matrix(11, 11);
                for (int j = 0; j < 11; j++)
                {
                    for (int k = 0; k < 11; k++)
                    {
                        m[j, k] = rand.NextDouble();
                    }
                }
                sigmas.Add(m);
            }

            IDataProvider DataProvider = new DataProviders.FourierDataProvider();
            this.DataProvider = DataProvider;

            //značajke
            IFeature Sub_TimeEnergy = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch = new Features.Pitch(DataProvider);

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            IFeature Super_Median = new Features.Median(DataProvider);
            IFeature Super_Mean = new Features.TimeAverage(DataProvider);
            IFeature Super_Max = new Features.Maximum(DataProvider);

            IFeature Super_FFTMean = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMedian = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTMax = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTRange = new Features.FFTRange(DataProvider);
            IFeature Super_FFTStd = new Features.FFTStd(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);

            // Energy ->(time median, freq mean, freq median)
            List<IFeature> SuperFeatList = new List<IFeature>() {Super_Median, Super_FFTMean , Super_FFTMedian };
            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);

            // Zcr -> (time mean, freq std)
            SuperFeatList = new List<IFeature>() { Super_Mean, Super_FFTStd };
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);

            // Pitch -> (freq max, freq median, freq changerate)
            SuperFeatList = new List<IFeature>() { Super_Max, Super_FFTMedian, Super_FFTChangeRate };
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);

            // Power -> ( freq max, freq range, freq median)
            SuperFeatList = new List<IFeature>() { Super_FFTMax, Super_FFTRange, Super_FFTMedian };
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);
        }
Exemplo n.º 2
0
Arquivo: HMM.cs Projeto: tdav/emocije
        /*timeEnergyMax
         *           timeEnergyMin
         *           timeEnergyVar
         *           timePowerDbRange
         *           timePowerDbMedian
         *           timePowerDbChangerate
         *           timeZcrMin
         *           timePitchMax
         *           timePitchMin
         *           frequencyEnergyMean
         *           frequencyEnergyMin
         *           frequencyPowerDbRange
         *           frequencyZcrRange
         *           frequencyPitchMean
         *           frequencyPitchRange
         *           frequencyPitchStd
         *           frequencyPitchChangerate
         *           mfcc1
         *           mfcc2
         *           mfcc9
         *           mfcc10
         *
         * */
        protected override void MakeFeatures()
        {
            IDataProvider DataProvider = new DataProviders.FourierDataProvider();

            this.DataProvider = DataProvider;


            //značajke
            IFeature Sub_TimeEnergy       = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb      = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch            = new Features.Pitch(DataProvider);

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            IFeature Super_Median     = new Features.Median(DataProvider);
            IFeature Super_Mean       = new Features.TimeAverage(DataProvider);
            IFeature Super_Max        = new Features.Maximum(DataProvider);
            IFeature Super_Min        = new Features.Minimum(DataProvider);
            IFeature Super_Var        = new Features.Variance(DataProvider);
            IFeature Super_Range      = new Features.Range(DataProvider);
            IFeature Super_ChangeRate = new Features.ChangeRate(DataProvider);

            IFeature Super_FFTMean       = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMedian     = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTMax        = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTRange      = new Features.FFTRange(DataProvider);
            IFeature Super_FFTStd        = new Features.FFTStd(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);
            IFeature Super_FFTMin        = new Features.FFTMinimum(DataProvider);


            // Energy ->(time max, time min, time var, freq mean, freq min)
            List <IFeature> SuperFeatList = new List <IFeature>()
            {
                Super_Max, Super_Min, Super_Var, Super_FFTMean, Super_FFTMin
            };

            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);

            // Power -> (time range, time median, time changerate, freq range)
            SuperFeatList = new List <IFeature>()
            {
                Super_Range, Super_Median, Super_ChangeRate, Super_FFTRange
            };
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);

            // Zcr -> (time min, freq range)
            SuperFeatList = new List <IFeature>()
            {
                Super_Min, Super_FFTRange
            };
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);

            // Pitch -> (freq max, freq median, freq changerate)
            SuperFeatList = new List <IFeature>()
            {
                Super_Mean, Super_Max, Super_Min, Super_FFTMean, Super_FFTRange, Super_FFTStd, Super_FFTChangeRate
            };
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);


            SuperFeatList = new List <IFeature>()
            {
                Super_Mean
            };
            IFeature mfcc1 = new Features.MFCC(DataProvider, (uint)(1));

            SuperFeatures.Add(mfcc1, SuperFeatList);
            IFeature mfcc2 = new Features.MFCC(DataProvider, (uint)(2));

            SuperFeatures.Add(mfcc2, SuperFeatList);
            IFeature mfcc9 = new Features.MFCC(DataProvider, (uint)(9));

            SuperFeatures.Add(mfcc9, SuperFeatList);
            IFeature mfcc10 = new Features.MFCC(DataProvider, (uint)(10));

            SuperFeatures.Add(mfcc10, SuperFeatList);

            SubFeatures.Add(mfcc1);
            SubFeatures.Add(mfcc2);
            SubFeatures.Add(mfcc9);
            SubFeatures.Add(mfcc10);
        }
Exemplo n.º 3
0
        protected override void MakeFeatures()
        {
            mus = new List <Matrix>();
            for (int i = 0; i < 5; i++)
            {
                Matrix m = new Matrix(11, 1);
                for (int j = 0; j < 11; j++)
                {
                    m[j, 0] = mu[j, i];
                }
                mus.Add(m);
            }

            sigmas = new List <Matrix>();
            //sigmas.Add(new Matrix(sigma0));
            //sigmas.Add(new Matrix(sigma1));
            //sigmas.Add(new Matrix(sigma2));
            //sigmas.Add(new Matrix(sigma3));
            //sigmas.Add(new Matrix(sigma4));

            Random rand = new Random();

            for (int i = 0; i < 5; i++)
            {
                Matrix m = new Matrix(11, 11);
                for (int j = 0; j < 11; j++)
                {
                    for (int k = 0; k < 11; k++)
                    {
                        m[j, k] = rand.NextDouble();
                    }
                }
                sigmas.Add(m);
            }



            IDataProvider DataProvider = new DataProviders.FourierDataProvider();

            this.DataProvider = DataProvider;


            //značajke
            IFeature Sub_TimeEnergy       = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb      = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch            = new Features.Pitch(DataProvider);

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            IFeature Super_Median = new Features.Median(DataProvider);
            IFeature Super_Mean   = new Features.TimeAverage(DataProvider);
            IFeature Super_Max    = new Features.Maximum(DataProvider);

            IFeature Super_FFTMean       = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMedian     = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTMax        = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTRange      = new Features.FFTRange(DataProvider);
            IFeature Super_FFTStd        = new Features.FFTStd(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);


            // Energy ->(time median, freq mean, freq median)
            List <IFeature> SuperFeatList = new List <IFeature>()
            {
                Super_Median, Super_FFTMean, Super_FFTMedian
            };

            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);

            // Zcr -> (time mean, freq std)
            SuperFeatList = new List <IFeature>()
            {
                Super_Mean, Super_FFTStd
            };
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);

            // Pitch -> (freq max, freq median, freq changerate)
            SuperFeatList = new List <IFeature>()
            {
                Super_Max, Super_FFTMedian, Super_FFTChangeRate
            };
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);

            // Power -> ( freq max, freq range, freq median)
            SuperFeatList = new List <IFeature>()
            {
                Super_FFTMax, Super_FFTRange, Super_FFTMedian
            };
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);
        }
Exemplo n.º 4
0
        protected override void MakeFeatures()
        {
            IDataProvider DataProvider = new DataProviders.FourierDataProvider();
            this.DataProvider = DataProvider;
            // dodaj podznačajke
            IFeature Sub_TimeEnergy = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch = new Features.Pitch(DataProvider);

            List<Features.ChangeRate> Sub_mfcc = new List<Features.ChangeRate>();

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            // dodaj nadznačajke
            IFeature Super_TimeAverage = new Features.TimeAverage(DataProvider);
            IFeature Super_Maximum = new Features.Maximum(DataProvider);
            IFeature Super_Minimum = new Features.Minimum(DataProvider);
            IFeature Super_Range = new Features.Range(DataProvider);
            IFeature Super_Median = new Features.Median(DataProvider);
            IFeature Super_Std = new Features.Std(DataProvider);
            IFeature Super_Variance = new Features.Variance(DataProvider);
            IFeature Super_ChangeRate = new Features.ChangeRate(DataProvider);

            IFeature Super_FFTAverage = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMaximum = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTMinimum = new Features.FFTMinimum(DataProvider);
            IFeature Super_FFTRange = new Features.FFTRange(DataProvider);
            IFeature Super_FFTMedian = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTStd = new Features.FFTStd(DataProvider);
            IFeature Super_FFTVariance = new Features.FFTVariance(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);

            List<IFeature> SuperFeatList = new List<IFeature>();

            SuperFeatList.Add(Super_TimeAverage);
            SuperFeatList.Add(Super_Maximum);
            SuperFeatList.Add(Super_Minimum);
            SuperFeatList.Add(Super_Range);
            SuperFeatList.Add(Super_Median);
            SuperFeatList.Add(Super_Std);
            SuperFeatList.Add(Super_Variance);
            SuperFeatList.Add(Super_ChangeRate);
            SuperFeatList.Add(Super_FFTAverage);
            SuperFeatList.Add(Super_FFTMaximum);
            SuperFeatList.Add(Super_FFTMinimum);
            SuperFeatList.Add(Super_FFTRange);
            SuperFeatList.Add(Super_FFTMedian);
            SuperFeatList.Add(Super_FFTStd);
            SuperFeatList.Add(Super_FFTVariance);
            SuperFeatList.Add(Super_FFTChangeRate);

            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);

            SuperFeatList = new List<IFeature>();
            SuperFeatList.Add(Super_TimeAverage);

            for (int i = 0; i < 12; i++)
            {
                IFeature f = new Features.MFCC(DataProvider,(uint)(i+1));
                SubFeatures.Add(f);
                SuperFeatures.Add(f,SuperFeatList);

            }
        }
Exemplo n.º 5
0
        protected override void MakeFeatures()
        {
            IDataProvider DataProvider = new DataProviders.FourierDataProvider();

            this.DataProvider = DataProvider;
            // dodaj podznačajke
            IFeature Sub_TimeEnergy       = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb      = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch            = new Features.Pitch(DataProvider);

            List <Features.ChangeRate> Sub_mfcc = new List <Features.ChangeRate>();

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            // dodaj nadznačajke
            IFeature Super_TimeAverage = new Features.TimeAverage(DataProvider);
            IFeature Super_Maximum     = new Features.Maximum(DataProvider);
            IFeature Super_Minimum     = new Features.Minimum(DataProvider);
            IFeature Super_Range       = new Features.Range(DataProvider);
            IFeature Super_Median      = new Features.Median(DataProvider);
            IFeature Super_Std         = new Features.Std(DataProvider);
            IFeature Super_Variance    = new Features.Variance(DataProvider);
            IFeature Super_ChangeRate  = new Features.ChangeRate(DataProvider);

            IFeature Super_FFTAverage    = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMaximum    = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTMinimum    = new Features.FFTMinimum(DataProvider);
            IFeature Super_FFTRange      = new Features.FFTRange(DataProvider);
            IFeature Super_FFTMedian     = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTStd        = new Features.FFTStd(DataProvider);
            IFeature Super_FFTVariance   = new Features.FFTVariance(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);


            List <IFeature> SuperFeatList = new List <IFeature>();

            SuperFeatList.Add(Super_TimeAverage);
            SuperFeatList.Add(Super_Maximum);
            SuperFeatList.Add(Super_Minimum);
            SuperFeatList.Add(Super_Range);
            SuperFeatList.Add(Super_Median);
            SuperFeatList.Add(Super_Std);
            SuperFeatList.Add(Super_Variance);
            SuperFeatList.Add(Super_ChangeRate);
            SuperFeatList.Add(Super_FFTAverage);
            SuperFeatList.Add(Super_FFTMaximum);
            SuperFeatList.Add(Super_FFTMinimum);
            SuperFeatList.Add(Super_FFTRange);
            SuperFeatList.Add(Super_FFTMedian);
            SuperFeatList.Add(Super_FFTStd);
            SuperFeatList.Add(Super_FFTVariance);
            SuperFeatList.Add(Super_FFTChangeRate);


            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);

            SuperFeatList = new List <IFeature>();
            SuperFeatList.Add(Super_TimeAverage);

            for (int i = 0; i < 12; i++)
            {
                IFeature f = new Features.MFCC(DataProvider, (uint)(i + 1));
                SubFeatures.Add(f);
                SuperFeatures.Add(f, SuperFeatList);
            }
        }
Exemplo n.º 6
0
Arquivo: HMM.cs Projeto: tdav/emocije
        /*timeEnergyMax
                     timeEnergyMin
                     timeEnergyVar
                     timePowerDbRange
                     timePowerDbMedian
                     timePowerDbChangerate
                     timeZcrMin
                     timePitchMax
                     timePitchMin
                     frequencyEnergyMean
                     frequencyEnergyMin
                     frequencyPowerDbRange
                     frequencyZcrRange
                     frequencyPitchMean
                     frequencyPitchRange
                     frequencyPitchStd
                     frequencyPitchChangerate
                     mfcc1
                     mfcc2
                     mfcc9
                     mfcc10

         * */
        protected override void MakeFeatures()
        {
            IDataProvider DataProvider = new DataProviders.FourierDataProvider();
            this.DataProvider = DataProvider;

            //značajke
            IFeature Sub_TimeEnergy = new Features.TimeEnergy(DataProvider);
            IFeature Sub_TimePowerDb = new Features.TimePowerDb(DataProvider);
            IFeature Sub_ZeroCrossingRate = new Features.ZeroCrossingRate(DataProvider);
            IFeature Sub_Pitch = new Features.Pitch(DataProvider);

            SubFeatures.Add(Sub_TimeEnergy);
            SubFeatures.Add(Sub_TimePowerDb);
            SubFeatures.Add(Sub_ZeroCrossingRate);
            SubFeatures.Add(Sub_Pitch);

            IFeature Super_Median = new Features.Median(DataProvider);
            IFeature Super_Mean = new Features.TimeAverage(DataProvider);
            IFeature Super_Max = new Features.Maximum(DataProvider);
            IFeature Super_Min = new Features.Minimum(DataProvider);
            IFeature Super_Var = new Features.Variance(DataProvider);
            IFeature Super_Range = new Features.Range(DataProvider);
            IFeature Super_ChangeRate = new Features.ChangeRate(DataProvider);

            IFeature Super_FFTMean = new Features.FFTAverage(DataProvider);
            IFeature Super_FFTMedian = new Features.FFTMedian(DataProvider);
            IFeature Super_FFTMax = new Features.FFTMaximum(DataProvider);
            IFeature Super_FFTRange = new Features.FFTRange(DataProvider);
            IFeature Super_FFTStd = new Features.FFTStd(DataProvider);
            IFeature Super_FFTChangeRate = new Features.FFTChangeRate(DataProvider);
            IFeature Super_FFTMin = new Features.FFTMinimum(DataProvider);

            // Energy ->(time max, time min, time var, freq mean, freq min)
            List<IFeature> SuperFeatList = new List<IFeature>() { Super_Max, Super_Min, Super_Var, Super_FFTMean, Super_FFTMin };
            SuperFeatures.Add(Sub_TimeEnergy, SuperFeatList);

            // Power -> (time range, time median, time changerate, freq range)
            SuperFeatList = new List<IFeature>() {Super_Range, Super_Median, Super_ChangeRate, Super_FFTRange};
            SuperFeatures.Add(Sub_TimePowerDb, SuperFeatList);

            // Zcr -> (time min, freq range)
            SuperFeatList = new List<IFeature>() { Super_Min, Super_FFTRange };
            SuperFeatures.Add(Sub_ZeroCrossingRate, SuperFeatList);

            // Pitch -> (freq max, freq median, freq changerate)
            SuperFeatList = new List<IFeature>() {Super_Mean, Super_Max, Super_Min, Super_FFTMean,Super_FFTRange, Super_FFTStd, Super_FFTChangeRate };
            SuperFeatures.Add(Sub_Pitch, SuperFeatList);

            SuperFeatList = new List<IFeature>() { Super_Mean };
            IFeature mfcc1 = new Features.MFCC(DataProvider, (uint)(1));
            SuperFeatures.Add(mfcc1, SuperFeatList);
            IFeature mfcc2 = new Features.MFCC(DataProvider, (uint)(2));
            SuperFeatures.Add(mfcc2, SuperFeatList);
            IFeature mfcc9 = new Features.MFCC(DataProvider, (uint)(9));
            SuperFeatures.Add(mfcc9, SuperFeatList);
            IFeature mfcc10 = new Features.MFCC(DataProvider, (uint)(10));
            SuperFeatures.Add(mfcc10, SuperFeatList);

            SubFeatures.Add(mfcc1);
            SubFeatures.Add(mfcc2);
            SubFeatures.Add(mfcc9);
            SubFeatures.Add(mfcc10);
        }