Desirable goals » History » Version 1

Version 1/5 - Next » - Current version
Chris Cannam, 2015-01-12 12:14 PM


Desirable goals

Dan writes:

Well just from my point of view, and not having thought through all the flexible types of output that vamp provides, I'd be hoping to type things like:

# all in-memory:

plug = vh.loadPlugin('vamp-example-plugins:mfcc', 44100)
mfccs = np.array([features[0] for features in plug.processall([-0.1, 0, 0.1, 0, -0.1, 0, 0.1, 0])])  # this gives a 2D numpy array of shape [nframes, nmfccs]

plug = vh.loadPlugin('vamp-example-plugins:onsetdetector', 44100)
onsets = np.array([features[0] for features in plug.processall([-0.1, 0, 0.1, 0, -0.1, 0, 0.1, 0])])  # this gives a 1D numpy array, a list of onset times I guess

# from disk, to memory:

plug = vh.loadPlugin('vamp-example-plugins:mfcc', 44100)
with open(filepath) as f:
    mfccs = np.array([features[0] for features in plug.processall(f)])
plt.matshow(mfccs, interpolate='nearest') # a simple pyplot

# fully streaming:

plug = vh.loadPlugin('vamp-example-plugins:mfcc', 44100)
with open(filepath) as f:
    with open(outpath, 'wb') as outf:
        for features in plug.processall(f):
            outpath.write("%g\n" % features[0][0] ** 2)

BTW I noticed I made a couple of mistakes in there