summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2020-02-01 14:06:07 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2020-02-01 14:06:07 +0100
commite59d3aea1a64cf37a8dc63447b3f11be0cddd877 (patch)
tree7085ccf527e58e474e81bbd90aeaf08ba8259f9b
parent9571b9d4e541343914fac36b8eb28ed00b8a696b (diff)
Add a new file just with the structure.
The old file was copied to LAC-20-old.tex. Now copy content over from there to the new file.
-rw-r--r--sampling_alg_lac2020/LAC-20-old.tex362
-rw-r--r--sampling_alg_lac2020/LAC-20.tex160
2 files changed, 422 insertions, 100 deletions
diff --git a/sampling_alg_lac2020/LAC-20-old.tex b/sampling_alg_lac2020/LAC-20-old.tex
new file mode 100644
index 0000000..0a6a94c
--- /dev/null
+++ b/sampling_alg_lac2020/LAC-20-old.tex
@@ -0,0 +1,362 @@
+% Template LaTeX file for LAC-20 papers
+%
+% To generate the correct references using BibTeX, run
+% latex, bibtex, latex, latex
+% modified...
+% - from DAFx-00 to DAFx-02 by Florian Keiler, 2002-07-08
+% - from DAFx-02 to DAFx-03 by Gianpaolo Evangelista
+% - from DAFx-05 to DAFx-06 by Vincent Verfaille, 2006-02-05
+% - from DAFx-06 to DAFx-07 by Vincent Verfaille, 2007-01-05
+% and Sylvain Marchand, 2007-01-31
+% - from DAFx-07 to DAFx-08 by Henri Penttinen, 2007-12-12
+% and Jyri Pakarinen 2008-01-28
+% - from DAFx-08 to DAFx-09 by Giorgio Prandi, Fabio Antonacci 2008-10-03
+% - from DAFx-09 to DAFx-10 by Hannes Pomberger 2010-02-01
+% - from DAFx-10 to DAFx-12 by Jez Wells 2011
+% - from DAFx-12 to DAFx-14 by Sascha Disch 2013
+% - from DAFx-15 to DAFx-16 by Pavel Rajmic 2015
+% - from DAFx-16 to IFC-18 by Romain Michon 2018
+% - from IFC-18 to LAC-19 by Romain Michon 2019
+% - from LAC-19 to LAC-20 by Jean-Michaël Celerier 2020
+%
+% Template with hyper-references (links) active after conversion to pdf
+% (with the distiller) or if compiled with pdflatex.
+%
+% 20060205: added package 'hypcap' to correct hyperlinks to figures and tables
+% use of \papertitle and \paperauthorA, etc for same title in PDF and Metadata
+%
+% 1) Please compile using lualatex, latex or pdflatex.
+% 2) If using pdflatex, you need your figures in a file format other than eps! e.g. png or jpg is working
+% 3) Please use "papertitle" and "pdfauthor" definitions below
+
+%------------------------------------------------------------------------------------------
+% ! ! ! ! ! ! ! ! ! ! ! ! user defined variables ! ! ! ! ! ! ! ! ! ! ! ! ! !
+% Please use these commands to define title and author(s) of the paper:
+\def\papertitle{On Sampling Algorithms for Drums}
+\def\paperauthorA{André Nusser}
+\def\paperauthorB{Bent Bisballe Nyeng}
+\def\paperauthorC{}
+\def\paperauthorD{}
+
+% Authors' affiliations have to be set below
+
+%------------------------------------------------------------------------------------------
+\documentclass[twoside,a4paper]{article}
+\usepackage{LAC-20}
+\usepackage{amsmath,amssymb,amsfonts,amsthm}
+\usepackage{euscript}
+\usepackage{ifpdf}
+\usepackage{ifluatex}
+\usepackage{ifxetex}
+
+\usepackage{color}
+\usepackage{listings}
+\definecolor{mygrey}{rgb}{0.96,0.96,0.96}
+\lstset{
+ tabsize=4,
+ basicstyle=\ttfamily,
+ backgroundcolor=\color{mygrey},
+ captionpos=b,
+ breaklines=true
+}
+
+\usepackage[english]{babel}
+\usepackage{caption}
+\usepackage{subfig, color}
+\setcounter{page}{1}
+\ninept
+
+\usepackage{times}
+% pdf-tex settings: detect automatically if run by latex or pdflatex
+\ifluatex
+ \usepackage[
+ pdftitle={\papertitle},
+ pdfauthor={\paperauthorA, \paperauthorB, \paperauthorC, \paperauthorD},
+ colorlinks=false, % links are activated as colror boxes instead of color text
+ bookmarksnumbered, % use section numbers with bookmarks
+ pdfstartview=XYZ % start with zoom=100% instead of full screen; especially useful if working with a big screen :-)
+ ]{hyperref}
+
+ \edef\pdfcompresslevel{\pdfvariable compresslevel}
+ \pdfcompresslevel=9
+ \usepackage{graphicx}
+
+ \usepackage[figure,table]{hypcap}
+ \usepackage{fontspec}
+\else
+ \ifxetex
+ \usepackage[
+ pdftitle={\papertitle},
+ pdfauthor={\paperauthorA, \paperauthorB, \paperauthorC, \paperauthorD},
+ colorlinks=false, % links are activated as colror boxes instead of color text
+ bookmarksnumbered, % use section numbers with bookmarks
+ pdfstartview=XYZ % start with zoom=100% instead of full screen; especially useful if working with a big screen :-)
+ ]{hyperref}
+
+ \pdfcompresslevel=9
+ \usepackage{graphicx}
+
+ \usepackage[figure,table]{hypcap}
+ \usepackage{fontspec}
+ \else
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \ifpdf % compiling with pdflatex
+ \usepackage[pdftex,
+ pdftitle={\papertitle},
+ pdfauthor={\paperauthorA, \paperauthorB, \paperauthorC, \paperauthorD},
+ colorlinks=false, % links are activated as colror boxes instead of color text
+ bookmarksnumbered, % use section numbers with bookmarks
+ pdfstartview=XYZ % start with zoom=100% instead of full screen; especially useful if working with a big screen :-)
+ ]{hyperref}
+ \pdfcompresslevel=9
+ \usepackage[pdftex]{graphicx}
+ \usepackage[figure,table]{hypcap}
+ \DeclareGraphicsExtensions{.png,.jpg,.pdf}
+ \else % compiling with latex
+ \usepackage[dvips]{epsfig,graphicx}
+ \usepackage[dvips,
+ colorlinks=false, % no color links
+ bookmarksnumbered, % use section numbers with bookmarks
+ pdfstartview=XYZ % start with zoom=100% instead of full screen
+ ]{hyperref}
+ % hyperrefs are active in the pdf file after conversion
+ \usepackage[figure,table]{hypcap}
+ \DeclareGraphicsExtensions{.eps}
+ \fi
+ \fi
+\fi
+
+% ====================================
+% OWN PACKAGES
+
+% For utf8 encoding
+\usepackage[utf8]{inputenc}
+
+% Use for automatic line breaks in tabular (column type X)
+\usepackage{tabularx}
+% For abbreviations using \newcommand
+\usepackage{xspace}
+% For the >{...} in tabular
+\usepackage{array}
+% For t o d o notes. Make the background white to make them not that distracting.
+% \usepackage[textwidth=3.5cm,color=white]{todonotes}
+% For better cite commands
+\usepackage[numbers]{natbib}
+% math stuff
+\usepackage{amsmath,amsthm,amssymb}
+\usepackage{mathtools}
+\usepackage{nicefrac}
+\usepackage{csquotes}
+% Comment in the next line to draw frames around all the layout boxes for checking where they are violated.
+%\usepackage{showframe}
+
+% nice theorem and proof environments. taken from Ema's template
+\theoremstyle{plain}
+\newtheorem{theorem}{Theorem}
+\newtheorem{proposition}{Proposition}
+\newtheorem{lemma}{Lemma}
+\newtheorem{corollary}{Corollary}
+\newtheorem{claim}{Claim}
+\newtheorem{fact}{Fact}
+
+\theoremstyle{definition}
+\newtheorem{definition}{Definition}
+\newtheorem{example}{Example}
+
+\theoremstyle{remark}
+\newtheorem{remark}{Remark}
+\newtheorem{observation}{Observation}
+\newtheorem{conjecture}{Conjecture}
+
+% Handy abbreviations
+\newcommand{\whp}[0]{w.h.p.\xspace}
+\newcommand{\ie}[0]{i.e.\xspace}
+\newcommand{\wrt}[0]{w.r.t.\xspace}
+
+% \abs and \norm hacks
+\DeclarePairedDelimiter\abs{\lvert}{\rvert}
+\makeatletter
+\let\oldabs\abs
+\def\abs{\@ifstar{\oldabs}{\oldabs*}}
+\let\oldnorm\norm
+\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
+\makeatother
+
+% TODO notes
+\newcommand{\todo}[1]{\textcolor{red}{\textbf{TODO:} #1}}
+
+% ugly hack
+\renewcommand{\paragraph}[1]{\textbf{#1}. }
+
+% ====================================
+
+\title{\papertitle}
+
+%-------------SINGLE-AUTHOR HEADER STARTS (uncomment below if your paper has a single author)-----------------------
+% \affiliation{
+% \paperauthorA \,\sthanks{This work was supported by the XYZ Foundation}}
+% {\href{https://scrime.u-bordeaux.fr}{SCRIME} \\ Université de Bordeaux, France \\
+% {\tt \href{mailto:ping@linuxaudio.org}{ping@linuxaudio.org}}
+% }
+%-----------------------------------SINGLE-AUTHOR HEADER ENDS------------------------------------------------------
+
+%---------------TWO-AUTHOR HEADER STARTS (uncomment below if your paper has two authors)-----------------------
+\twoaffiliations{
+\paperauthorA % \, \sthanks{This work was supported by the XYZ Foundation}
+}
+{\href{https://drumgizmo.org}{DrumGizmo} \\ Saarbr\"ucken, Germany \\
+{\tt \href{mailto:andre.nusser@gmail.com}{andre.nusser@gmail.com}}
+}
+{\paperauthorB % \,\sthanks{This guy is a very good fellow}
+}
+{\href{https://drumgizmo.org}{DrumGizmo} \\ Aarhus, Denmark \\
+{\tt \href{mailto:deva@aasimon.org}{deva@aasimon.org}}
+}
+%-------------------------------------TWO-AUTHOR HEADER ENDS------------------------------------------------------
+
+%---------------THREE-AUTHOR HEADER STARTS (uncomment below if your paper has three authors)-----------------------
+% \threeaffiliations{
+% \paperauthorA \,\sthanks{This work was supported by the XYZ Foundation}}
+% {\href{https://scrime.u-bordeaux.fr}{SCRIME} \\ Université de Bordeaux, France \\
+% {\tt \href{mailto:ping@linuxaudio.org}{ping@linuxaudio.org}}
+% }
+% {\paperauthorB \,\sthanks{This guy is a very good fellow}}
+% {\href{https://ccrma.stanford.edu}{CCRMA} \\ Stanford University, USA \\
+% {\tt \href{mailto:lac@ccrma.stanford.edu}{lac@ccrma.stanford.edu}}
+% }
+% {\paperauthorC \,\sthanks{Illustrious contributor}}
+% {\href{http://www.musikwissenschaft.uni-mainz.de/Musikinformatik/}{Johannes Gutenberg University (JGU)} \\ Mainz, Germany\\
+% {\tt \href{mailto:lac@uni-mainz.de}{lac@uni-mainz.de}}
+% }
+%-------------------------------------THREE-AUTHOR HEADER ENDS------------------------------------------------------
+
+%----------------FOUR-AUTHOR HEADER STARTS (uncomment below if your paper has four authors)-----------------------
+% \fouraffiliations{
+% \paperauthorA \,\sthanks{This work was supported by the XYZ Foundation}}
+% {\href{https://scrime.u-bordeaux.fr}{SCRIME} \\ Université de Bordeaux, France \\
+% {\tt \href{mailto:ping@linuxaudio.org}{ping@linuxaudio.org}}
+% }
+% {\paperauthorB \,\sthanks{This guy is a very good fellow}}
+% {\href{https://ccrma.stanford.edu}{CCRMA} \\ Stanford University, USA \\
+% {\tt \href{mailto:lac@ccrma.stanford.edu}{lac@ccrma.stanford.edu}}
+% }
+% {\paperauthorC \,\sthanks{Illustrious contributor}}
+% {\href{http://www.musikwissenschaft.uni-mainz.de/Musikinformatik/}{Johannes Gutenberg University (JGU)} \\ Mainz, Germany\\
+% {\tt \href{mailto:lac@uni-mainz.de}{lac@uni-mainz.de}}
+% }
+% {\paperauthorD \,\sthanks{Thanks to the predecessors for the templates}}
+% {\href{https://c-base.org/}{C-Base} \\ Berlin, Germany \\
+% {\tt \href{mailto:lac@c-base.com}{lac@c-base.com}}
+% }
+%-------------------------------------FOUR-AUTHOR HEADER ENDS------------------------------------------------------
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+\noindent
+This paper suggests new sampling algorithms for DrumGizmo. First the requirements and certain problematic special cases are formulated and then several approaches are explored and turned into sample selection algorithms.
+\end{abstract}
+
+\section{Introduction}
+Introduce DrumGizmo. Sample selection is one of the core parts of DrumGizmo as it heavily influences how \enquote{robotic} DrumGizmo sounds. What is sample selection (only consider it for one instrument)?
+
+\subsection{Terminology}
+\begin{description}
+\item[Sample:] One hit on the instrument.
+\item[Power:] Every sample has a certain power which is given by its audio signal \todo{how exactly is it currently measured?}.
+\end{description}
+
+\subsection{Power Value Calculation in DrumGizmo}
+The power value calculation of DrumGizmo works as follows.
+Each sample offset is detected by setting a value threshold. If a sample
+above this threshold is detected the algorithm goes backwards until it
+finds the first zero-crossing and this point is used as the sample offset.
+
+The power, which is just the power of a signal, is regularly
+calculated via sum of squares and the length of it is defined by the
+\enquote{attack length} which is in samples (note to self, make this ms instead; also, see samplesorter.cc:96).
+
+The power is then \enquote{spread out} by raising the value to the power of
+\enquote{spread}, \ie:
+\begin{align*}
+power &= \text{sum of squares in the attack range} \\
+\text{stored sample energy} &= power^{spread}
+\end{align*}
+In the code this is done in samplesorter.cc:99.
+
+\todo{We should probably store the original power and attack length in the xml
+and perform the spread calculation in the engine instead of storing the
+spread-applied value in the xml.}
+
+The attack is the same across all samples within an instrument so the
+energies can be compared.
+
+\subsection{Sample Distribution in DrumGizmo Kits}
+
+\subsection{Current Algorithm of DrumGizmo}
+The current sample selection algorithm of DrumGizmo works as follows. The engine gets a value $l \in [0,1]$ which gives the strength of the sample to be triggered. The power values of a drum kit are floating point numbers without any restriction\todo{do they have to be positive?}. Then the value $l$ is mapped using the canonical bijections between $[0,1]$ and $[p_{\min}, p_{max}]$ and afterwards shifted\todo{by which amount?}. We call this new value $p$.
+
+Now the real sample selection algorithm starts. We select a value $p'$ drawn uniformly at random from $\mathcal{N}(p', \sigma^2)$, where $\sigma$ is a parameter specified by the user\todo{Actually, it is not. It is a value specified by the user \emph{multiplied} with the power range divided by the number of samples.}. Now we simply find the sample $s$ with the power $q$ which is closest to $p'$ -- ties are broken such that the first minimal value is chosen (which is problematic as explained below). In case $s$ is equal to the last sample that we played we repeat this process, otherwise we return $s$. If we did not find another sample than the last played after $4$ iterations, we just return the last played sample.
+
+\subsection{Drawbacks}
+I will list a number of drawbacks of this algorithm in the following. These will be an inspiration for the requirements that are formulated later.
+
+\paragraph{Equal Powers.} In case certain samples have the same power value. Always the first of them in the list of samples is chosen because of the way we break ties. This is obviously wrong and samples should instead be chosen either in a random way or, probably better, in a round robin way.
+
+\paragraph{Middle Samples.} Consider the case where there are 3 samples which almost have the same power value, and especially consider the sample which has the power value in the middle. This sample has a very low probability of being chosen by the current algorithm as it always chooses the closest sample. However, the range for which this sample is the closest sample is very small. Thus, an improved algorithm has to be robust to such small perturbations of power values.
+
+\paragraph{Unequal Probabilities.} More generally, we want that samples which are close, should have a similar probability of being chosen by the sampling algorithm (summed over all possible values of $l$).
+
+\paragraph{History of Size One.} Currently, we only remember the last sample that was played. This seriously limits us to select samples well. Imagine that there are several samples of similar power. We currently rely on the normal distribution solving this, even though using round robin like sampling would result in more diverse samples being chosen while not deviating significantly more from $l$.
+
+\subsection{Related Work}
+Velocity Layers. Round Robin and Random Selection. Is there actually any academic related work? What is actually the mathematical problem that we are trying to solve?
+
+\section{Requirements}
+% \paragraph{Normal Distribution.} The samples should roughly be drawn from a normal distribution.
+\paragraph{Close Sample.} The chosen sample should be reasonably close to the requested power value.
+\paragraph{Avoid Same Samples.} When we have multiple samples to choose from we should always take one which was last played far enough in the past.
+\paragraph{Randomization.} To avoid patterns (like e.g. in round robin), we want some form of randomization.
+\paragraph{Equal Probability.} Locally, samples should have almost the same probability of being chosen.
+
+\section{Suggested Algorithms}
+\subsection{Resampling}
+Resample from normal distribution until we find a fitting sample, aborting after a certain amount of tries. This seems rather wasteful.
+
+\subsection{Objective Function}
+Define an objective function which depends on the history of samples and the current power requested. The sample that we choose is then the one which minimizes this objective function. This is a nice way to balance the two contradictory requirements of choosing a sample which is close to the requested power and avoiding samples that were just played.
+
+The rough algorithm should go as follows. A sample with power $p$ is requested.
+% We draw one sample from the normal distribution around $l$ and call it $p$.
+For any sample $q$, let $t_q$ be the time at which $q$ was played last (the unit does not matter as it is parametrized by $\beta$ anyway), and let $r(q,t)$ be a random number generator uniformly producing numbers in the range $[0,1]$. At the current time $t$, we now want to find the sample $q$ minimizing the objective function
+\[
+ f(q, t) \coloneqq \alpha \cdot (p-q)^2 + \beta \cdot (t_q - t)^{-2} + \gamma \cdot r(q,t).
+\]
+We have to ensure that $t_q \neq t$ to avoid division by zero.\todo{Adapt to what is actually in the code.}
+
+\section{Implementation Details}
+Instead of iterating over all samples and computing the objective function, we can simply do a binary search for the value closest to the requested power and then search down and upwards until we can be sure that there cannot be any better value. This is the case as soon as the first summand exceeds the best found value.
+
+\section{Experiments}
+\subsection{Methods of Evaluation}
+\begin{itemize}
+\item mean squared error to straight line from min power to max power
+\item histogram of distance to closest next same sample (to check that diverse samples are selected; picture!). Or maybe some other measurement, not sure.
+\item Histogram of how often samples were played. This should be a uniforum distribution (at least locally). Globally it might diverge from that as the sampling is worse for some powers.
+\item mean square error to gaussian curve (to check that we still use something similar to a normal distribution; picture!)
+\item Upload sound samples of the different algorithms to a server and link to them.
+\end{itemize}
+\subsection{Experimental Evaluation}
+
+\section{Conclusion}
+What is the best algorithm and why?
+
+%\newpage
+\nocite{*}
+\bibliographystyle{IEEEbib}
+\bibliography{LAC-20} % requires file lac-20.bib
+
+\end{document}
diff --git a/sampling_alg_lac2020/LAC-20.tex b/sampling_alg_lac2020/LAC-20.tex
index 0a6a94c..47f5e7a 100644
--- a/sampling_alg_lac2020/LAC-20.tex
+++ b/sampling_alg_lac2020/LAC-20.tex
@@ -33,8 +33,10 @@
% ! ! ! ! ! ! ! ! ! ! ! ! user defined variables ! ! ! ! ! ! ! ! ! ! ! ! ! !
% Please use these commands to define title and author(s) of the paper:
\def\papertitle{On Sampling Algorithms for Drums}
-\def\paperauthorA{André Nusser}
-\def\paperauthorB{Bent Bisballe Nyeng}
+% \def\paperauthorA{André Nusser}
+% \def\paperauthorB{Bent Bisballe Nyeng}
+\def\paperauthorA{}
+\def\paperauthorB{}
\def\paperauthorC{}
\def\paperauthorD{}
@@ -202,17 +204,17 @@
%-----------------------------------SINGLE-AUTHOR HEADER ENDS------------------------------------------------------
%---------------TWO-AUTHOR HEADER STARTS (uncomment below if your paper has two authors)-----------------------
-\twoaffiliations{
-\paperauthorA % \, \sthanks{This work was supported by the XYZ Foundation}
-}
-{\href{https://drumgizmo.org}{DrumGizmo} \\ Saarbr\"ucken, Germany \\
-{\tt \href{mailto:andre.nusser@gmail.com}{andre.nusser@gmail.com}}
-}
-{\paperauthorB % \,\sthanks{This guy is a very good fellow}
-}
-{\href{https://drumgizmo.org}{DrumGizmo} \\ Aarhus, Denmark \\
-{\tt \href{mailto:deva@aasimon.org}{deva@aasimon.org}}
-}
+% \twoaffiliations{
+% \paperauthorA % \, \sthanks{This work was supported by the XYZ Foundation}
+% }
+% {\href{https://drumgizmo.org}{DrumGizmo} \\ Saarbr\"ucken, Germany \\
+% {\tt \href{mailto:andre.nusser@gmail.com}{andre.nusser@gmail.com}}
+% }
+% {\paperauthorB % \,\sthanks{This guy is a very good fellow}
+% }
+% {\href{https://drumgizmo.org}{DrumGizmo} \\ Aarhus, Denmark \\
+% {\tt \href{mailto:deva@aasimon.org}{deva@aasimon.org}}
+% }
%-------------------------------------TWO-AUTHOR HEADER ENDS------------------------------------------------------
%---------------THREE-AUTHOR HEADER STARTS (uncomment below if your paper has three authors)-----------------------
@@ -256,103 +258,61 @@
\maketitle
\begin{abstract}
-\noindent
-This paper suggests new sampling algorithms for DrumGizmo. First the requirements and certain problematic special cases are formulated and then several approaches are explored and turned into sample selection algorithms.
+\noindent Sampling drum kits well is a difficult and challenging task. Especially, building a drum kit sample bank with different velocity layers requires producing samples of very similar loudness, as changing the gain of a sample after recording makes it sound less natural. An approach that avoids this issue is to not categorize the samples in fixed groups but to simply calculate their loudness and then dynamically choose a sample, when a sample corresponding to e.g.\ a specific MIDI value is requested. We present a first investigation of algorithms doing this selection and discuss their advantages and disadvantages. The seemingly best candidate we implemented in DrumGizmo -- a FLOSS drum plugin -- and we do experiments on how our suggested algorithms perform on the samples drum kits.
\end{abstract}
\section{Introduction}
-Introduce DrumGizmo. Sample selection is one of the core parts of DrumGizmo as it heavily influences how \enquote{robotic} DrumGizmo sounds. What is sample selection (only consider it for one instrument)?
-
-\subsection{Terminology}
-\begin{description}
-\item[Sample:] One hit on the instrument.
-\item[Power:] Every sample has a certain power which is given by its audio signal \todo{how exactly is it currently measured?}.
-\end{description}
-
-\subsection{Power Value Calculation in DrumGizmo}
-The power value calculation of DrumGizmo works as follows.
-Each sample offset is detected by setting a value threshold. If a sample
-above this threshold is detected the algorithm goes backwards until it
-finds the first zero-crossing and this point is used as the sample offset.
-
-The power, which is just the power of a signal, is regularly
-calculated via sum of squares and the length of it is defined by the
-\enquote{attack length} which is in samples (note to self, make this ms instead; also, see samplesorter.cc:96).
+\todo{Talk about the general problem of sample selection.}
+\todo{Limit scope to drums.}
+\todo{Talk about round robin.}
+\todo{Mention drawbacks.}
+\todo{Introduce high-level ideas of our work.}
+\todo{Make difference between humanization and sample selection clear.}
-The power is then \enquote{spread out} by raising the value to the power of
-\enquote{spread}, \ie:
-\begin{align*}
-power &= \text{sum of squares in the attack range} \\
-\text{stored sample energy} &= power^{spread}
-\end{align*}
-In the code this is done in samplesorter.cc:99.
-
-\todo{We should probably store the original power and attack length in the xml
-and perform the spread calculation in the engine instead of storing the
-spread-applied value in the xml.}
-
-The attack is the same across all samples within an instrument so the
-energies can be compared.
-
-\subsection{Sample Distribution in DrumGizmo Kits}
-
-\subsection{Current Algorithm of DrumGizmo}
-The current sample selection algorithm of DrumGizmo works as follows. The engine gets a value $l \in [0,1]$ which gives the strength of the sample to be triggered. The power values of a drum kit are floating point numbers without any restriction\todo{do they have to be positive?}. Then the value $l$ is mapped using the canonical bijections between $[0,1]$ and $[p_{\min}, p_{max}]$ and afterwards shifted\todo{by which amount?}. We call this new value $p$.
-
-Now the real sample selection algorithm starts. We select a value $p'$ drawn uniformly at random from $\mathcal{N}(p', \sigma^2)$, where $\sigma$ is a parameter specified by the user\todo{Actually, it is not. It is a value specified by the user \emph{multiplied} with the power range divided by the number of samples.}. Now we simply find the sample $s$ with the power $q$ which is closest to $p'$ -- ties are broken such that the first minimal value is chosen (which is problematic as explained below). In case $s$ is equal to the last sample that we played we repeat this process, otherwise we return $s$. If we did not find another sample than the last played after $4$ iterations, we just return the last played sample.
-
-\subsection{Drawbacks}
-I will list a number of drawbacks of this algorithm in the following. These will be an inspiration for the requirements that are formulated later.
-
-\paragraph{Equal Powers.} In case certain samples have the same power value. Always the first of them in the list of samples is chosen because of the way we break ties. This is obviously wrong and samples should instead be chosen either in a random way or, probably better, in a round robin way.
-
-\paragraph{Middle Samples.} Consider the case where there are 3 samples which almost have the same power value, and especially consider the sample which has the power value in the middle. This sample has a very low probability of being chosen by the current algorithm as it always chooses the closest sample. However, the range for which this sample is the closest sample is very small. Thus, an improved algorithm has to be robust to such small perturbations of power values.
-
-\paragraph{Unequal Probabilities.} More generally, we want that samples which are close, should have a similar probability of being chosen by the sampling algorithm (summed over all possible values of $l$).
+\subsection{Related Work}
+\todo{I don't really know what to write, except about round robin. Is there any other common method or any academic literature? Are there other methods in open source programs?}
+\todo{Discuss DGs old sampling algorithm briefly.}
-\paragraph{History of Size One.} Currently, we only remember the last sample that was played. This seriously limits us to select samples well. Imagine that there are several samples of similar power. We currently rely on the normal distribution solving this, even though using round robin like sampling would result in more diverse samples being chosen while not deviating significantly more from $l$.
+\subsection{Our Contribution}
+\todo{The main points are: Identify important aspects that sampling algorithms in this setting have to fulfill; Suggest a new algorithm based on those requirements; Implement and conduct experiments on this implementation.}
-\subsection{Related Work}
-Velocity Layers. Round Robin and Random Selection. Is there actually any academic related work? What is actually the mathematical problem that we are trying to solve?
+\section{Preliminaries}
+\todo{Talk about how the drum kit samples are usually created; very briefly.}
+\todo{Talk about loudness computation of samples.}
+\todo{Mathematical basics (if there are any important ones).}
+\todo{Formalize the setting, i.e.\ what is the input/output of our algorithm?}
\section{Requirements}
-% \paragraph{Normal Distribution.} The samples should roughly be drawn from a normal distribution.
-\paragraph{Close Sample.} The chosen sample should be reasonably close to the requested power value.
-\paragraph{Avoid Same Samples.} When we have multiple samples to choose from we should always take one which was last played far enough in the past.
-\paragraph{Randomization.} To avoid patterns (like e.g. in round robin), we want some form of randomization.
-\paragraph{Equal Probability.} Locally, samples should have almost the same probability of being chosen.
-
-\section{Suggested Algorithms}
-\subsection{Resampling}
-Resample from normal distribution until we find a fitting sample, aborting after a certain amount of tries. This seems rather wasteful.
-
-\subsection{Objective Function}
-Define an objective function which depends on the history of samples and the current power requested. The sample that we choose is then the one which minimizes this objective function. This is a nice way to balance the two contradictory requirements of choosing a sample which is close to the requested power and avoiding samples that were just played.
-
-The rough algorithm should go as follows. A sample with power $p$ is requested.
-% We draw one sample from the normal distribution around $l$ and call it $p$.
-For any sample $q$, let $t_q$ be the time at which $q$ was played last (the unit does not matter as it is parametrized by $\beta$ anyway), and let $r(q,t)$ be a random number generator uniformly producing numbers in the range $[0,1]$. At the current time $t$, we now want to find the sample $q$ minimizing the objective function
-\[
- f(q, t) \coloneqq \alpha \cdot (p-q)^2 + \beta \cdot (t_q - t)^{-2} + \gamma \cdot r(q,t).
-\]
-We have to ensure that $t_q \neq t$ to avoid division by zero.\todo{Adapt to what is actually in the code.}
-
-\section{Implementation Details}
-Instead of iterating over all samples and computing the objective function, we can simply do a binary search for the value closest to the requested power and then search down and upwards until we can be sure that there cannot be any better value. This is the case as soon as the first summand exceeds the best found value.
+\todo{Intuitively discuss the requirements of a good sampling algorithm.}
+\todo{List the requirements one by one and discuss them. Try to formalize them in some way.}
+
+\section{Algorithm}
+\todo{We have a multi-criteria optimization!}
+\todo{Talk about the general idea of a potential function.}
+\todo{Introduce the potential function of the algorithm.}
+\todo{Talk about the single terms of the potential function.}
+\todo{Maybe add some pseudo-code to make things easier to understand?}
+
+\section{Implementation}
+\todo{Give a short introduction to DrumGizmo, including a link to the git repository.}
+\todo{Talk about the timeline, i.e., when were the releases and what is still unreleased?}
+\todo{Talk about how the sampling algorithm was implemented}
+\todo{Add some of the source code to the paper?}
+\todo{Give less important implementation details, e.g., like adaptive search starting from the most promising value}
\section{Experiments}
-\subsection{Methods of Evaluation}
-\begin{itemize}
-\item mean squared error to straight line from min power to max power
-\item histogram of distance to closest next same sample (to check that diverse samples are selected; picture!). Or maybe some other measurement, not sure.
-\item Histogram of how often samples were played. This should be a uniforum distribution (at least locally). Globally it might diverge from that as the sampling is worse for some powers.
-\item mean square error to gaussian curve (to check that we still use something similar to a normal distribution; picture!)
-\item Upload sound samples of the different algorithms to a server and link to them.
-\end{itemize}
-\subsection{Experimental Evaluation}
-
-\section{Conclusion}
-What is the best algorithm and why?
+\todo{Talk about the setup.}
+\todo{Talk about what the experiments should show: two close samples are chosen similarly often; playing the same MIDI note plays a reasonably varied sample set; average distance of one sample}
+\todo{Experiments are: playing fast sweeps (with multiple hits per velocity); playing a single note over and over again at the same velocity; sound examples that people can listen to online?}
+\todo{Do beautiful tables and plots here}
+\todo{Summarize experiments}
+
+\section{Conclusion and Future Work}
+\todo{Recapitulate what was done in this paper. Highlight some of the difficulties and surprises.}
+\todo{List future work: transforming the loudness space; refine the objective function; adapt algorithm to other instruments/settings; study to see what sounds good to people and do they actually hear the difference?}
+
+\section{Acknowledgements}
+\todo{Thank people for testing?}
%\newpage
\nocite{*}