changeset 62:2b1e48b14423

Add framewise scripts
author Chris Cannam
date Wed, 12 Aug 2015 17:36:31 +0100
parents 3f0dbafd8bb4
children 6f2e82e453da
files multiple_f0_estimation/silvet/README.txt multiple_f0_estimation/silvet/doFramewiseF0-piano.sh multiple_f0_estimation/silvet/doFramewiseF0.sh multiple_f0_estimation/silvet/doNoteTracking-piano.sh multiple_f0_estimation/silvet/doNoteTracking.sh multiple_f0_estimation/silvet/frames.py multiple_f0_estimation/silvet/silvet-for-framewise-piano.ttl multiple_f0_estimation/silvet/silvet-for-framewise.ttl multiple_f0_estimation/silvet/silvet-piano.ttl multiple_f0_estimation/silvet/silvet.n3 multiple_f0_estimation/silvet/silvet.so multiple_f0_estimation/silvet/silvet.ttl
diffstat 12 files changed, 284 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/multiple_f0_estimation/silvet/README.txt	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/README.txt	Wed Aug 12 17:36:31 2015 +0100
@@ -1,42 +1,72 @@
-# MIREX 2014 submission
+
+# MIREX 2015 submission
 #
 # Multiple Fundamental Frequency Estimation & Tracking
-# Chris Cannam, chris.cannam@eecs.qmul.ac.uk
+# Chris Cannam, c.cannam@qmul.ac.uk
 
   This submission uses the Silvet note estimation Vamp plugin running
   in Sonic Annotator.
 
-  The plugin only produces note-tracked outputs, so there is no
-  frame-by-frame estimation included with this submission.
+  Four scripts are provided:
 
-  Two scripts are provided: doNoteTracking.sh runs the plugin in
-  "unknown instrument" mode (the default for this plugin), while
-  doNoteTracking-piano.sh runs it in "piano" mode.
+   * doFramewiseF0.sh runs the plugin in "unknown instrument" mode and
+     produces framewise output. This should be used for the framewise
+     multi-F0 task on the general multi-instrument dataset.
+
+   * doFramewiseF0-piano.sh runs the plugin in "piano" mode and
+     produces framewise output. This should be used for the framewise
+     multi-F0 task, if being evaluated on a dedicated piano-only
+     dataset.
+
+   * doNoteTracking.sh runs the plugin in "unknown instrument" mode
+     (the default for this plugin) and produces note-tracked
+     output. This should be used for the note tracking task on the
+     general multi-instrument dataset.
+
+   * doNoteTracking-piano.sh runs the plugin in "piano" mode and
+     produces note-tracked output. This should be used for the note
+     tracking task, if being evaluated on a dedicated piano-only
+     dataset.
+
 
 # Architecture
 
 - Linux 64-bit
 
+
 # Dependencies
 
-- Sonic Annotator v1.0
+- Sonic Annotator v1.1
   http://code.soundsoftware.ac.uk/projects/sonic-annotator/files
 
 - GNU libc 2.15 or newer, GNU libstdc++ 3.4.15 or newer
 
 - Typical Unix/GNU shell commands
 
+
 # How to run
 
 In a terminal window run:
 
+./doFramewiseF0.sh /path/to/audiofile.wav /path/to/outputfile.txt
+
+(for framewise multi-F0 on multi-instrument datasets)
+
+or
+
+./doFramewiseF0-piano.sh /path/to/audiofile.wav /path/to/outputfile.txt
+
+(for framewise multi-F0 on piano-only datasets)
+
+or
+
 ./doNoteTracking.sh /path/to/audiofile.wav /path/to/outputfile.txt
 
-(for multi-instrument datasets)
+(for note tracking on multi-instrument datasets)
 
 or
 
 ./doNoteTracking-piano.sh /path/to/audiofile.wav /path/to/outputfile.txt
 
-(for piano-only datasets)
+(for note tracking on piano-only datasets)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multiple_f0_estimation/silvet/doFramewiseF0-piano.sh	Wed Aug 12 17:36:31 2015 +0100
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+mydir=`dirname "$0"`
+infile="$1"
+outfile="$2"
+
+if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then
+    echo "Usage: $0 infile.wav outfile.txt"
+    exit 2
+fi
+
+mkdir -p "$mydir"/out || exit 1
+
+inbase=`basename "$infile"`
+inbase=${inbase%.*}
+
+echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2
+
+# Run the Silvet plugin.
+#
+# 1. Run the plugin. This will produce an output file
+# out/${inbase}.csv
+
+VAMP_PATH="$mydir" sonic-annotator \
+    -t "$mydir"/silvet-for-framewise-piano.ttl \
+    -w csv \
+    --csv-separator ' ' \
+    --csv-one-file "$mydir/out/$inbase.csv" \
+    --csv-omit-filename \
+    --csv-force \
+    "$infile" || exit 1
+
+# 2. Check the output file exists
+
+poutfile="$mydir/out/$inbase.csv"
+if [ ! -f "$poutfile" ]; then
+    echo "output file $poutfile not found! bailing out"; exit 1
+fi
+
+# 3. Convert the format to framewise data
+
+ppoutfile="$mydir/out/$inbase.csv.sorted"
+cat "$poutfile" | sort -n > "$ppoutfile"
+./frames.py "$ppoutfile" > "$outfile"
+
+echo "Done, output is in $outfile"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multiple_f0_estimation/silvet/doFramewiseF0.sh	Wed Aug 12 17:36:31 2015 +0100
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+mydir=`dirname "$0"`
+infile="$1"
+outfile="$2"
+
+if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then
+    echo "Usage: $0 infile.wav outfile.txt"
+    exit 2
+fi
+
+mkdir -p "$mydir"/out || exit 1
+
+inbase=`basename "$infile"`
+inbase=${inbase%.*}
+
+echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2
+
+# Run the Silvet plugin.
+#
+# 1. Run the plugin. This will produce an output file
+# out/${inbase}.csv
+
+VAMP_PATH="$mydir" sonic-annotator \
+    -t "$mydir"/silvet-for-framewise.ttl \
+    -w csv \
+    --csv-separator ' ' \
+    --csv-one-file "$mydir/out/$inbase.csv" \
+    --csv-omit-filename \
+    --csv-force \
+    "$infile" || exit 1
+
+# 2. Check the output file exists
+
+poutfile="$mydir/out/$inbase.csv"
+if [ ! -f "$poutfile" ]; then
+    echo "output file $poutfile not found! bailing out"; exit 1
+fi
+
+# 3. Convert the format to framewise data
+
+ppoutfile="$mydir/out/$inbase.csv.sorted"
+cat "$poutfile" | sort -n > "$ppoutfile"
+./frames.py "$ppoutfile" > "$outfile"
+
+echo "Done, output is in $outfile"
--- a/multiple_f0_estimation/silvet/doNoteTracking-piano.sh	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/doNoteTracking-piano.sh	Wed Aug 12 17:36:31 2015 +0100
@@ -26,6 +26,7 @@
     -w csv \
     --csv-separator ' ' \
     --csv-one-file "$mydir/out/$inbase.csv" \
+    --csv-omit-filename \
     --csv-force \
     "$infile" || exit 1
 
--- a/multiple_f0_estimation/silvet/doNoteTracking.sh	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/doNoteTracking.sh	Wed Aug 12 17:36:31 2015 +0100
@@ -26,6 +26,7 @@
     -w csv \
     --csv-separator ' ' \
     --csv-one-file "$mydir/out/$inbase.csv" \
+    --csv-omit-filename \
     --csv-force \
     "$infile" || exit 1
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multiple_f0_estimation/silvet/frames.py	Wed Aug 12 17:36:31 2015 +0100
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import sys
+
+if __name__ == '__main__':
+
+    nargs = len(sys.argv)
+    if nargs != 2:
+        print("\nUsage: " + sys.argv[0] + " file.txt")
+        exit(1)
+
+    fname = sys.argv[1]
+    
+    f = open(fname, 'r')
+
+    data = [ line.split(' ') for line in f ];
+    ms = 0
+    extant = {}
+    ix = 0
+
+    while ix < len(data):
+
+        sec = ms / 1000.0
+
+        while ix < len(data) and sec >= float(data[ix][0]):
+            time, freq, vely = data[ix][:3]
+            if vely == "0":
+                del extant[freq]
+            else:
+                extant[freq] = vely
+            ix = ix + 1
+
+        print("\t".join([str(sec)] + list(extant.keys())))
+            
+        ms = ms + 10
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multiple_f0_estimation/silvet/silvet-for-framewise-piano.ttl	Wed Aug 12 17:36:31 2015 +0100
@@ -0,0 +1,25 @@
+@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
+@prefix vamp:     <http://purl.org/ontology/vamp/> .
+@prefix :         <#> .
+
+:transform a vamp:Transform ;
+    vamp:plugin <http://vamp-plugins.org/rdf/plugins/silvet#silvet> ;
+    vamp:plugin_version 3 ;
+    vamp:step_size "1024"^^xsd:int ; 
+    vamp:block_size "1024"^^xsd:int ; 
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "finetune" ] ;
+        vamp:value "1"^^xsd:float ;
+    ] ;
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "instrument" ] ;
+        vamp:value "1"^^xsd:float ;
+    ] ;
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "mode" ] ;
+        vamp:value "1"^^xsd:float ;
+    ] ;
+    vamp:output [
+    	vamp:identifier "onoffsets" ;
+    ] ;
+    .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multiple_f0_estimation/silvet/silvet-for-framewise.ttl	Wed Aug 12 17:36:31 2015 +0100
@@ -0,0 +1,25 @@
+@prefix xsd:      <http://www.w3.org/2001/XMLSchema#> .
+@prefix vamp:     <http://purl.org/ontology/vamp/> .
+@prefix :         <#> .
+
+:transform a vamp:Transform ;
+    vamp:plugin <http://vamp-plugins.org/rdf/plugins/silvet#silvet> ;
+    vamp:plugin_version 3 ;
+    vamp:step_size "1024"^^xsd:int ; 
+    vamp:block_size "1024"^^xsd:int ; 
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "finetune" ] ;
+        vamp:value "1"^^xsd:float ;
+    ] ;
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "instrument" ] ;
+        vamp:value "0"^^xsd:float ;
+    ] ;
+    vamp:parameter_binding [
+        vamp:parameter [ vamp:identifier "mode" ] ;
+        vamp:value "1"^^xsd:float ;
+    ] ;
+    vamp:output [
+    	vamp:identifier "onoffsets" ;
+    ] ;
+    .
--- a/multiple_f0_estimation/silvet/silvet-piano.ttl	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/silvet-piano.ttl	Wed Aug 12 17:36:31 2015 +0100
@@ -4,6 +4,7 @@
 
 :transform a vamp:Transform ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/silvet#silvet> ;
+    vamp:plugin_version 3 ;
     vamp:step_size "1024"^^xsd:int ; 
     vamp:block_size "1024"^^xsd:int ; 
     vamp:parameter_binding [
--- a/multiple_f0_estimation/silvet/silvet.n3	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/silvet.n3	Wed Aug 12 17:36:31 2015 +0100
@@ -51,15 +51,20 @@
 #   cc:license            <Place plugin license URI here and uncomment> ; 
     vamp:identifier       "silvet" ;
     vamp:vamp_API_version vamp:api_version_2 ;
-    owl:versionInfo       "1" ;
+    owl:versionInfo       "3" ;
     vamp:input_domain     vamp:TimeDomain ;
     vamp:parameter   plugbase:silvet_param_mode ;
     vamp:parameter   plugbase:silvet_param_instrument ;
     vamp:parameter   plugbase:silvet_param_finetune ;
 
     vamp:output      plugbase:silvet_output_notes ;
+    vamp:output      plugbase:silvet_output_onsets ;
     vamp:output      plugbase:silvet_output_timefreq ;
+    vamp:output      plugbase:silvet_output_pitchactivation ;
+    vamp:output      plugbase:silvet_output_chroma ;
+    vamp:output      plugbase:silvet_output_templates ;
     .
+    
 plugbase:silvet_param_mode a  vamp:QuantizedParameter ;
     vamp:identifier     "mode" ;
     dc:title            "Processing mode" ;
@@ -69,14 +74,14 @@
     vamp:unit           "" ;
     vamp:quantize_step   1  ;
     vamp:default_value   1 ;
-    vamp:value_names     ( "Draft (faster)" "Intensive (higher quality)");
+    vamp:value_names     ( "Live (faster and lower latency)" "Intensive (higher quality)");
     .
 plugbase:silvet_param_instrument a  vamp:QuantizedParameter ;
     vamp:identifier     "instrument" ;
     dc:title            "Instrument" ;
     dc:format           "" ;
     vamp:min_value       0 ;
-    vamp:max_value       12 ;
+    vamp:max_value       13 ;
     vamp:unit           "" ;
     vamp:quantize_step   1  ;
     vamp:default_value   0 ;
@@ -96,20 +101,70 @@
 plugbase:silvet_output_notes a  vamp:SparseOutput ;
     vamp:identifier       "notes" ;
     dc:title              "Note transcription" ;
-    dc:description        """Overall note transcription across selected instruments"""  ;
+    dc:description        """Overall note transcription. Each note has time, duration, estimated fundamental frequency, and a synthetic MIDI velocity (1-127) estimated from the strength of the pitch in the mixture."""  ;
     vamp:fixed_bin_count  "true" ;
     vamp:unit             "Hz" ;
     vamp:bin_count        2 ;
     vamp:bin_names        ( "Frequency" "Velocity");
     vamp:sample_type      vamp:VariableSampleRate ;
+    vamp:sample_rate      711 ;
     vamp:computes_event_type   af:Note ;
     .
+plugbase:silvet_output_onsets a  vamp:SparseOutput ;
+    vamp:identifier       "onsets" ;
+    dc:title              "Note onsets" ;
+    dc:description        """Note onsets, without durations. These can be calculated sooner than complete notes, because it isn't necessary to wait for a note to finish before returning its feature. Each event has time, estimated fundamental frequency in Hz, and a synthetic MIDI velocity (1-127) estimated from the strength of the pitch in the mixture."""  ;
+    vamp:fixed_bin_count  "true" ;
+    vamp:unit             "Hz" ;
+    vamp:bin_count        2 ;
+    vamp:bin_names        ( "Frequency" "Velocity");
+    vamp:sample_type      vamp:VariableSampleRate ;
+    vamp:sample_rate      711 ;
+    vamp:computes_event_type   af:Onset ;
+    .
+plugbase:silvet_output_onoffsets a  vamp:SparseOutput ;
+    vamp:identifier       "onoffsets" ;
+    dc:title              "Note onsets and offsets" ;
+    dc:description        """Note onsets and offsets as separate events. Each onset event has time, estimated fundamental frequency in Hz, and a synthetic MIDI velocity (1-127) estimated from the strength of the pitch in the mixture. Offsets are represented in the same way but with a velocity of 0."""  ;
+    vamp:fixed_bin_count  "true" ;
+    vamp:unit             "Hz" ;
+    vamp:bin_count        2 ;
+    vamp:bin_names        ( "Frequency" "Velocity");
+    vamp:sample_type      vamp:VariableSampleRate ;
+    vamp:sample_rate      711 ;
+    .
 plugbase:silvet_output_timefreq a  vamp:DenseOutput ;
     vamp:identifier       "timefreq" ;
     dc:title              "Time-frequency distribution" ;
-    dc:description        """Filtered constant-Q time-frequency distribution used as input to the expectation-maximisation algorithm"""  ;
+    dc:description        """Filtered constant-Q time-frequency distribution as used as input to the expectation-maximisation algorithm."""  ;
     vamp:fixed_bin_count  "true" ;
     vamp:unit             "" ;
+    vamp:bin_count        545 ;
     vamp:computes_signal_type  af:Spectrogram ;
     .
-
+plugbase:silvet_output_pitchactivation a  vamp:DenseOutput ;
+    vamp:identifier       "pitchactivation" ;
+    dc:title              "Pitch activation distribution" ;
+    dc:description        """Pitch activation distribution resulting from expectation-maximisation algorithm, prior to note extraction."""  ;
+    vamp:fixed_bin_count  "true" ;
+    vamp:unit             "" ;
+    vamp:bin_count        88 ;
+    vamp:computes_signal_type  af:Spectrogram ;
+    .
+plugbase:silvet_output_chroma a  vamp:DenseOutput ;
+    vamp:identifier       "chroma" ;
+    dc:title              "Pitch chroma distribution" ;
+    dc:description        """Pitch chroma distribution formed by wrapping the un-thresholded pitch activation distribution into a single octave of semitone bins."""  ;
+    vamp:fixed_bin_count  "true" ;
+    vamp:unit             "" ;
+    vamp:bin_count        12 ;
+    vamp:computes_signal_type  af:Chromagram ;
+    .
+plugbase:silvet_output_templates a  vamp:DenseOutput ;
+    vamp:identifier       "templates" ;
+    dc:title              "Templates" ;
+    dc:description        """Constant-Q spectral templates for the selected instrument pack."""  ;
+    vamp:fixed_bin_count  "true" ;
+    vamp:unit             "" ;
+    vamp:bin_count        545 ;
+    .
Binary file multiple_f0_estimation/silvet/silvet.so has changed
--- a/multiple_f0_estimation/silvet/silvet.ttl	Thu Sep 04 16:48:42 2014 +0100
+++ b/multiple_f0_estimation/silvet/silvet.ttl	Wed Aug 12 17:36:31 2015 +0100
@@ -4,6 +4,7 @@
 
 :transform a vamp:Transform ;
     vamp:plugin <http://vamp-plugins.org/rdf/plugins/silvet#silvet> ;
+    vamp:plugin_version 3 ;
     vamp:step_size "1024"^^xsd:int ; 
     vamp:block_size "1024"^^xsd:int ; 
     vamp:parameter_binding [