From: Maxime LE COZ Date: Thu, 27 Feb 2014 14:31:40 +0000 (+0100) Subject: Bug correction on parameters and modulation computation X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ef0b79b01c490f066658e5a36d8f92192e607c44;p=timeside.git Bug correction on parameters and modulation computation --- diff --git a/timeside/analyzer/irit_speech_4hz.py b/timeside/analyzer/irit_speech_4hz.py index ea86677..2e34cf5 100644 --- a/timeside/analyzer/irit_speech_4hz.py +++ b/timeside/analyzer/irit_speech_4hz.py @@ -27,7 +27,7 @@ from timeside.api import IAnalyzer from numpy import array, hamming, dot, mean, float from numpy.fft import rfft from scipy.signal import firwin, lfilter - +from timeside.analyzer.preprocessors import frames_adapter class IRITSpeech4Hz(Analyzer): implements(IAnalyzer) @@ -66,6 +66,10 @@ class IRITSpeech4Hz(Analyzer): self.nbFilters = 30 self.modulLen = 2.0 self.melFilter = melFilterBank(self.nbFilters, self.nFFT, samplerate) + self.wLen = 0.016 + self.wStep = 0.008 + self.input_blocksize = int(self.wLen * samplerate) + self.input_stepsize = int(self.wStep * samplerate) @staticmethod @interfacedoc @@ -85,6 +89,7 @@ class IRITSpeech4Hz(Analyzer): def __str__(self): return "Speech confidences indexes" + @frames_adapter def process(self, frames, eod=False): ''' @@ -121,9 +126,9 @@ class IRITSpeech4Hz(Analyzer): if self.normalizeEnergy: energy = energy / mean(energy) + # Energy Modulation - frameLenModulation = int( - self.modulLen * self.samplerate() / self.blocksize()) + frameLenModulation = self.modulLen/self.wStep modEnergyValue = computeModulation(energy, frameLenModulation, True) # Confidence Index @@ -154,11 +159,9 @@ class IRITSpeech4Hz(Analyzer): segs.label_metadata.label = label segs.data_object.label = [convert[s[2]] for s in segList] - segs.data_object.time = [(float(s[0]) * self.blocksize() / - self.samplerate()) + segs.data_object.time = [float(s[0]) * self.wStep for s in segList] - segs.data_object.duration = [(float(s[1]-s[0]) * self.blocksize() / - self.samplerate()) + segs.data_object.duration = [float(s[1]-s[0]) * self.wStep for s in segList] self.process_pipe.results.add(segs) diff --git a/timeside/analyzer/irit_speech_entropy.py b/timeside/analyzer/irit_speech_entropy.py index 45be006..6827d24 100644 --- a/timeside/analyzer/irit_speech_entropy.py +++ b/timeside/analyzer/irit_speech_entropy.py @@ -40,11 +40,12 @@ class IRITSpeechEntropy(Analyzer): super(IRITSpeechEntropy, self).setup( channels, samplerate, blocksize, totalframes) self.entropyValue = [] - self.threshold = 0.4 - self.smoothLen = 5 - self.modulLen = 2 - self.wLen = 1.0 - self.wStep = 0.1 + self.threshold = 0.4 + self.smoothLen = 5 + self.modulLen = 2 + self.wLen = 0.016 + self.wStep = 0.008 + self.input_blocksize = int(self.wLen * samplerate) self.input_stepsize = int(self.wStep * samplerate) @@ -73,8 +74,14 @@ class IRITSpeechEntropy(Analyzer): def post_process(self): entropyValue = array(self.entropyValue) - w = self.modulLen * self.samplerate() / self.input_blocksize + w = self.modulLen/self.wStep + print w,len(entropyValue) modulentropy = computeModulation(entropyValue, w, False) + + import pylab + pylab.plot(modulentropy) + pylab.show() + confEntropy = array(modulentropy - self.threshold) / self.threshold confEntropy[confEntropy > 1] = 1 @@ -105,11 +112,8 @@ class IRITSpeechEntropy(Analyzer): segs.data_object.time = [(float(s[0]) * self.input_blocksize / self.samplerate()) for s in segList] -<<<<<<< HEAD - segs.data_object.duration = [(float(s[1]-s[0]) * self.input_blocksize / -======= + segs.data_object.duration = [(float(s[1]-s[0]+1) * self.blocksize() / ->>>>>>> 7c3ccb1c5b87c4639fee32df595cca1991265657 self.samplerate()) for s in segList]