class_docstr: Vamp plugins library interface analyzer
class_docstr_tok: ["Vamp","plugins","library","interface","analyzer"]
code: def vamp_plugin(plugin, wavfile):
      def get_vamp_result(txt_file):
          # Guess format
          time_, value_ = np.genfromtxt(
              txt_file, delimiter=":", dtype=str, unpack=True
          )
          time_duration = np.genfromtxt(
              np.array(time_).ravel(),
              delimiter=",",
              dtype=float,
              unpack=True,
          )
  
          if len(time_duration.shape) <= 1:
              time = time_duration
          if len(time_duration.shape) == 2:
              time = time_duration[:, 0]
              duration = time_duration[:, 1]
          else:
              duration = None
  
          if value_.size == 1 and value_ == "":
              value = None
          elif value_.size > 1 and (value_ == "").all():
              value = None
          else:
              value = np.genfromtxt(
                  np.array(value_).ravel(),
                  delimiter=" ",
                  invalid_raise=False,
              )
              value = np.atleast_2d(value)
              if np.isnan(value[:, -1]).all():
                  value = value[:, 0:-1]
  
          return (time, duration, value)
  
      vamp_output_file = tempfile.NamedTemporaryFile(
          suffix="_vamp.txt", delete=False
      )
      args = [plugin, wavfile, "-o", vamp_output_file.name]
  
      stderr = simple_host_process(args)  # run vamp-simple-host
  
      # Parse stderr to get blocksize and stepsize
      blocksize_info = stderr[4]
  
      import re
  
      # Match agianst pattern 'Using block size = %d, step size = %d'
      m = re.match(
          "Using block size = (\d+), step size = (\d+)", blocksize_info
      )
  
      blocksize = int(m.groups()[0])
      stepsize = int(m.groups()[1])
      # Get the results
  
      return get_vamp_result(vamp_output_file)
  
imports: from timeside.core import implements, interfacedoc
  from timeside.core.analyzer import Analyzer
  from timeside.core.api import IAnalyzer
  from timeside.core.tools.parameters import HasTraits, List
  import subprocess
  import tempfile
  import numpy
  from timeside.core.tools.parameters import store_parameters
  from timeside.core.exceptions import VampImportError
label_desc: Use image node_id 9 for calling the VampSimpleHost obj's underlying member method code with example usage: obj.vamp_plugin(plugin, wavfile) and returns: get_vamp_result, time,  duration,  value