From ecb3c511c4b08ec400ead93eb9c7cf616ad92dfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Nusser?= <andre.nusser@googlemail.com>
Date: Sat, 2 Feb 2019 23:46:41 +0100
Subject: Continued.

---
 sampling_alg.tex | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

(limited to 'sampling_alg.tex')

diff --git a/sampling_alg.tex b/sampling_alg.tex
index aceb40e..2a0ef2b 100644
--- a/sampling_alg.tex
+++ b/sampling_alg.tex
@@ -78,10 +78,35 @@ Introduce DrumGizmo. Sample selection is one of the core parts of DrumGizmo as i
 \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 \todo{how exactly is it currently measured?}.
+\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{Sample Distribution in our Drum Kits}
+\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$.
@@ -100,7 +125,7 @@ I will list a number of drawbacks of this algorithm in the following. These will
 \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?
+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.
@@ -131,6 +156,7 @@ Instead of iterating over all samples and computing the objective function, we c
 \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}
 
-- 
cgit v1.2.3

