From 86b17d4b0bb27e6d9c585ccb07c186f037d5cf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Fri, 7 Feb 2020 00:33:59 +0100 Subject: Add the test scripts and midi files. They are old and not adapted yet. --- sampling_alg_lac2020/.gitignore | 6 ++++ sampling_alg_lac2020/midi_tests/112_1016.mid | Bin 0 -> 28447 bytes sampling_alg_lac2020/midi_tests/16_1016.mid | Bin 0 -> 28447 bytes sampling_alg_lac2020/midi_tests/48_1016.mid | Bin 0 -> 28447 bytes sampling_alg_lac2020/midi_tests/80_1016.mid | Bin 0 -> 28447 bytes sampling_alg_lac2020/midi_tests/plot_histogram.py | 32 ++++++++++++++++++++++ sampling_alg_lac2020/midi_tests/rise_0_127_8.mid | Bin 0 -> 28475 bytes sampling_alg_lac2020/midi_tests/run_tests.sh | 22 +++++++++++++++ sampling_alg_lac2020/midi_tests/test_and_plot.sh | 32 ++++++++++++++++++++++ 9 files changed, 92 insertions(+) create mode 100644 sampling_alg_lac2020/midi_tests/112_1016.mid create mode 100644 sampling_alg_lac2020/midi_tests/16_1016.mid create mode 100644 sampling_alg_lac2020/midi_tests/48_1016.mid create mode 100644 sampling_alg_lac2020/midi_tests/80_1016.mid create mode 100755 sampling_alg_lac2020/midi_tests/plot_histogram.py create mode 100644 sampling_alg_lac2020/midi_tests/rise_0_127_8.mid create mode 100755 sampling_alg_lac2020/midi_tests/run_tests.sh create mode 100755 sampling_alg_lac2020/midi_tests/test_and_plot.sh diff --git a/sampling_alg_lac2020/.gitignore b/sampling_alg_lac2020/.gitignore index 14c85a9..25761ab 100644 --- a/sampling_alg_lac2020/.gitignore +++ b/sampling_alg_lac2020/.gitignore @@ -4,3 +4,9 @@ LAC-20.blg LAC-20.log LAC-20.out LAC-20.pdf +midi_tests/*.pdf +midi_tests/*.txt +midi_tests/new_wav/ +midi_tests/old_wav/ +midi_tests/drumgizmo_new +midi_tests/drumgizmo_old diff --git a/sampling_alg_lac2020/midi_tests/112_1016.mid b/sampling_alg_lac2020/midi_tests/112_1016.mid new file mode 100644 index 0000000..f3723d8 Binary files /dev/null and b/sampling_alg_lac2020/midi_tests/112_1016.mid differ diff --git a/sampling_alg_lac2020/midi_tests/16_1016.mid b/sampling_alg_lac2020/midi_tests/16_1016.mid new file mode 100644 index 0000000..ed79df1 Binary files /dev/null and b/sampling_alg_lac2020/midi_tests/16_1016.mid differ diff --git a/sampling_alg_lac2020/midi_tests/48_1016.mid b/sampling_alg_lac2020/midi_tests/48_1016.mid new file mode 100644 index 0000000..6904777 Binary files /dev/null and b/sampling_alg_lac2020/midi_tests/48_1016.mid differ diff --git a/sampling_alg_lac2020/midi_tests/80_1016.mid b/sampling_alg_lac2020/midi_tests/80_1016.mid new file mode 100644 index 0000000..7abb99e Binary files /dev/null and b/sampling_alg_lac2020/midi_tests/80_1016.mid differ diff --git a/sampling_alg_lac2020/midi_tests/plot_histogram.py b/sampling_alg_lac2020/midi_tests/plot_histogram.py new file mode 100755 index 0000000..ca529b7 --- /dev/null +++ b/sampling_alg_lac2020/midi_tests/plot_histogram.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +import numpy as np +import matplotlib.mlab as mlab +import matplotlib.pyplot as plt +import sys + +if len(sys.argv) != 3: + print("Wrong number of arguments.") + print("USAGE: ./plot_histogram.py ") + quit() + +input_file = sys.argv[1] +output_file = sys.argv[2] + +f = open(input_file) +X = [int(i) for i in f.readlines()] + +# the histogram of the data +n, bins, patches = plt.hist(X, max(X)-min(X), facecolor='green') + +# add a 'best fit' line +# y = mlab.normpdf( bins, mu, sigma) +# l = plt.plot(bins, y, 'r--', linewidth=1) + +plt.xlabel('Sample Index') +plt.ylabel('Number of Selections') +# plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') +# plt.axis([40, 160, 0, 0.03]) +plt.xlim(0,97) +plt.grid(True) + +plt.savefig(output_file) diff --git a/sampling_alg_lac2020/midi_tests/rise_0_127_8.mid b/sampling_alg_lac2020/midi_tests/rise_0_127_8.mid new file mode 100644 index 0000000..dd732ab Binary files /dev/null and b/sampling_alg_lac2020/midi_tests/rise_0_127_8.mid differ diff --git a/sampling_alg_lac2020/midi_tests/run_tests.sh b/sampling_alg_lac2020/midi_tests/run_tests.sh new file mode 100755 index 0000000..fbe2a51 --- /dev/null +++ b/sampling_alg_lac2020/midi_tests/run_tests.sh @@ -0,0 +1,22 @@ +#!/bin/bash +if [ "$#" != "3" ]; then + echo "Wrong number of parameters!" + echo "USAGE: ./run_tests.sh " + exit +fi + +midifile="$1" +alg="$2" +output="$3" + +if [ "$alg" = "old" ]; then + echo "test with old selection..." + ./drumgizmo_old -i midifile -I file=/home/chaot/Data/midi_tests/$midifile -I midimap=~/Data/Drumkits/CrocellKit/Midimap_full.xml -o dummy ~/Data/Drumkits/CrocellKit/CrocellKit_full.xml | grep "index: " | awk '{print $8}' | sed 's/.$//' > "$output" + # ./drumgizmo_old -i midifile -I file=/home/chaot/Data/midi_tests/$midifile -I midimap=~/Data/Drumkits/CrocellKit/Midimap_full.xml -I speed=4 -o wavfile -O file="$3" ~/Data/Drumkits/CrocellKit/CrocellKit_full.xml + sort -n "$output" | uniq -c | awk '{print $2 " " $1}' +elif [ "$alg" = "new" ]; then + echo "test with new selection..." + ./drumgizmo_new -i midifile -I file=/home/chaot/Data/midi_tests/$midifile -I midimap=~/Data/Drumkits/CrocellKit/Midimap_full.xml -I speed=1 -o dummy -p stddev=0 ~/Data/Drumkits/CrocellKit/CrocellKit_full.xml | grep "index: " | awk '{print $8}' | sed 's/.$//' > "$output" + # ./drumgizmo_new -i midifile -I file=/home/chaot/Data/midi_tests/$midifile -I midimap=~/Data/Drumkits/CrocellKit/Midimap_full.xml -I speed=8 -o wavfile -O file="$3" -p close=10,diverse=0.05,random=0.01,stddev=0 ~/Data/Drumkits/CrocellKit/CrocellKit_full.xml + sort -n "$output" | uniq -c | awk '{print $2 " " $1}' +fi diff --git a/sampling_alg_lac2020/midi_tests/test_and_plot.sh b/sampling_alg_lac2020/midi_tests/test_and_plot.sh new file mode 100755 index 0000000..18101fa --- /dev/null +++ b/sampling_alg_lac2020/midi_tests/test_and_plot.sh @@ -0,0 +1,32 @@ +# new +./run_tests.sh rise_0_127_8.mid new sweep_new_output.txt +./plot_histogram.py sweep_new_output.txt sweep_new.pdf +# +# ./run_tests.sh 16_1016.mid new 16_new_output.txt +# ./plot_histogram.py 16_new_output.txt 16_new.pdf +# +# ./run_tests.sh 48_1016.mid new 48_new_output.txt +# ./plot_histogram.py 48_new_output.txt 48_new.pdf +# +# ./run_tests.sh 80_1016.mid new 80_new_output.txt +# ./plot_histogram.py 80_new_output.txt 80_new.pdf +# +# ./run_tests.sh 112_1016.mid new 112_new_output.txt +# ./plot_histogram.py 112_new_output.txt 112_new.pdf + + +# old +# ./run_tests.sh rise_0_127_8.mid old sweep_old_output.txt +# ./plot_histogram.py sweep_old_output.txt sweep_old.pdf +# +# ./run_tests.sh 16_1016.mid old 16_old_output.txt +# ./plot_histogram.py 16_old_output.txt 16_old.pdf +# +# ./run_tests.sh 48_1016.mid old 48_old_output.txt +# ./plot_histogram.py 48_old_output.txt 48_old.pdf +# +# ./run_tests.sh 80_1016.mid old 80_old_output.txt +# ./plot_histogram.py 80_old_output.txt 80_old.pdf +# +# ./run_tests.sh 112_1016.mid old 112_old_output.txt +# ./plot_histogram.py 112_old_output.txt 112_old.pdf -- cgit v1.2.3