]> git.parisson.com Git - timeside.git/commitdiff
Add default parameter for Vamp simple host analyzer
authorThomas Fillon <thomas@parisson.com>
Tue, 15 Oct 2013 00:25:28 +0000 (02:25 +0200)
committerThomas Fillon <thomas@parisson.com>
Tue, 15 Oct 2013 00:25:28 +0000 (02:25 +0200)
tests/api/exempleCMMR_vamp.py
timeside/analyzer/vamp_plugin.py

index 1384a17693eefb7d824dcc2a4dfeda18e3794539..eccaeb0ae753e6521a1f5b93f59d1dcc2f5877c2 100644 (file)
@@ -12,9 +12,10 @@ import numpy as np
 import sys
 
 wav_file = sys.argv[-1]
-wav_file =  '/home/thomas/code/timeside/voix.wav'
+#wav_file =  '/home/thomas/code/timeside/voix.wav'
+
 # normal
-d = timeside.decoder.FileDecoder(wav_file, start=10, duration=15)
+d = timeside.decoder.FileDecoder(wav_file, start=0, duration=10)
 
 specgram = timeside.analyzer.Spectrogram()
 waveform = timeside.analyzer.Waveform()
@@ -61,7 +62,7 @@ plt.grid
 plt.title(res_vamp.name)
 
 plt.subplot(2,1,2)
-plt.imshow(20 * np.log10(spec_res.data.T),
+plt.imshow(20 * np.log10(spec_res.data.T + 1e-6),
            origin='lower',
            extent=[spec_res.time[0], spec_res.time[-1], 0,
                    max_freq],
index a73a7bb984ef540620edebd67c6b1cd73e32e869..9561929feeeaa18e66287398f5b60ef2d5e6e3a8 100644 (file)
@@ -33,7 +33,8 @@ class VampSimpleHost(Analyzer):
     def __init__(self, plugin_list=None):
 
         if plugin_list is None:
-            plugin_list = self.get_plugins_list()
+            #plugin_list = self.get_plugins_list()
+            plugin_list = [['vamp-example-plugins', 'percussiononsets', 'detectionfunction']]
 
         self.plugin_list = plugin_list
 
@@ -68,8 +69,8 @@ class VampSimpleHost(Analyzer):
         wavfile = self.mediainfo()['uri'].split('file://')[-1]
 
         for plugin_line in self.plugin_list:
+
             plugin = ':'.join(plugin_line)
-            print plugin
             (blocksize, stepsize, values) = self.vamp_plugin(plugin, wavfile)
 
             self.result_blocksize = blocksize
@@ -99,9 +100,9 @@ class VampSimpleHost(Analyzer):
 
                 values = values[start_index:stop_index + 1]
 
-            plugin_res.id_metadata.id += '.' + '.'.join(self.plugin.split(':')[1:])
+            plugin_res.id_metadata.id += '.' + '.'.join(plugin_line[1:])
             plugin_res.id_metadata.name += ' ' + \
-                ' '.join(self.plugin.split(':')[1:])
+                ' '.join(plugin_line[1:])
             plugin_res.data_object.value = values
 
             self._results.add(plugin_res)
@@ -126,7 +127,6 @@ class VampSimpleHost(Analyzer):
 
         blocksize = int(m.groups()[0])
         stepsize = int(m.groups()[1])
-
         # Get the results
         values = np.asfarray([line.split(': ')[1] for line in res])
         # TODO int support ?