from irit_speech_entropy import IRITSpeechEntropy
from irit_speech_4hz import IRITSpeech4Hz
from irit_diverg import IRITDiverg
+from irit_noise_startSilences import IRITStartSeg
from irit_music_SLN import IRITMusicSLN
from irit_music_SNB import IRITMusicSNB
#~ from irit_monopoly import IRITMonopoly
from numpy import logical_and,array, hamming, dot, mean, float, arange, nonzero
from numpy.fft import rfft
from scipy.signal import firwin, lfilter
-from pylab import plot,show
+from timeside.analyzer.preprocessors import frames_adapter
class IRITMusicSLN(Analyzer):
implements(IAnalyzer)
- def __init__(self, blocksize=1024, stepsize=None) :
+ def __init__(self, blocksize=None, stepsize=None) :
super(IRITMusicSLN, self).__init__();
+
self.parents.append(IRITDiverg())
self.wLen = 1.0
self.wStep = 0.1
self.threshold = 20
-
+ self.input_blocksize = 0;
+ self.input_stepsize = 0;
+
+ @interfacedoc
+ def setup(self, channels=None, samplerate=None, blocksize=None,
+ totalframes=None):
+ super(IRITMusicSLN, self).setup(
+ channels, samplerate, blocksize, totalframes)
+ self.input_blocksize = int(self.wLen * samplerate)
+ self.input_stepsize = int(self.wStep * samplerate)
+
@staticmethod
@interfacedoc
def id():
def __str__(self):
return "Music confidence indexes"
-
+
+ @frames_adapter
def process(self, frames, eod=False):
return frames,eod
idx = nonzero(logical_and(segList>(t-w) ,segList<(t+w)))[0]
segLen[i]= len(idx)
-
- plot(tLine,segLen)
- show()
# Confidence Index
conf = array(segLen - self.threshold) / self.threshold
conf[conf > 1] = 1
from numpy import logical_and,array, hamming, dot, mean, float, arange, nonzero
from numpy.fft import rfft
from scipy.signal import firwin, lfilter
-from pylab import plot,show
+from timeside.analyzer.preprocessors import frames_adapter
class IRITMusicSNB(Analyzer):
implements(IAnalyzer)
- def __init__(self, blocksize=1024, stepsize=None) :
+ def __init__(self, blocksize=1024, stepsize=None, samplerate=None) :
super(IRITMusicSNB, self).__init__();
self.parents.append(IRITDiverg())
self.wLen = 1.0
self.wStep = 0.1
+ self.input_blocksize = 0;
+ self.input_stepsize = 0;
self.threshold = 20
+
+ @interfacedoc
+ def setup(self, channels=None, samplerate=None, blocksize=None,
+ totalframes=None):
+ super(IRITMusicSNB, self).setup(
+ channels, samplerate, blocksize, totalframes)
+ self.input_blocksize = int(self.wLen * samplerate)
+ self.input_stepsize = int(self.wStep * samplerate)
@staticmethod
@interfacedoc
def __str__(self):
return "Music confidence indexes"
-
+
+ @frames_adapter
def process(self, frames, eod=False):
return frames,eod
l = [tLine[t1]-tLine[t2] for t1,t2 in zip()]
segLen[i]= len(idx)
-
- plot(tLine,segLen)
- show()
- # Confidence Index
+ # Confidence Index
conf = array(segLen - self.threshold) / self.threshold
conf[conf > 1] = 1
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):
- modulLen (float) : Length (in second) of the modulation computation window
'''
- @interfacedoc
+ @interfacedoc
def setup(self, channels=None, samplerate=None, blocksize=None,
totalframes=None):
super(IRITSpeech4Hz, self).setup(
channels, samplerate, blocksize, totalframes)
+
self.energy4hz = []
# Classification
self.threshold = 2.0
+
+ self.wLen = 1.0
+ self.wStep = 0.1
+ self.input_blocksize = int(self.wLen * samplerate)
+ self.input_stepsize = int(self.wStep * samplerate)
# Pass-band Filter
self.frequency_center = 4.0
def __str__(self):
return "Speech confidences indexes"
+ @frames_adapter
def process(self, frames, eod=False):
'''
# Energy Modulation
frameLenModulation = int(
- self.modulLen * self.samplerate() / self.blocksize())
+ self.modulLen * self.samplerate() / self.input_blocksize)
modEnergyValue = computeModulation(energy, frameLenModulation, True)
# Confidence Index
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() /
+ segs.data_object.time = [(float(s[0]) * self.input_blocksize /
self.samplerate())
for s in segList]
- segs.data_object.duration = [(float(s[1]-s[0]) * self.blocksize() /
+ segs.data_object.duration = [(float(s[1]-s[0]) * self.input_blocksize /
self.samplerate())
for s in segList]
from timeside.api import IAnalyzer
from numpy import array
from scipy.ndimage.morphology import binary_opening
+from timeside.analyzer.preprocessors import frames_adapter
class IRITSpeechEntropy(Analyzer):
self.threshold = 0.4
self.smoothLen = 5
self.modulLen = 2
+ self.wLen = 1.0
+ self.wStep = 0.1
+ self.input_blocksize = int(self.wLen * samplerate)
+ self.input_stepsize = int(self.wStep * samplerate)
@staticmethod
@interfacedoc
def __str__(self):
return "Speech confidences indexes"
-
+
+ @frames_adapter
def process(self, frames, eod=False):
self.entropyValue.append(entropy(frames))
return frames, eod
def post_process(self):
entropyValue = array(self.entropyValue)
- w = self.modulLen * self.samplerate() / self.blocksize()
+ w = self.modulLen * self.samplerate() / self.input_blocksize
modulentropy = computeModulation(entropyValue, w, False)
confEntropy = array(modulentropy - self.threshold) / self.threshold
confEntropy[confEntropy > 1] = 1
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() /
+ segs.data_object.time = [(float(s[0]) * self.input_blocksize /
self.samplerate())
for s in segList]
- segs.data_object.duration = [(float(s[1]-s[0]) * self.blocksize() /
+ segs.data_object.duration = [(float(s[1]-s[0]) * self.input_blocksize /
self.samplerate())
for s in segList]