changeset 206:0a482ae2525f

Add output type URI via static descriptor ("option E")
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 08 Jun 2017 12:06:09 +0100
parents 6a447d0318d3
children 5c009d5a88a6
files README.md capnp/piper.capnp json/examples/extractorstaticdata.json json/examples/staticoutputdescriptor.json json/schema/extractorstaticdata.json json/schema/staticoutputdescriptor.json
diffstat 6 files changed, 62 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Wed Feb 22 11:03:59 2017 +0000
+++ b/README.md	Thu Jun 08 12:06:09 2017 +0100
@@ -27,7 +27,9 @@
 This repository contains the basic Piper schema. Implementations and
 utilities can be found in neighbouring repositories.
 
-_This is pre-1.0 code and the protocol or API may change at any time_
+The basic Piper schema is now in "shipping" state: it may be extended
+in future, but always in ways that retain compatibility with existing
+systems.
 
 [![Build Status](https://travis-ci.org/piper-audio/piper.svg?branch=master)](https://travis-ci.org/piper-audio/piper)
 
--- a/capnp/piper.capnp	Wed Feb 22 11:03:59 2017 +0000
+++ b/capnp/piper.capnp	Thu Jun 08 12:06:09 2017 +0100
@@ -45,6 +45,26 @@
     variableSampleRate @2;                        # Features have their own individual timestamps.
 }
 
+struct StaticOutputDescriptor {
+
+    # Properties of an output, that is, a single stream of features
+    # produced in response to process and finish requests. A feature
+    # extractor may have any number of outputs, and it always
+    # calculates and returns features from all of them when
+    # processing; this is useful in cases where more than one feature
+    # can be easily calculated using a single method.
+    # 
+    # This structure contains the properties of an output that are
+    # static, i.e. that do not depend on the parameter values provided
+    # at configuration, excluding the Basic struct parameters like id
+    # and description.  The Basic struct properties are not included
+    # for historical reasons: they were already referenced separately
+    # in the OutputDescriptor and ExtractorStaticData before this
+    # struct was introduced.
+    
+    typeURI            @0  :Text;                 # URI indicating the sort of feature that this output returns (see docs).
+}
+
 struct ConfiguredOutputDescriptor {
     # Properties of an output, that is, a single stream of features produced
     # in response to process and finish requests. A feature extractor may
@@ -69,11 +89,13 @@
 }
 
 struct OutputDescriptor {
-    # All the properties of an output, both static (the basic metadata) and
-    # potentially dependent on configuration parameters (the configured descriptor).
+    # All the properties of an output, both static (the basic metadata and static
+    # descriptor) and potentially dependent on configuration parameters (the
+    # configured descriptor).
 
     basic              @0  :Basic;                # Basic metadata about the output.
     configured         @1  :ConfiguredOutputDescriptor;    # Properties of the output that may depend on configuration parameters.
+    static             @2  :StaticOutputDescriptor;        # Properties (other than Basic) that do not depend on parameters.
 }
 
 enum InputDomain {
@@ -102,6 +124,16 @@
     programs           @9  :List(Text);           # List of predefined programs. For backward-compatibility, not recommended.
     inputDomain        @10 :InputDomain;          # Whether the extractor requires time-domain or frequency-domain input audio.
     basicOutputInfo    @11 :List(Basic);          # Basic metadata about all of the outputs of the extractor.
+
+    struct SOPair {
+        # A mapping between output identifier and static descriptor for
+	# that output.
+	
+        output         @0  :Text;                 # Output id, matching the output's descriptor's basic identifier.
+        static         @1  :StaticOutputDescriptor;
+    }
+
+    staticOutputInfo   @12 :List(SOPair);         # Static descriptors for all outputs that have any static metadata.
 }
 
 struct RealTime {
--- a/json/examples/extractorstaticdata.json	Wed Feb 22 11:03:59 2017 +0000
+++ b/json/examples/extractorstaticdata.json	Thu Jun 08 12:06:09 2017 +0100
@@ -1,1 +1,1 @@
-{"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "rights": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005.  Freely redistributable (BSD license)", "inputDomain": "FrequencyDomain", "key": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "version": 2}
+{"basic": {"description": "Detect percussive note onsets by identifying broadband energy rises", "identifier": "percussiononsets", "name": "Simple Percussion Onset Detector"}, "basicOutputInfo": [{"description": "Percussive note onset locations", "identifier": "onsets", "name": "Onsets"}, {"description": "Broadband energy rise detection function", "identifier": "detectionfunction", "name": "Detection Function"}], "category": ["Time", "Onsets"], "rights": "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005.  Freely redistributable (BSD license)", "inputDomain": "FrequencyDomain", "key": "vamp-example-plugins:percussiononsets", "maker": "Vamp SDK Example Plugins", "maxChannelCount": 1, "minChannelCount": 1, "parameters": [{"basic": {"description": "Energy rise within a frequency bin necessary to count toward broadband total", "identifier": "threshold", "name": "Energy rise threshold"}, "defaultValue": 3, "extents": {"max": 20, "min": 0}, "unit": "dB", "valueNames": []}, {"basic": {"description": "Sensitivity of peak detector applied to broadband detection function", "identifier": "sensitivity", "name": "Sensitivity"}, "defaultValue": 40, "extents": {"max": 100, "min": 0}, "unit": "%", "valueNames": []}], "programs": [], "staticOutputInfo": {"onsets": {"typeURI": "http://purl.org/ontology/af/Onset"}, "detectionfunction": {"typeURI": "http://purl.org/ontology/af/OnsetDetectionFunction"}}, "version": 2}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/json/examples/staticoutputdescriptor.json	Thu Jun 08 12:06:09 2017 +0100
@@ -0,0 +1,2 @@
+{"typeURI": "http://purl.org/ontology/af/OnsetDetectionFunction"}
+
--- a/json/schema/extractorstaticdata.json	Wed Feb 22 11:03:59 2017 +0000
+++ b/json/schema/extractorstaticdata.json	Thu Jun 08 12:06:09 2017 +0100
@@ -43,7 +43,15 @@
 	"basicOutputInfo": {
 	    "type": "array",
 	    "items": { "$ref": "http://vamp-plugins.org/piper/json/schema/basic#" }
-	}
+	},
+        "staticOutputInfo": {
+            "type": "object",
+            "patternProperties": {
+                "^[a-zA-Z0-9_-]+$": {
+                    "$ref": "http://vamp-plugins.org/piper/json/schema/staticoutputdescriptor#"
+                }
+            }
+        }
     },
     "required": [ "key", "basic", "version",
 		  "minChannelCount", "maxChannelCount",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/json/schema/staticoutputdescriptor.json	Thu Jun 08 12:06:09 2017 +0100
@@ -0,0 +1,13 @@
+{
+  "id": "http://vamp-plugins.org/piper/json/schema/staticoutputdescriptor#",
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "description": "schema for any additional static metadata fields (besides the basic metadata) of an output descriptor belonging to a feature extractor",
+  "type": "object",
+  "properties": {
+  "typeURI": {
+    "type": "string"
+  }
+  },
+  "additionalProperties": false
+}
+