]> git.parisson.com Git - timeside-diadems.git/commitdiff
irit analyzers are IAnalyzer
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 11 Oct 2013 23:13:11 +0000 (01:13 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 11 Oct 2013 23:13:11 +0000 (01:13 +0200)
timeside/analyzer/irit_speech_4hz.py
timeside/analyzer/irit_speech_entropy.py

index 5658916e5ca8958c00d060bdb2b7a937eefc3719..5f7f69dc752bf2e0aaf3594dad85dc69019a2b7d 100644 (file)
@@ -21,7 +21,7 @@
 
 from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
 from timeside.analyzer.core import *
-from timeside.api import IValueAnalyzer
+from timeside.api import IAnalyzer
 from numpy import array,hamming,dot,mean
 from numpy.fft import rfft
 from scipy.ndimage.morphology import binary_opening
@@ -30,7 +30,7 @@ from scipy.io.wavfile import write as wavwrite
 from matplotlib import pylab
 
 class IRITSpeech4Hz(Processor):
-    implements(IValueAnalyzer)
+    implements(IAnalyzer)
     '''
     Segmentor based on the analysis of the 4Hz energy modulation.
 
@@ -40,11 +40,11 @@ class IRITSpeech4Hz(Processor):
                - frequency_center      (float)         : Center of the frequency range where the energy is extracted
                - frequency_width       (float)         : Width of the frequency range where the energy is extracted
                - orderFilter           (int)           : Order of the pass-band filter extracting the frequency range
-               - normalizeEnergy       (boolean)       : Whether the energy must be normalized or not 
+               - normalizeEnergy       (boolean)       : Whether the energy must be normalized or not
                - nFFT                          (int)           : Number of points for the FFT. Better if 512 <= nFFT <= 2048
-               - nbFilters                     (int)           : Length of the Mel Filter bank 
-               - melFilter             (numpy array)   : Mel Filter bank 
-               - modulLen                      (float)         : Length (in second) of the modulation computation window 
+               - nbFilters                     (int)           : Length of the Mel Filter bank
+               - melFilter             (numpy array)   : Mel Filter bank
+               - modulLen                      (float)         : Length (in second) of the modulation computation window
     '''
 
     @interfacedoc
@@ -54,8 +54,8 @@ class IRITSpeech4Hz(Processor):
         print "top"
         # Classification
         self.threshold = 2.0
-        
-        # Pass-band Filter 
+
+        # Pass-band Filter
         self.frequency_center = 4.0
         self.frequency_width = 0.5
         self.orderFilter=100
@@ -101,7 +101,7 @@ class IRITSpeech4Hz(Processor):
                self.energy4hz.append(e)
                
                return frames, eod
-        
+
     def results(self):
        '''
                
@@ -113,7 +113,7 @@ class IRITSpeech4Hz(Processor):
        num = firwin(self.orderFilter, Wn,pass_zero=False);
                
                
-       # Energy on the frequency range 
+       # Energy on the frequency range
        self.energy4hz=numpy.array(self.energy4hz)              
        energy = lfilter(num,1,self.energy4hz.T,0)
        energy = sum(energy)
@@ -136,11 +136,11 @@ class IRITSpeech4Hz(Processor):
                
        segList = segmentFromValues(modEnergyValue>self.threshold)
        segmentsEntropy =[]
-        for s in segList : 
+        for s in segList :
             segmentsEntropy.append((numpy.float(s[0])*self.blocksize()/self.samplerate(),
                                     numpy.float(s[1])*self.blocksize()/self.samplerate(),
-                                    convert[s[2]])) 
-       
+                                    convert[s[2]]))
+
         segs = AnalyzerResult(id="irit_4hzenergy_segments", name="seg 4Hz (IRIT)", unit="s")
         segs.value = segmentsEntropy
         return AnalyzerResultContainer([modEnergy,segs])
index c84f76d43211a58fc079780c215b3a2e333d5841..ea5c6ae5f64c38b80a0db7ce4df6e6c7c88b09db 100644 (file)
 
 from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
 from timeside.analyzer.core import *
-from timeside.api import IValueAnalyzer
+from timeside.api import IAnalyzer
 from numpy import array
 from scipy.ndimage.morphology import binary_opening
 from matplotlib import pylab
 
 class IRITSpeechEntropy(Processor):
-    implements(IValueAnalyzer)
+    implements(IAnalyzer)
 
     @interfacedoc
     def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None):