# HG changeset patch # User Chris Cannam # Date 1409835540 -3600 # Node ID e4d2a92fbcf438f64e78fb2254b6c89a49788315 # Parent 674fb672aa76ecce62e7dc9b26d75981531925f6 Cepstral pitch tracker didn't do very well, we know enough about it now! diff -r 674fb672aa76 -r e4d2a92fbcf4 audio_melody_extraction/cepstral-pitchtracker/README.txt --- a/audio_melody_extraction/cepstral-pitchtracker/README.txt Wed Sep 03 14:18:23 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# MIREX 2013 submission -# -# Audio Melody Extraction -# Chris Cannam, chris.cannam@eecs.qmul.ac.uk - -# Architecture - -- Linux 64-bit - -# Dependencies - -- Sonic Annotator v1.0 - http://code.soundsoftware.ac.uk/projects/sonic-annotator/files - -- Typical Unix/GNU shell commands - -# How to run - -In a terminal window run: - -./ame_cep.sh input.wav output.txt - diff -r 674fb672aa76 -r e4d2a92fbcf4 audio_melody_extraction/cepstral-pitchtracker/ame_cep.sh --- a/audio_melody_extraction/cepstral-pitchtracker/ame_cep.sh Wed Sep 03 14:18:23 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -#!/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%.*} -suffix="vamp_cepstral-pitchtracker_cepstral-pitchtracker" - -echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2 - -# Run the cepstral pitch tracker plugin. We obtain two outputs, the -# voiced f0 and the raw peak frequencies (without regard to voicing -# segmentation). From this we need to produce a single output which -# has a f0 estimate for each 10ms step, with the unvoiced estimates -# having negative values. -# -# So we use the "fill" option of the pitch tracker to get continuous -# f0 estimates within each voiced note, and then we need to draw the -# f0 estimates from the raw file (made negative) except where there is -# also an estimate in the f0 file (in which case we use that). - -# 1. Run the tracker. This will produce output files -# out/${infile}_${suffix}_f0.csv and out/${infile}_${suffix}_raw.csv - -VAMP_PATH="$mydir" sonic-annotator \ - -t "$mydir"/ame_cep.ttl \ - -w csv --csv-separator ';' \ - --csv-basedir "$mydir/out" \ - --csv-force \ - "$infile" || exit 1 - -# 2. Check the output files exist - -f0file="out/${inbase}_${suffix}_f0.csv" -if [ ! -f "$f0file" ]; then - echo "f0 output file $f0file not found! bailing out"; exit 1 -fi - -rawfile="out/${inbase}_${suffix}_raw.csv" -if [ ! -f "$rawfile" ]; then - echo "raw output file $rawfile not found! bailing out"; exit 1 -fi - -# 3. Postprocess to get the f0 estimates where they exist and the -# negative raw peaks elsewhere. This breaks down as - -# - list all timestamps in both files, in time order; -# - extract those that appear only once: these are the unvoiced times; -# - obtain lines with those timestamps from the raw file and make their -# values negative (the sed command); -# - merge with the voiced times from the f0 file; -# - sort and replace comma separator with tab. - -cat "$f0file" "$rawfile" | awk -F';' '{ print $1; }' | sort -n | \ - uniq -u | \ - cat - "$rawfile" | sort -n | \ - sed -n -e '/^[^;]*$/b a' -e d -e :a -e n -e 's/;/;-/' -e p | \ - cat - "$f0file" | \ - sed 's/;/\t/' | \ - sort -n > "$outfile" || exit 1 - -grep -v - "$outfile" | wc -l | awk '{ print $1 " voiced"; }' -grep - "$outfile" | wc -l | awk '{ print $1 " unvoiced"; }' - -echo "Done, output is in $outfile" diff -r 674fb672aa76 -r e4d2a92fbcf4 audio_melody_extraction/cepstral-pitchtracker/ame_cep.ttl --- a/audio_melody_extraction/cepstral-pitchtracker/ame_cep.ttl Wed Sep 03 14:18:23 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -@prefix xsd: . -@prefix vamp: . -@prefix cep: . -@prefix : <#> . - -:transform_f0 a vamp:Transform ; - vamp:plugin cep:cepstral-pitchtracker ; - vamp:step_size "441"^^xsd:int ; - vamp:block_size "1024"^^xsd:int ; - vamp:parameter_binding [ - vamp:parameter [ vamp:identifier "sensitivity" ] ; - vamp:value "15"^^xsd:float ; - ] ; - vamp:parameter_binding [ - vamp:parameter [ vamp:identifier "slack" ] ; - vamp:value "40"^^xsd:float ; - ] ; - vamp:parameter_binding [ - vamp:parameter [ vamp:identifier "threshold" ] ; - vamp:value "0.1"^^xsd:float ; - ] ; - vamp:parameter_binding [ - vamp:parameter [ vamp:identifier "fill" ] ; - vamp:value "1"^^xsd:float ; - ] ; - vamp:output cep:cepstral-pitchtracker_output_f0 . - -:transform_raw a vamp:Transform ; - vamp:plugin cep:cepstral-pitchtracker ; - vamp:step_size "441"^^xsd:int ; - vamp:block_size "1024"^^xsd:int ; - vamp:output cep:cepstral-pitchtracker_output_raw . - diff -r 674fb672aa76 -r e4d2a92fbcf4 audio_melody_extraction/cepstral-pitchtracker/cepstral-pitchtracker.n3 --- a/audio_melody_extraction/cepstral-pitchtracker/cepstral-pitchtracker.n3 Wed Sep 03 14:18:23 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -@prefix rdfs: . -@prefix xsd: . -@prefix vamp: . -@prefix plugbase: . -@prefix owl: . -@prefix dc: . -@prefix af: . -@prefix foaf: . -@prefix cc: . -@prefix : <#> . - -<> a vamp:PluginDescription ; - foaf:maker ; - foaf:primaryTopic . - -:cepstral-pitchtracker a vamp:PluginLibrary ; - vamp:identifier "cepstral-pitchtracker" ; - vamp:available_plugin plugbase:cepstral-pitchtracker ; - foaf:page ; - . - -plugbase:cepstral-pitchtracker a vamp:Plugin ; - dc:title "Cepstral Pitch Tracker" ; - vamp:name "Cepstral Pitch Tracker" ; - dc:description """Estimate f0 of monophonic material using a cepstrum method.""" ; - foaf:maker [ foaf:name "Chris Cannam" ] ; # FIXME could give plugin author's URI here - dc:rights """Freely redistributable (BSD license)""" ; -# cc:license ; - vamp:identifier "cepstral-pitchtracker" ; - vamp:vamp_API_version vamp:api_version_2 ; - owl:versionInfo "1" ; - vamp:input_domain vamp:FrequencyDomain ; - - vamp:output plugbase:cepstral-pitchtracker_output_f0 ; - vamp:output plugbase:cepstral-pitchtracker_output_notes ; - vamp:output plugbase:cepstral-pitchtracker_output_raw ; - . -plugbase:cepstral-pitchtracker_output_f0 a vamp:DenseOutput ; - vamp:identifier "f0" ; - dc:title "Estimated f0" ; - dc:description """Estimated fundamental frequency""" ; - vamp:fixed_bin_count "true" ; - vamp:unit "Hz" ; - a vamp:KnownExtentsOutput ; - vamp:min_value 50 ; - vamp:max_value 900 ; - vamp:bin_count 1 ; -# vamp:computes_event_type ; -# vamp:computes_feature ; -# vamp:computes_signal_type ; - . -plugbase:cepstral-pitchtracker_output_notes a vamp:DenseOutput ; - vamp:identifier "notes" ; - dc:title "Notes" ; - dc:description """Derived fixed-pitch note frequencies""" ; - vamp:fixed_bin_count "true" ; - vamp:unit "Hz" ; - a vamp:KnownExtentsOutput ; - vamp:min_value 50 ; - vamp:max_value 900 ; - vamp:bin_count 1 ; -# vamp:computes_event_type ; -# vamp:computes_feature ; -# vamp:computes_signal_type ; - . -plugbase:cepstral-pitchtracker_output_raw a vamp:DenseOutput ; - vamp:identifier "raw" ; - dc:title "Raw frequencies" ; - dc:description """Raw peak frequencies from cepstrum, including unvoiced segments""" ; - vamp:fixed_bin_count "true" ; - vamp:unit "Hz" ; - a vamp:KnownExtentsOutput ; - vamp:min_value 50 ; - vamp:max_value 900 ; - vamp:bin_count 1 ; -# vamp:computes_event_type ; -# vamp:computes_feature ; -# vamp:computes_signal_type ; - . diff -r 674fb672aa76 -r e4d2a92fbcf4 audio_melody_extraction/cepstral-pitchtracker/cepstral-pitchtracker.so Binary file audio_melody_extraction/cepstral-pitchtracker/cepstral-pitchtracker.so has changed