]> git.parisson.com Git - timeside.git/commitdiff
Add Processor a post_process() function. analyzer will produce the Results during...
authorThomas Fillon <thomas@parisson.com>
Tue, 15 Oct 2013 22:29:35 +0000 (00:29 +0200)
committerThomas Fillon <thomas@parisson.com>
Tue, 15 Oct 2013 22:29:35 +0000 (00:29 +0200)
16 files changed:
tests/api/exempleCMMR_vamp.py
timeside/analyzer/aubio_melenergy.py
timeside/analyzer/aubio_mfcc.py
timeside/analyzer/aubio_pitch.py
timeside/analyzer/aubio_specdesc.py
timeside/analyzer/aubio_temporal.py
timeside/analyzer/dc.py
timeside/analyzer/irit_speech_4hz.py
timeside/analyzer/irit_speech_entropy.py
timeside/analyzer/level.py
timeside/analyzer/spectrogram.py
timeside/analyzer/vamp_plugin.py
timeside/analyzer/waveform.py
timeside/analyzer/yaafe.py
timeside/api.py
timeside/core.py

index a0343aed73dac937a358760e1cf364de913c2b18..36a03d685611110a6e286e831cfa250ba1bb5a7c 100644 (file)
@@ -11,8 +11,8 @@ import matplotlib.pyplot as plt
 import numpy as np
 import sys
 
-wav_file = sys.argv[-1]
-#wav_file =  '/home/thomas/code/timeside/voix.wav'
+#wav_file = sys.argv[-1]
+wav_file =  '/home/thomas/code/timeside/voix.wav'
 
 # normal
 d = timeside.decoder.FileDecoder(wav_file)
@@ -50,7 +50,8 @@ max_freq = (N // 2 + 1) / N * spec_res.frame_metadata.samplerate
 
 
 # Get the vamp plugin result and plot it
-vamp.results.keys()
+for key in vamp.results.keys():
+    print vamp.results[key].data
 
 res_vamp = vamp.results['vamp_simple_host.percussiononsets.detectionfunction']
 
index eb8b70258637a9af0dd009335057e61b6502f15f..d1ac0260cd3134bc03883f2e4bd76cfad68e0b6b 100644 (file)
@@ -72,7 +72,7 @@ class AubioMelEnergy(Analyzer):
             self.block_read += 1
         return frames, eod
 
-    def release(self):
+    def post_process(self):
 
         melenergy = self.new_result(data_mode='value', time_mode='framewise')
 
index 5d7f14a5a202982d3e9f3d045fd70ef4948869d3..c29c20c824167b95fcaa76c246711072fa0405d5 100644 (file)
@@ -73,7 +73,7 @@ class AubioMfcc(Analyzer):
             self.block_read += 1
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # MFCC
         mfcc = self.new_result(data_mode='value', time_mode='framewise')
 
index f9e53ea1bab023a3a91bc824a0daf37f6de2cf4e..76bdb28bd211bbd440e167205d93aecb655b2b1c 100644 (file)
@@ -71,7 +71,7 @@ class AubioPitch(Analyzer):
             self.block_read += 1
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # set Result
         pitch = self.new_result(data_mode='value', time_mode='framewise')
 
index 4ebbb68fd1d134ab3f9c240794bd26e093bf194a..175cf08696b0be5342c0d084206aae8b88ef7be7 100644 (file)
@@ -79,7 +79,7 @@ class AubioSpecdesc(Analyzer):
                     self.specdesc[method](fftgrain)[0]]
         return frames, eod
 
-    def release(self):
+    def post_process(self):
 
         # For each method store results in container
         for method in self.methods:
index 49212f99898406b14a97c8a48ca07876a32d5ee0..8c9d03a09d715629a246dbb1f0cc7db98e10f2db 100644 (file)
@@ -78,7 +78,7 @@ class AubioTemporal(Analyzer):
             self.block_read += 1
         return frames, eod
 
-    def release(self):
+    def post_process(self):
 
         #---------------------------------
         #  Onsets
index 2b9f46898fa3ead6f588249d5d5bc5c54131bad8..88b5911b36bbef31d4c4eaee755e090656253880 100644 (file)
@@ -57,7 +57,7 @@ class MeanDCShift(Analyzer):
             self.values = numpy.append(self.values, numpy.mean(frames))
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         dc_result = self.new_result(data_mode='value', time_mode='global')
 
         # Set Data
index 8d054872157ee16e9ca7e75f9102adcb11cca101..1e5e87638992834213fa1043ecd05166fdcf624f 100644 (file)
@@ -101,7 +101,7 @@ class IRITSpeech4Hz(Analyzer):
 
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         '''
 
         '''
index bc034b45a1509863694d8eca234e550ae1beebd7..8f84544dc4a2a54eae0d5e92f38ccd02c5d83a53 100644 (file)
@@ -62,7 +62,7 @@ class IRITSpeechEntropy(Analyzer):
         self.entropyValue.append(entropy(frames))
         return frames, eod
 
-    def release(self):
+    def post_process(self):
 
         entropyValue = array(self.entropyValue)
         w = self.modulLen * self.samplerate() / self.blocksize()
index ef2c1851ac2034733a5aa634a324c91d9b5af553..29f0237a3cc09b5e69011e68ac37f06ba8f05e6f 100644 (file)
@@ -64,7 +64,7 @@ class Level(Analyzer):
                                             np.mean(np.square(frames)))
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # Max level
         max_level = self.new_result(data_mode='value', time_mode='global')
 
index 48c7275eb7c4b98276e56614357e57ee203287f8..17b6d78db2ad21878b79a1043b763d601ce549fb 100644 (file)
@@ -64,7 +64,7 @@ class Spectrogram(Analyzer):
 
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # set Result
         spectrogram = self.new_result(data_mode='value', time_mode='framewise')
 
index 5e64505ed4fb7b6aa5eed907f5ac6cc3d219cf74..5072ac50b2842fc482dbc855d25c5b373e3de54a 100644 (file)
@@ -63,7 +63,7 @@ class VampSimpleHost(Analyzer):
         pass
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         #plugin = 'vamp-example-plugins:amplitudefollower:amplitude'
 
         wavfile = self.mediainfo()['uri'].split('file://')[-1]
index a3da8f42fee426e9dc7cd10d8dcb40db436942df..8d5b0c9accad8a47fab0e820a99ec11b57a83646 100644 (file)
@@ -63,7 +63,7 @@ class Waveform(Analyzer):
 
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # set Result
         waveform = self.new_result(data_mode='value', time_mode='framewise')
 
index f0bee2e88a0cdc190fa639fa91b4b0a1b71511f6..0ad8b3a201ed605ef70054750ae18d4890e4c414 100644 (file)
@@ -98,7 +98,7 @@ class Yaafe(Analyzer):
 
         return frames, eod
 
-    def release(self):
+    def post_process(self):
         # Get feature extraction results from yaafe
         featNames = self.yaafe_engine.getOutputs().keys()
         if len(featNames) == 0:
index 07f7063b8a95fb90316a4d1f84b72540b03362ac..ad2b3748a1eaf43013c7006af84ecf0294ee28ac 100644 (file)
@@ -75,6 +75,13 @@ class IProcessor(Interface):
 
         Warning: it is required to call setup() before this method."""
 
+    def post_process(self):
+        '''
+        Post-Process data after processign the input frames with process()
+
+        Processors such as analyzers will produce Results during the Post-Process
+        '''
+
     def release(self):
         """Release resources owned by this processor. The processor cannot
         be used anymore after calling this method."""
index 4804ad291d1d93703ae4615d380bea1dab0a4971..7bcc1bffb4bfe3ba2fea27e4ab03c05aed9e622f 100644 (file)
@@ -111,6 +111,10 @@ class Processor(Component):
     def process(self, frames, eod):
         return frames, eod
 
+    @interfacedoc
+    def post_process(self):
+        pass
+
     @interfacedoc
     def release(self):
         pass
@@ -259,6 +263,9 @@ class ProcessPipe(object):
             for item in items:
                 frames, eod = item.process(frames, eod)
 
+        for item in items:
+            item.post_process()
+
         for item in items:
             item.release()