comparison README.md @ 310:99d361aa7ad7

Code block formatting
author Chris Cannam
date Tue, 11 Jul 2017 18:35:21 +0100
parents 12eadc54e874
children 79f434d834a7
comparison
equal deleted inserted replaced
309:12eadc54e874 310:99d361aa7ad7
107 107
108 For example, if the example plugins from the Vamp plugin SDK are 108 For example, if the example plugins from the Vamp plugin SDK are
109 available and no other plugins are installed, you might have an 109 available and no other plugins are installed, you might have an
110 exchange like this: 110 exchange like this:
111 111
112 ```
112 $ sonic-annotator -l 113 $ sonic-annotator -l
113 vamp:vamp-example-plugins:amplitudefollower:amplitude 114 vamp:vamp-example-plugins:amplitudefollower:amplitude
114 vamp:vamp-example-plugins:fixedtempo:acf 115 vamp:vamp-example-plugins:fixedtempo:acf
115 vamp:vamp-example-plugins:fixedtempo:detectionfunction 116 vamp:vamp-example-plugins:fixedtempo:detectionfunction
116 vamp:vamp-example-plugins:fixedtempo:filtered_acf 117 vamp:vamp-example-plugins:fixedtempo:filtered_acf
144 vamp:parameter [ vamp:identifier "minbpm" ] ; 145 vamp:parameter [ vamp:identifier "minbpm" ] ;
145 vamp:value "50"^^xsd:float ; 146 vamp:value "50"^^xsd:float ;
146 ] ; 147 ] ;
147 vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#fixedtempo_output_tempo> . 148 vamp:output <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#fixedtempo_output_tempo> .
148 $ 149 $
150 ```
149 151
150 The output of -s is an RDF/Turtle document describing the default 152 The output of -s is an RDF/Turtle document describing the default
151 settings for the Tempo output of the Fixed Tempo Estimator plugin in 153 settings for the Tempo output of the Fixed Tempo Estimator plugin in
152 the Vamp plugin SDK. 154 the Vamp plugin SDK.
153 155
156 known -- but the result should be functionally equivalent to this.) 158 known -- but the result should be functionally equivalent to this.)
157 159
158 You could run this transform by saving the RDF to a file and 160 You could run this transform by saving the RDF to a file and
159 specifying that file with -t: 161 specifying that file with -t:
160 162
163 ```
161 $ sonic-annotator -s vamp:vamp-example-plugins:fixedtempo:tempo > test.n3 164 $ sonic-annotator -s vamp:vamp-example-plugins:fixedtempo:tempo > test.n3
162 $ sonic-annotator -t test.n3 audio.wav -w csv --csv-stdout 165 $ sonic-annotator -t test.n3 audio.wav -w csv --csv-stdout
163 (... logging output on stderr, then ...) 166 (... logging output on stderr, then ...)
164 "audio.wav",0.002902494,5.196916099,68.7916,"68.8 bpm" 167 "audio.wav",0.002902494,5.196916099,68.7916,"68.8 bpm"
165 $ 168 $
169 ```
166 170
167 The single line of output above consists of the audio file name, the 171 The single line of output above consists of the audio file name, the
168 timestamp and duration for a single feature, the value of that feature 172 timestamp and duration for a single feature, the value of that feature
169 (the estimated tempo of the given region of time from that file, in 173 (the estimated tempo of the given region of time from that file, in
170 bpm -- the plugin in question performs a single tempo estimation and 174 bpm -- the plugin in question performs a single tempo estimation and
172 176
173 A quicker way to achieve the above is to use the -d (default) option 177 A quicker way to achieve the above is to use the -d (default) option
174 to tell Sonic Annotator to use directly the default configuration for 178 to tell Sonic Annotator to use directly the default configuration for
175 a named transform: 179 a named transform:
176 180
181 ```
177 $ sonic-annotator -d vamp:vamp-example-plugins:fixedtempo:tempo audio.wav -w csv --csv-stdout 182 $ sonic-annotator -d vamp:vamp-example-plugins:fixedtempo:tempo audio.wav -w csv --csv-stdout
178 (... some log output on stderr, then ...) 183 (... some log output on stderr, then ...)
179 "audio.wav",0.002902494,5.196916099,68.7916,"68.8 bpm" 184 "audio.wav",0.002902494,5.196916099,68.7916,"68.8 bpm"
180 $ 185 $
186 ```
181 187
182 Although handy for experimentation, the -d option is inadvisable in 188 Although handy for experimentation, the -d option is inadvisable in
183 any "production" situation because the plugin configuration is not 189 any "production" situation because the plugin configuration is not
184 guaranteed to be the same each time (for example if an updated version 190 guaranteed to be the same each time (for example if an updated version
185 of a plugin changes some of its defaults). It's better to save a 191 of a plugin changes some of its defaults). It's better to save a
339 The following example tells Sonic Annotator to write both the times of 345 The following example tells Sonic Annotator to write both the times of
340 note onsets estimated by the simple percussion onset detector example 346 note onsets estimated by the simple percussion onset detector example
341 plugin, and the variance of the plugin's onset detection function. 347 plugin, and the variance of the plugin's onset detection function.
342 (It will only process the audio file and run the plugin once.) 348 (It will only process the audio file and run the plugin once.)
343 349
350 ```
344 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. 351 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
345 @prefix vamp: <http://purl.org/ontology/vamp/>. 352 @prefix vamp: <http://purl.org/ontology/vamp/>.
346 @prefix examples: <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#>. 353 @prefix examples: <http://vamp-plugins.org/rdf/plugins/vamp-example-plugins#>.
347 @prefix : <#>. 354 @prefix : <#>.
348 355
352 359
353 :transform0 a vamp:Transform; 360 :transform0 a vamp:Transform;
354 vamp:plugin examples:percussiononsets ; 361 vamp:plugin examples:percussiononsets ;
355 vamp:output examples:percussiononsets_output_detectionfunction ; 362 vamp:output examples:percussiononsets_output_detectionfunction ;
356 vamp:summary_type "variance" . 363 vamp:summary_type "variance" .
364 ```
357 365
358 Sonic Annotator can also summarise in segments -- if you provide a 366 Sonic Annotator can also summarise in segments -- if you provide a
359 comma-separated list of times as an argument to the --segments option, 367 comma-separated list of times as an argument to the --segments option,
360 it will calculate one summary for each segment bounded by the times 368 it will calculate one summary for each segment bounded by the times
361 you provided. For example, 369 you provided. For example,
362 370
371 ```
363 $ sonic-annotator -d vamp:vamp-example-plugins:percussiononsets:detectionfunction -S variance --sumary-only --segments 1,2,3 -w csv --csv-stdout audio.wav 372 $ sonic-annotator -d vamp:vamp-example-plugins:percussiononsets:detectionfunction -S variance --sumary-only --segments 1,2,3 -w csv --csv-stdout audio.wav
364 (... some log output on stderr, then ...) 373 (... some log output on stderr, then ...)
365 ,0.000000000,1.000000000,variance,1723.99,"(variance, continuous-time average)" 374 ,0.000000000,1.000000000,variance,1723.99,"(variance, continuous-time average)"
366 ,1.000000000,1.000000000,variance,1981.75,"(variance, continuous-time average)" 375 ,1.000000000,1.000000000,variance,1981.75,"(variance, continuous-time average)"
367 ,2.000000000,1.000000000,variance,1248.79,"(variance, continuous-time average)" 376 ,2.000000000,1.000000000,variance,1248.79,"(variance, continuous-time average)"
368 ,3.000000000,7.031020407,variance,1030.06,"(variance, continuous-time average)" 377 ,3.000000000,7.031020407,variance,1030.06,"(variance, continuous-time average)"
378 ```
369 379
370 Here the first row contains a summary covering the time period from 0 380 Here the first row contains a summary covering the time period from 0
371 to 1 second, the second from 1 to 2 seconds, the third from 2 to 3 381 to 1 second, the second from 1 to 2 seconds, the third from 2 to 3
372 seconds and the fourth from 3 seconds to the end of the (short) audio 382 seconds and the fourth from 3 seconds to the end of the (short) audio
373 file. 383 file.