# HG changeset patch # User Chris Cannam # Date 1364422968 0 # Node ID ff787d7194e533a59ff09cbfa9e79d056a635c56 # Parent 1ec604ec535dbf06bf15d86f9c3598016fdb28e5 Structure more output types, add return-structured functions to vamp.yeti diff -r 1ec604ec535d -r ff787d7194e5 yetilab/vamp/vamp.yeti --- a/yetilab/vamp/vamp.yeti Wed Mar 27 22:22:17 2013 +0000 +++ b/yetilab/vamp/vamp.yeti Wed Mar 27 22:22:48 2013 +0000 @@ -14,6 +14,7 @@ fr = load yetilab.stream.framer; af = load yetilab.stream.audiofile; vamprdf = load yetilab.vamp.vamprdf; +vamppost = load yetilab.vamp.vamppost; store = load yertle.store; @@ -294,6 +295,12 @@ Error e: Error e; esac; +processStreamStructured key output filename = + vamppost.postprocess (processStream key output filename); + +processFileStructured key output filename = + vamppost.postprocess (processFile key output filename); + { get pluginPath = getPluginPath, get pluginKeys = listPlugins, @@ -301,5 +308,7 @@ categoryOf, processStream, processFile, +processStreamStructured, +processFileStructured } diff -r 1ec604ec535d -r ff787d7194e5 yetilab/vamp/vamppost.yeti --- a/yetilab/vamp/vamppost.yeti Wed Mar 27 22:22:17 2013 +0000 +++ b/yetilab/vamp/vamppost.yeti Wed Mar 27 22:22:48 2013 +0000 @@ -46,6 +46,7 @@ esac; structureGrid binCount features = +//!!! need to return grid resolution as well -- or will caller read that from output elsewhere if they need it? if empty? features then mat.zeroMatrix { rows = binCount, columns = 0 }; else @@ -53,6 +54,57 @@ (map do f: list (bl.data f.values) done features); fi; +timeOf f = + case f.timestamp of + Time t: t; + _: failWith "Internal error: timestamps not filled"; + esac; + +structureCurve features = +//!!! need to return sample type as well -- or will caller read that from output elsewhere if they need it? + map do f: { + time = timeOf f, + value = (bl.data f.values)[0], + label = f.label + } done features; + +structureInstants features = + map do f: { + time = timeOf f, + label = f.label + } done features; + +structureSegmentation features = + map do f: { + time = timeOf f, + type = (bl.data f.values)[0], + label = f.label + } done features; + +structureNotes features = + map do f: { + time = timeOf f, + duration = f.duration, + pitch = (bl.data f.values)[0], //!!! no, might be empty + otherValues = array (tail (bl.list f.values)), //!!! no, might be empty + label = f.label + } done features; + +structureWithDuration features = + map do f: { + time = timeOf f, + duration = f.duration, + values = array (bl.list f.values), + label = f.label + } done features; + +structureWithoutDuration features = + map do f: { + time = timeOf f, + values = array (bl.list f.values), + label = f.label + } done features; + structure data = (type = data.output.inferredStructure; features = @@ -67,19 +119,22 @@ esac; case type of Curve (): // No duration, one value - Curve features; + Curve (structureCurve features); Grid (): // No duration, >1 value, not variable rate Grid (structureGrid binCount features); Instants (): // Zero-valued features - Instants features; + Instants (structureInstants features); Notes (): // Duration, at least one value (pitch or freq) - Notes features; + Notes (structureNotes features); Regions (): // Duration, zero or more values - Regions features; + Regions (structureWithDuration features); Segmentation (): // No duration, one value, segment type in RDF - Segmentation features; + Segmentation (structureSegmentation features); Unknown (): // Other - Unknown features; + Unknown + ((if data.output.hasDuration then structureWithDuration + else structureWithoutDuration + fi) features); esac); postprocess data = @@ -91,7 +146,6 @@ esac; { -fillTimestamps, postprocess }