-# -*- coding: utf-8 -*-
+ # -*- coding: utf-8 -*-
from core import *
+
from duration import *
from max_level import *
+from mean_level import *
+from dc import *
-#from timeside.analyzer.mean_level import *
-#from timeside.analyzer.dc import *
# Author: Guillaume Pellerin <yomguy@parisson.com>
+from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
from timeside.analyzer.core import *
from timeside.api import IValueAnalyzer
import numpy
-
class MeanDCShift(Processor):
implements(IValueAnalyzer)
return "%s %s" % (str(self.value), unit())
def process(self, frames, eod=False):
- self.value = numpy.round(100*numpy.mean(samples),4)
+ self.value = numpy.round(100*numpy.mean(frames),3)
return frames, eod
def result(self):
@interfacedoc
def unit():
return "seconds"
+
+ def __str__(self):
+ return "%s %s" % (str(self.value), unit())
+ def process(self, frames, eod=False):
+ return frames, eod
+
def result(self):
return self.input_nframes / float(self.input_samplerate)
-
\ No newline at end of file
+
from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
from timeside.analyzer.core import *
from timeside.api import IValueAnalyzer
+import numpy
class MaxLevel(Processor):
@interfacedoc
def setup(self, channels=None, samplerate=None, nframes=None):
super(MaxLevel, self).setup(channels, samplerate, nframes)
- self.max_value = 0
+ self.value = 0
@staticmethod
@interfacedoc
@staticmethod
@interfacedoc
def unit():
- # power? amplitude?
- return ""
+ return "dB"
def process(self, frames, eod=False):
- max = frames.max()
- if max > self.max_value:
+ max = round(20*numpy.log(frames.max()), 3)
+ if max > self.value:
self.max_value = max
-
return frames, eod
def result(self):
- return self.max_value
+ return self.value
# Author: Guillaume Pellerin <yomguy@parisson.com>
+from timeside.core import Processor, implements, interfacedoc, FixedSizeInputAdapter
from timeside.analyzer.core import *
from timeside.api import IValueAnalyzer
import numpy
return "%s %s" % (str(self.value), unit())
def process(self, frames, eod=False):
- max = numpy.round(20*numpy.log10(numpy.mean(numpy.sqrt(numpy.square(frames.max())))), 2)
- if max > self.value:
- self.value = max
-
+ value = numpy.round(20*numpy.log10(numpy.mean(numpy.sqrt(numpy.square(frames)))), 3)
+ if value > self.value:
+ self.value = value
return frames, eod
def result(self):
return self.value
-