changeset 148:afd60ff5ceef

* Commit updates from David to deal with quantized outputs and known-range outputs
author cannam
date Mon, 23 Jun 2008 13:05:21 +0000
parents 27da08f3e951
children 0f72cadc5cc8
files rdf/generator/template-generator.cpp rdf/vamp.n3
diffstat 2 files changed, 156 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/generator/template-generator.cpp	Fri Jun 20 14:26:23 2008 +0000
+++ b/rdf/generator/template-generator.cpp	Mon Jun 23 13:05:21 2008 +0000
@@ -120,6 +120,33 @@
 
 string describe_param(Plugin *plugin, Plugin::ParameterDescriptor p)
 {
+
+    //FIXME: dc:format and vamp:unit are the same???
+    if(p.isQuantized){
+     string res=\
+        "plugbase:"+plugin->getIdentifier()+"_param_"+p.identifier+" a  vamp:QuantizedParameterDescriptor ;\n\
+    vamp:identifier     \""+p.identifier+"\" ;\n\
+    dc:title            \""+p.name+"\" ;\n\
+    dc:format           \""+p.unit+"\" ;\n\
+    vamp:min_value       "+to_string(p.minValue)+" ;\n\
+    vamp:max_value       "+to_string(p.maxValue)+" ;\n\
+    vamp:unit           \""+p.unit+"\" ;\n\
+    vamo:quantize_step   "+to_string(p.quantizeStep)+"  ;\n\
+    vamp:default_value   "+to_string(p.defaultValue)+" ;\n\
+    vamp:value_names     (";
+
+            unsigned int i;
+            for (i=0; i+1 < p.valueNames.size(); i++)
+                res+=" \""+p.valueNames[i]+"\"";
+            if (i < p.valueNames.size())
+                res+=" \""+p.valueNames[i]+"\"";
+            res+=");\n";
+    
+    res+="    .\n";
+
+    return res;
+            
+    }else{
     string res=\
         "plugbase:"+plugin->getIdentifier()+"_param_"+p.identifier+" a  vamp:ParameterDescriptor ;\n\
     vamp:identifier     \""+p.identifier+"\" ;\n\
@@ -127,14 +154,32 @@
     dc:format           \""+p.unit+"\" ;\n\
     vamp:min_value       "+to_string(p.minValue)+" ;\n\
     vamp:max_value       "+to_string(p.maxValue)+" ;\n\
-    vamp:default_value   "+to_string(p.defaultValue)+" .\n\n";
+    vamp:unit           \""+p.unit+"\"  ;\n\
+    vamp:default_value   "+to_string(p.defaultValue)+" ;\n\
+    vamp:value_names     (";
+
+            unsigned int i;
+            for (i=0; i+1 < p.valueNames.size(); i++)
+                res+=" \""+p.valueNames[i]+"\"";
+            if (i < p.valueNames.size())
+                res+=" \""+p.valueNames[i]+"\"";
+            res+=");\n";
+    
+    res+="    .\n";
+
     return res;
+
+    }  
 }
 
 string describe_output(Plugin *plugin, Plugin::OutputDescriptor o)
 {
 
     //we need to distinguish here between different output types:
+
+//Quantize or not
+//KnownExtents or not
+//Data output classification:
     //DenseOutput
     //SparseOutput
     //TrackLevelOutput
@@ -153,10 +198,23 @@
     dc:title              \""+o.name+"\" ;\n\
     dc:description        \""+o.description+"\"  ;\n\
     vamp:fixed_bin_count  \""+(o.hasFixedBinCount == 1 ? "true" : "false")+"\" ;\n\
-    vamp:is_quantized     \""+(o.isQuantized == 1 ? "true" : "false")+"\"  ;\n\
     vamp:unit             \""+(o.unit)+"\" ;\n";
                           
-                        
+             
+        //another type of output           
+        if(o.isQuantized){
+
+            res+="    a                     vamp:QuantizedOutput ;\n";
+            res+="    vamp:quantize_step    "+to_string(o.quantizeStep)+"  ;\n";    
+        }
+        
+        //and yet another type
+        if(o.hasKnownExtents){
+
+            res+="    a                 vamp:KnownExtentsOutput ;\n";
+            res+="    vamp:min_value    "+to_string(o.minValue)+"  ;\n"; 
+            res+="    vamp:max_value    "+to_string(o.maxValue)+"  ;\n";    
+        }
 
         // FIXME ? Bin names may vary based on plugin setup, so including them here might be misleading...
         if (o.hasFixedBinCount)
@@ -171,12 +229,7 @@
                 res+=" \""+o.binNames[i]+"\"";
             res+=");\n";
         }
-        
-        if (o.isQuantized)
-        {
-            res+="    vamp:quantize_step    "+to_string(o.quantizeStep)+"  ;\n";
-        }
-
+       
         res+="    vamp:sample_type      vamp:VariableSampleRate ;\n";
         if (o.sampleRate > 0.0f)
             res+="    vamp:sample_rate      "+to_string(o.sampleRate)+" ;\n";
@@ -193,10 +246,23 @@
     dc:title              \""+o.name+"\" ;\n\
     dc:description        \""+o.description+"\"  ;\n\
     vamp:fixed_bin_count  \""+(o.hasFixedBinCount == 1 ? "true" : "false")+"\" ;\n\
-    vamp:is_quantized     \""+(o.isQuantized == 1 ? "true" : "false")+"\"  ;\n\
     vamp:unit             \""+(o.unit)+"\" ;\n";
 
 
+        //another type of output           
+        if(o.isQuantized){
+
+            res+="    a                     vamp:QuantizedOutput ;\n";
+            res+="    vamp:quantize_step    "+to_string(o.quantizeStep)+"  ;\n";    
+        }
+        
+        //and yet another type
+        if(o.hasKnownExtents){
+
+            res+="    a                 vamp:KnownExtentsOutput ;\n";
+            res+="    vamp:min_value    "+to_string(o.minValue)+"  ;\n"; 
+            res+="    vamp:max_value    "+to_string(o.maxValue)+"  ;\n";    
+        }
 
         // FIXME ? Bin names may vary based on plugin setup, so including them here might be misleading...
         if (o.hasFixedBinCount)
@@ -212,12 +278,6 @@
             res+=");\n";
         }
 
-        if (o.isQuantized)
-        {
-            res+="    vamp:quantize_step    "+to_string(o.quantizeStep)+"  ;\n";
-        }	
-
-
         else if (o.sampleType == Plugin::OutputDescriptor::FixedSampleRate)
         {
             res+="    vamp:sample_type      vamp:FixedSampleRate ;\n";
--- a/rdf/vamp.n3	Fri Jun 20 14:26:23 2008 +0000
+++ b/rdf/vamp.n3	Mon Jun 23 13:05:21 2008 +0000
@@ -77,6 +77,16 @@
 	vs:term_status "stable";
 	.
 
+vamp:QuantizedParameterDescriptor
+	a owl:Class;
+	rdfs:label "QuantizedParameter Descriptor";
+	rdfs:subClassOf	vamp:ParameterDescriptor;
+	rdfs:comment """
+			Descriptor of a parameter that does have quantized values. The property quantize_step is just defined for this subclass and not for the general Parameter Descriptor.
+	""";
+	vs:term_status "stable";
+	.
+
 vamp:PluginOutput
 	a owl:Class;
 	rdfs:label "Vamp Plugin output descriptor";
@@ -86,6 +96,33 @@
 	vs:term_status "unstable";
 	.
 
+#3 classifications of outputs: 
+#-density of data
+#-quantised
+#-known extents
+
+#there is not classification for fix_bin_count
+
+vamp:QuantizedOutput
+	a owl:Class;
+	rdfs:label "Quantized Output";
+	rdfs:subClassOf	vamp:PluginOutput;
+	rdfs:comment """
+			Descriptor of an output that does have quantized values.
+	""";
+	vs:term_status "stable";
+	.
+
+vamp:KnownExtentsOutput
+	a owl:Class;
+	rdfs:label "Known Extents Output";
+	rdfs:subClassOf	vamp:PluginOutput;
+	rdfs:comment """
+			Descriptor of an output that does have known extents.
+	""";
+	vs:term_status "stable";
+	.
+
 vamp:DenseOutput
 	a owl:Class;
 	rdfs:subClassOf vamp:PluginOutput;
@@ -249,7 +286,7 @@
 
 # Note that other properties like maker can be linked to the plugin descriptor using other namespaces
 
-##### Parameter Descriptor properties
+##### Parameter Descriptor properties (and some common with PluginOutput)
 
 # Note: Identifier has been already defined
 
@@ -262,7 +299,7 @@
 		Maximum value of the parameter range
 	""";
 	rdfs:range vamp:ParameterDescriptor;
-	rdfs:range vamp:PluginOutput;
+	rdfs:range vamp:KnownExtentsOutput;
 	vs:term_status "unstable";
 	.
 
@@ -275,7 +312,7 @@
 		Minimum value of the parameter range
 	""";
 	rdfs:range vamp:ParameterDescriptor;
-	rdfs:range vamp:PluginOutput;
+	rdfs:range vamp:KnownExtentsOutput;
 	vs:term_status "unstable";
 	.
 
@@ -291,6 +328,43 @@
 	vs:term_status "unstable";
 	.
 
+vamp:quantize_step
+	a rdf:Property;
+	a owl:FunctionalProperty;
+	a owl:DatatypeProperty;
+	rdfs:label "quantized step";
+	rdfs:comment """
+		Quantize step. Only defined if is_quantized is true
+	""";
+	rdfs:domain vamp:QuantizedOutput;
+	rdfs:domain vamp:QuantizedParameterDescriptor;
+	vs:term_status "unstable";
+	.
+
+vamp:unit 
+	a rdf:Property;
+	a owl:DatatypeProperty;
+	a owl:FunctionalProperty;
+	rdfs:label "unit";
+	rdfs:comment """
+		Unit of the output/parameter. A string type
+	""";
+	rdfs:domain vamp:PluginOutput;
+	rdfs:domain vamp:ParameterDescriptor;
+	vs:term_status "unstable";
+	.
+
+vamp:value_names  
+	a rdf:Property;
+	a owl:DatatypeProperty;
+	rdfs:label "value names";
+	rdfs:comment """
+		List of value names if available
+	""";
+	rdfs:domain vamp:ParameterDescriptor;
+	vs:term_status "unstable";
+	.
+
 ########Output Descriptor properties
 
 vamp:fixed_bin_count 
@@ -304,30 +378,6 @@
 	vs:term_status "unstable";
 	.
 
-vamp:is_quantized
-	a rdf:Property;
-	a owl:DatatypeProperty;
-	rdfs:label "is quantized";
-	rdfs:comment """
-		Quantized. A boolean type.
-	""";
-	rdfs:domain vamp:PluginOutput;
-	vs:term_status "unstable";
-	.
-
-vamp:unit 
-	a rdf:Property;
-	a owl:DatatypeProperty;
-	a owl:FunctionalProperty;
-	rdfs:label "unit";
-	rdfs:comment """
-		Unit of the output/parameter. A string type
-	""";
-	rdfs:domain vamp:PluginOutput;
-	rdfs:domain vamp:ParameterDescriptor;
-	vs:term_status "unstable";
-	.
-
 vamp:sample_rate
 	a rdf:Property;
 	a owl:DatatypeProperty;
@@ -338,19 +388,6 @@
 	rdfs:domain vamp:PluginOutput;
 	vs:term_status "unstable";
 	.
-
-vamp:quantize_step
-	a rdf:Property;
-	a owl:FunctionalProperty;
-	a owl:DatatypeProperty;
-	rdfs:label "quantized step";
-	rdfs:comment """
-		Quantize step. Only defined if is_quantized is true
-	""";
-	rdfs:domain vamp:PluginOutput;
-	rdfs:domain vamp:ParameterDescriptor;
-	vs:term_status "unstable";
-	.
 	
 vamp:bin_count      
 	a rdf:Property;
@@ -368,7 +405,7 @@
 	a owl:DatatypeProperty;
 	rdfs:label "bin names";
 	rdfs:comment """
-		List of bin names if available
+		List of bin names if available.
 	""";
 	rdfs:domain vamp:PluginOutput;
 	vs:term_status "unstable";
@@ -387,6 +424,8 @@
 	vs:term_status "unstable";
 	.
 
+#These last 2 properties are included to match the Audio Features Ontology (not estrictly from the Vamp API).
+
 vamp:computes_feature_type
 	a rdf:Property;
 	a owl:ObjectProperty;