# HG changeset patch # User Chris Cannam # Date 1335264725 -3600 # Node ID 4182672fd6f89bb88633dc99056107885649ad55 Initial commit of files from the mauch-MIREX directory on octave diff -r 000000000000 -r 4182672fd6f8 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,15 @@ +syntax: glob +_beattracker +_chordtools +_chroma +_chromadata +_dbn +_FullBNT +_logfiles +_misc +_parameters +_segmentation +_song +_writetools +output +output_* diff -r 000000000000 -r 4182672fd6f8 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,48 @@ +Matthias Mauch MIREX Submissions 2010 +===================================== + +This README file contains instructions to run three different methods: + +1) chord estimation with a DBN (doChordID.sh) +2) simple chord estimation (doChordID-simple.sh) +3) structural segmentation (doSegmentation.sh) + +Each method is called through the respective bash script. + +All methods use Sonic Annotator. A Sonic Annotator binary for 64bit Linux is in this directory. Please contact me (mail@matthiasmauch.net) or Chris Cannam (chris.cannam@eecs.qmul.ac.uk) if you need a different version. + +All methods use just one core, as far as I'm aware. Whatever MATLAB does implicitly I don't know. + +Please find more detailed information on the individual methods below. + +1. Chord Estimation with a DBN +------------------------------ + +Example call to the bash shell script "doChordID.sh": + + ./doChordID.sh wavfilelist.txt outputdirectory + +This method requires MATLAB. +This method uses a lot of memory (expected up to 17GB for long songs). +Expected running time is roughly real-time for most songs +/- 40%. + +2. Simple Chord Estimation +--------------------------- + +Example call to the bash shell script "doChordID-simple.sh": + + ./doChordID-simple.sh wavfilelist.txt outputdirectory + +No special memory requirements. +This method is quite quick, takes roughly a third of the real duration. + +3. Structural Segmentation +-------------------------- + +Example call to the bash shell script "doSegmentation.sh": + + ./doSegmentation.sh wavfilelist.txt outputdirectory + +This method requires MATLAB. +No special memory requirements. +This method is quicker than real-time, takes roughly 70% of the real duration. \ No newline at end of file diff -r 000000000000 -r 4182672fd6f8 chord.dict --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chord.dict Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,21 @@ +### Comma-Separated Chord Dictionaries +# +# field 1 is chord type name, +# fields 2-25 indicate whether a pitch class is present (1) or not (0) = +# - fields 2-13 correspond to bass pitch classes A through Ab +# - fields 14-25 correspond to chord pitch classes A through Ab + +### Advanced Learners Chord Dictionary +=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0 +=0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0 +:min=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0 +:min=0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0 +:dim7=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0 +:maj6=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0 +:7=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0 +:maj7=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1 +:min7=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0 +=0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0 +=0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0 +:dim=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0 +:aug=1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 \ No newline at end of file diff -r 000000000000 -r 4182672fd6f8 common_startstring.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common_startstring.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,10 @@ +#!/bin/bash +filelist="$1" +common_st="`head -n 1 "$filelist"`"first + +while read f; do + diff_pos=`./diff_position.sh "$common_st" "$f"` + last_same=$(( $diff_pos-1 )) + common_st="`echo "$common_st" | cut -c 1-$last_same`" +done < "$filelist" +echo "$common_st" diff -r 000000000000 -r 4182672fd6f8 diff_position.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/diff_position.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,4 @@ +#!/bin/bash + +cmp -l <(echo "$1" ) <(echo "$2") 2> /dev/null | head -n1 | awk '{ print $1 }' + diff -r 000000000000 -r 4182672fd6f8 doChordID-osx.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doChordID-osx.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,51 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2- > "$chromafile" + matlab -nodisplay -nojvm -r run_mirex\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> $logfile + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 doChordID-simple-osx.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doChordID-simple-osx.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,60 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + helper=n + VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" | cut -d ',' -f 2- | + while read line; do + # echo "$line" + if [ $helper = y ]; then + echo "$oldstart" `echo "$line" | cut -d ',' -f 1` "$oldchord" + fi + oldstart=`echo "$line" | cut -d ',' -f 1` + oldchord=`echo "$line" | cut -d ',' -f 2 | sed 's/"//g'` + helper=y + done > "$outfile" + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 doChordID-simple.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doChordID-simple.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,60 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + helper=n + VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" | cut -d ',' -f 2- | + while read line; do + # echo "$line" + if [ $helper = y ]; then + echo "$oldstart" `echo "$line" | cut -d ',' -f 1` "$oldchord" + fi + oldstart=`echo "$line" | cut -d ',' -f 1` + oldchord=`echo "$line" | cut -d ',' -f 2 | sed 's/"//g'` + helper=y + done > "$outfile" + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 doChordID.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doChordID.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,54 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2- > "$chromafile" + infile="`echo "$infile" | sed "s/'/''/g"`" + outfile="`echo "$outfile" | sed "s/'/''/g"`" + chromafile="`echo "$chromafile" | sed "s/'/''/g"`" + matlab -nodisplay -nojvm -r run_mirex\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> "$logfile" + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 doSegmentation-osx.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doSegmentation-osx.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,54 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2- > "$chromafile" + infile="`echo "$infile" | sed "s/'/''/g"`" + outfile="`echo "$outfile" | sed "s/'/''/g"`" + chromafile="`echo "$chromafile" | sed "s/'/''/g"`" + matlab -nodisplay -nojvm -r run_segmentation\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> "$logfile" + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 doSegmentation.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doSegmentation.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,54 @@ +#!/bin/bash + +if [ $# -lt 2 ] ; then +echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR" +exit 1 +fi + +retainstructure=0 + +while [ $# -gt 2 ] ; do +case $1 in +-d) retainstructure=1 ; shift 1 ; echo here;; +*) shift 1 ;; +esac +done + +listfile="$1" +echo listfile "$listfile" +outputdir="$2" + + +while read infile; do + if [ "$infile" -a -f "$infile" ]; then + before="$(date +%s)" + echo "_____________________________________________________" + echo " " + echo Processing file "$infile" + echo " " + if [ $retainstructure -eq 0 ]; then + pathandfile=`basename "$infile"` + else + pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`" + echo pathandfile "$pathandfile" + fi + outfile="$outputdir"/"$pathandfile".txt + + logfile=_logfiles/"$pathandfile".log + chromafile=_chromadata/"$pathandfile".csv + + mkdir -p "`dirname "$outfile"`" + + echo "[sonic annotator] ..." + VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2- > "$chromafile" + infile="`echo "$infile" | sed "s/'/''/g"`" + outfile="`echo "$outfile" | sed "s/'/''/g"`" + chromafile="`echo "$chromafile" | sed "s/'/''/g"`" + matlab -nodisplay -nojvm -r run_segmentation\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> "$logfile" + after="$(date +%s)" + elapsed_seconds="$(expr $after - $before)" + echo " -->" time elapsed: $elapsed_seconds seconds + echo " " + else if [ ! "$infile" ]; then echo ...; fi + fi +done < "$listfile" diff -r 000000000000 -r 4182672fd6f8 featurescript.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/featurescript.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,109 @@ +#!/bin/bash + +base=/import/c4dm-music-a/C4DM\ Music\ Collection + +mine=`date '+%Y-%m-%d_%H.%M.%S'`_$$ +logfile="logs/$mine.log" +statusfile="logs/$mine.status" +matlogfile="logs/$mine.matlog" +mkdir -p logs + +echo "base: $base" +echo "log file to $logfile" +echo "overall status reports to $statusfile" + +report_failure() { + echo "FAIL $@" >> "$statusfile" +} +report_success() { + echo "WIN $@" >> "$statusfile" +} +report_existing() { + echo "HAZ $@" >> "$statusfile" +} +report_busy() { + echo "BUSY $@" >> "$statusfile" +} + +find "$base" -type d | while read source; do + + ls "$source" | fgrep -q .wav || continue + + echo "source: $source" + dirname=${source#$base} + dirname=${dirname#/} + echo "dirname: $dirname" + [ -n "$dirname" ] || continue + + for wavfilename in "$source/"*.wav; do # loop over songs + + echo "$wavfilename" + + songbasename=`basename "${wavfilename%.wav}"` + echo .................. new song "$dirname/$songbasename" ............. + songdir="output/$dirname/$songbasename" # this is where all song-related features will go into + mkdir -p "$songdir" + + ( if ! flock -en 200; then + echo "songdir $songdir is locked already, skipping it" + report_busy "$wavfilename" + exit + fi + + echo "have lock on songdir $songdir" + + if [ -s "$songdir/$songbasename""_vamp_matthiasm_nnls_chroma_bothchroma.csv" ]; then + echo "non-empty output file(s) exist -- not re-generating" + report_existing "$wavfilename" + exit + fi + + echo oooooooooooooooooooooooooooooooooooooooooooooooo + echo low level feature extraction + echo oooooooooooooooooooooooooooooooooooooooooooooooo + VAMP_PATH=. ./sonic-annotator-unix \ + -d vamp:matthiasm:nnls_chroma:simplechord \ + -d vamp:matthiasm:nnls_chroma:bothchroma \ + -d vamp:matthiasm:nnls_chroma:localtuning \ + -d vamp:matthiasm:nnls_chroma:logfreqspec \ + -d vamp:matthiasm:nnls_chroma:semitonespectrum \ + -d vamp:matthiasm:nnls_chroma:tunedlogfreqspec \ + -d vamp:matthiasm:nnls_chroma:tuning \ + -w csv \ + --csv-basedir "$songdir/" \ + "$wavfilename" + matlab_infile=`echo "$wavfilename" | sed "s/'/''/g"` + matlab_chromafile=`echo "$songdir/$songbasename" | sed "s/'/''/g"`_vamp_matthiasm_nnls_chroma_bothchroma.csv + matlab_outbase=`echo "$songdir/$songbasename" | sed "s/'/''/g"` + matlab_segout="$matlab_outbase".seg + matlab_chordout="$matlab_outbase".chord + # matlab_keyout="$matlab_outbase".key # is still done in matlab + echo oooooooooooooooooooooooooooooooooooooooooooooooo + echo segmentation + echo oooooooooooooooooooooooooooooooooooooooooooooooo + echo "run_segmentation('$matlab_infile','$matlab_segout','$matlab_chromafile')" | matlab -nodisplay -nojvm 2>&1 >/dev/null | tee "$matlogfile" + if grep -qi "error" "$matlogfile" ; then + report_failure "$wavfilename" + exit + else + rm "$matlogfile" + fi + echo oooooooooooooooooooooooooooooooooooooooooooooooo + echo DBN chord estimation + echo oooooooooooooooooooooooooooooooooooooooooooooooo + echo "run_chordandkey('$matlab_infile','$matlab_chordout','$matlab_chromafile')" | matlab -nodisplay -nojvm 2>&1 >/dev/null | tee "$matlogfile" + cat "$matlogfile" + if grep -qi "error" "$matlogfile" ; then + report_failure "$wavfilename" + exit + else + rm "$matlogfile" + fi + report_success "$wavfilename" + + )200>"$songdir/.lock" + done + +done > "$logfile" 2>&1 + + diff -r 000000000000 -r 4182672fd6f8 mygenpath.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mygenpath.m Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,61 @@ +function p = mygenpath(d,varargin) +%GENPATH Generate recursive toolbox path. +% P = GENPATH returns a new path string by adding +% all the subdirectories of MATLABROOT/toolbox, including empty +% subdirectories. +% +% P = GENPATH(D) returns a path string starting in D, plus, recursively, all +% the subdirectories of D, including empty subdirectories. +% +% NOTE: GENPATH will not exactly recreate the original MATLAB path. +% +% See also PATH, ADDPATH, RMPATH, SAVEPATH. + +% Copyright 1984-2006 The MathWorks, Inc. +% $Revision: 1.13.4.4 $ $Date: 2006/10/14 12:24:02 $ +%------------------------------------------------------------------------------ + +if nargin==0, + p = genpath(fullfile(matlabroot,'toolbox')); + if length(p) > 1, p(end) = []; end % Remove trailing pathsep + return +end +if nargin==1 + pat = 'imporobablepatternthisis'; +else + pat = varargin{1}; +end +% initialise variables +methodsep = '@'; % qualifier for overloaded method directories +p = ''; % path to be returned + +% Generate path based on given root directory +files = dir(d); +if isempty(files) + return +end + +% Add d to the path even if it is empty. +p = [p d pathsep]; + +% set logical vector for subdirectory entries in d +isdir = logical(cat(1,files.isdir)); +% +% Recursively descend through directories which are neither +% private nor "class" directories. +% +dirs = files(isdir); % select only directory entries from the current listing + +for i=1:length(dirs) + dirname = dirs(i).name; + if ~strcmp( dirname,'.') && ... + ~strcmp( dirname,'..') && ... + ~strncmp( dirname,methodsep,1) && ... + ~strcmp( dirname,'private') && ... + isempty(regexp(dirname,'svn','ONCE')) && ... + isempty(regexp(dirname, pat,'ONCE')) + p = [p genpath(fullfile(d,dirname))]; % recursive calling of this function. + end +end + +%------------------------------------------------------------------------------ diff -r 000000000000 -r 4182672fd6f8 process-all.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/process-all.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,41 @@ +#!/bin/bash + +base=/import/c4dm-music-a/C4DM\ Music\ Collection + +echo "base: $base" + +find "$base" -type d | while read source; do + + ls "$source" | fgrep -q .wav || continue + + echo "source: $source" + dirname=${source#$base} + dirname=${dirname#/} + echo "dirname: $dirname" + [ -n "$dirname" ] || continue + + for type in ChordID ChordID-simple Segmentation; do + + target="output/$dirname/$type" + mkdir -p "$target" + + ( + flock -en 200 || exit + + echo "Have lock on $target" + + for f in "$source"/*.wav ; do + [ -f "$f" ] || continue + filebase=`basename "$f"` + if [ ! -s "$target/$filebase.txt" ]; then + echo "$f" + fi + done > "$target/source.txt" + + bash ./do$type.sh "$target/source.txt" "$target" + + )200>"$target/.lock" + + done + +done diff -r 000000000000 -r 4182672fd6f8 run_chordandkey.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_chordandkey.m Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,44 @@ +function run_chordandkey(filename,outfilename,chromafilename) +%% +warning off +path(path,genpath('.')); +warning on + +fprintf(2,'[MATLAB] initialising parameters...'); +param = param_mirex(chromafilename); +song = song_skeleton(filename); +fprintf(2,'done.\n'); + +fprintf(2,'[MATLAB] building DBN...'); +bnet = dbn_ISMIR2010(param); +fprintf(2,'done.\n'); + +fprintf(2,'[MATLAB] reading chroma...'); +song = song_chroma(song, param); +fprintf(2,'done.\n'); + +fprintf(2,'[MATLAB] beat tracking (M Davies)...'); +song = song_beat(song, param); +fprintf(2,'done.\n'); + +fprintf(2,'[MATLAB] beat-synchronising chroma...'); +song = song_syncchroma(song,param); +fprintf(2,'done.\n'); + +fprintf(2,'[MATLAB] segmentation...'); +song = song_segment(song, param); +song = song_segchroma(song,param); +fprintf(2,'.\n'); + +fprintf(2,'[MATLAB] DBN inference...'); +song = inference(song, bnet, param); +fprintf(2,'.\n'); +%% +fprintf(2,'[MATLAB] writing output files...'); +% fprintf(1,'writing to %s\n', outfilename) +write_song(song, bnet, param, outfilename, 'chordlab', 1); +write_song(song, bnet, param, [outfilename(1:end-5) 'key'], 'keylab', 1); +% parts2csv(song, [outfilename(1:end-3) 'csv']); +% parts2csv(song, [outfilename(1:end-3) 'intcsv'],'integrated'); +fprintf(2,'done.\n'); +exit \ No newline at end of file diff -r 000000000000 -r 4182672fd6f8 run_mirex.p Binary file run_mirex.p has changed diff -r 000000000000 -r 4182672fd6f8 run_segmentation.p Binary file run_segmentation.p has changed diff -r 000000000000 -r 4182672fd6f8 segmentation.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/segmentation.sh Tue Apr 24 11:52:05 2012 +0100 @@ -0,0 +1,19 @@ +#!/bin/bash +infile="$1" +outfile="$2" +before="$(date +%s)" + +chromafile=tempchroma.csv + +mkdir -p "`dirname "$outfile"`" + +echo "[sonic annotator] ..." +VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> /dev/null | cut -d ',' -f 2- > "$chromafile" +infile="`echo "$infile" | sed "s/'/''/g"`" +outfile="`echo "$outfile" | sed "s/'/''/g"`" +chromafile="`echo "$chromafile" | sed "s/'/''/g"`" +matlab -nodisplay -nojvm -r run_segmentation\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) > /dev/null +after="$(date +%s)" +elapsed_seconds="$(expr $after - $before)" +echo " -->" time elapsed: $elapsed_seconds seconds +echo " "