view pluginstats.yeti @ 165:3b89c48d0593 tip

URL to Vamp Plugin Pack Page
author Chris Cannam
date Tue, 11 Aug 2020 17:30:01 +0100
parents cb034521f602
children
line wrap: on
line source

program pluginstats;

// NB Make sure the correct RDF files are in the path!
// e.g. VAMP_PATH=./rdf/plugins ~/code/may/bin/yc ./pluginstats.yeti

store = load yertle.store;
vamprdf = load may.vamp.vamprdf;

pluginStore = store.newRdfStore ();
vamprdf.loadSystemVampRdf pluginStore;

sortPlugins =
   (props = map (strLower .) [ (.library.name), (.maker), (.name) ];
    sortBy do a b:
        case (find do prop: prop a != prop b done props) of
        prop::_: prop a < prop b;
        _: false;
        esac
    done);

pluginData = sortPlugins
    (map (vamprdf.pluginDataByNode pluginStore)
         (vamprdf.allPluginNodes pluginStore));

// based on structureOf in vamp.yeti
guessStructure od = 
   (noteIRI = case pluginStore.expand "af:Note" of IRI iri: iri; _: "" esac;
    denseTypeIRI = case pluginStore.expand "vamp:DenseOutput" of IRI iri: iri; _: "" esac;
    case od.binCount of
    Known 0:
        if od.rdfType == denseTypeIRI
        then Series () // binCount must be wrong!
        else Instants ()
        fi;
    Known 1:
        case od.computes of
        Event e:
            if e == noteIRI then Notes ()
            elif strEnds? e "Segment" then Segmentation ()
            else Curve ()
            fi;
        _:
            if od.rdfType == denseTypeIRI
            then Series ()
            else
                if od.valueUnit == "Hz" or strIndexOf (strLower od.valueUnit) "midi" 0 >= 0 then Notes ()
                else Curve ()
                fi
            fi;
        esac;
    Known n:
        if od.rdfType == denseTypeIRI then Grid () 
        elif od.computes == Event noteIRI then Notes ()
        elif od.valueUnit == "Hz" or strIndexOf (strLower od.valueUnit) "midi" 0 >= 0 then Notes ()
        else Unknown () //!!! would like to emit Regions () if we had duration
        fi;
    Unknown _:
        Unknown ();
    esac);

formatComputes =
   (abbr s = pluginStore.abbreviate (IRI s);
    \case of
    Event s: Event (abbr s);
    Feature s: Feature (abbr s);
    Signal s: Signal (abbr s);
    Unknown (): Unknown ()
    esac);

println "|*Library*|*Plugin*|*Output*|*Declared RDF Type*|*Guessed Structure*|";

distinctDeclared = [:];
distinctGuessed = [:];

cutNils = strReplace " []" "";

for pluginData do pd:
    for pd.outputs do od:
        declared = formatComputes od.computes;
        guessed = guessStructure od;
        distinctDeclared[string declared] := true;
        distinctGuessed[string guessed] := true;
        row = "|\(pd.library.name)|\(pd.name)|\(od.name)|\(declared)|\(guessed)|";
        println (cutNils row);
    done
done;

printKeys d =
   for (sort (keys d)) do t: println (cutNils "|\(t)|") done;

println "\n|*Distinct declared RDF types*|";
printKeys (distinctDeclared);

println "\n|*Distinct guessed structures*|";
printKeys (distinctGuessed);