From a28e09c90d1d2c24ecd5ae51b4d4ab974ab4ef26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Nusser?= <andre.nusser@googlemail.com>
Date: Thu, 23 Aug 2018 14:42:30 +0200
Subject: Continued.

---
 sampling_alg.tex | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'sampling_alg.tex')

diff --git a/sampling_alg.tex b/sampling_alg.tex
index 682f4b5..aceb40e 100644
--- a/sampling_alg.tex
+++ b/sampling_alg.tex
@@ -86,7 +86,7 @@ Introduce DrumGizmo. Sample selection is one of the core parts of DrumGizmo as i
 \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. 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.
+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.
@@ -119,6 +119,10 @@ The rough algorithm should go as follows. A sample with power $l$ is requested.
 \[
 	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.
+
+\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}
-- 
cgit v1.2.3

