public List <string> CountSentences(IOutputStreamer _objTestLog, string filePath) //MP { int sampleRate = 0; //Hz double[] allSamples = GetSamplesForMonoWav(filePath, out sampleRate); List <double[]> partisipantSegments = GetPartisipantSegments(allSamples, sampleRate); List <string> callPartisipants = DetectCallParticipants(partisipantSegments, _objTestLog, sampleRate); return(callPartisipants); }
public FastFourierTransform() { myOutput = OutputStreamer.GetInstance().GetCurrentStreamer(); }
private List <string> DetectCallParticipants(List <double[]> partisipantSegments, IOutputStreamer _objTestLog, int sampleRate) { List <string> participants = new List <string>(); double duration; int NumberCount = 0; foreach (double[] segment in partisipantSegments) { duration = GetSegmentDuration(segment, sampleRate); double tollerance = 0.5; //0.5 seconds string part = String.Empty; if (duration <= 2) { _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + "Ring tone detected. Duration : " + duration, false); continue; } if (duration <= 3 + tollerance) { participants.Add("A1"); part = "A1"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (4 + tollerance)) { participants.Add("A1_SOD"); part = "A1_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (5 + tollerance)) { participants.Add("A2"); part = "A2"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (6 + tollerance)) { participants.Add("A2_SOD"); part = "A2_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (7 + tollerance)) { participants.Add("C1"); part = "C1"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (8 + tollerance)) { participants.Add("C1_SOD"); part = "C1_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (9 + tollerance)) { participants.Add("C2"); part = "C2"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (10 + tollerance)) { participants.Add("C2_SOD"); part = "C2_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (11 + tollerance)) { participants.Add("SV1"); part = "SV1"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (12 + tollerance)) { participants.Add("SV1_SOD"); part = "SV1_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (13 + tollerance)) { participants.Add("SV2"); part = "SV2"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (14 + tollerance)) { participants.Add("SV2_SOD"); part = "SV2_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (15 + tollerance)) { participants.Add("A3"); part = "A3"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } if (duration <= (16 + tollerance)) { participants.Add("A3_SOD"); part = "A3_SOD"; _objTestLog.WriteLog(ClsEnum.ReportTypes.DEBUG, part + " Duration : " + duration, false); NumberCount++; continue; } } participants.Add(NumberCount.ToString()); return(participants); }