From d78c37b39a529d0d1f18a9d6d4d7076b3ee19aa0 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 9 Feb 2020 12:41:44 +0100 Subject: Merge old algo description from LAC20-old file into the article ad make adjustments. --- sampling_alg_lac2020/LAC-20.tex | 56 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/sampling_alg_lac2020/LAC-20.tex b/sampling_alg_lac2020/LAC-20.tex index 3eaa57a..12c7d69 100644 --- a/sampling_alg_lac2020/LAC-20.tex +++ b/sampling_alg_lac2020/LAC-20.tex @@ -284,14 +284,15 @@ \todobent{Discuss DGs old sampling algorithm briefly.} -The evolution of the DrumGizmo sample selection engine: - - * Velocity groups with probabilities for randomization. - -The early versions of drumgizmo used a sample selection algorithm -based on grouping of samples, each with a corresponding velocity -range, with a number of audio files, each with a probability of being -played in the group: +The engine gets a value $l \in [0,1]$ which must then be used by the +engine for deciding how the output should be produced. +Some engines use this value as a gain factor but in the case of +DrumGizmo it is used for sample selection only. +The early versions used a sample selection algorithm based on velocity +groups, akin to the one used by sfz \todo{add bib reference}, in which +each group spans a specfied velocity range and the sample selection is +made by uniformly randomly selecting one of the samples contained in +the group corresponding to the input velocity: {\tiny\begin{verbatim} ________________ _________________ / \ / uniformly random \ @@ -299,32 +300,41 @@ played in the group: [0; 1] \________________/ \__________________/ \end{verbatim}} -\todobent{Write this algorithm in psudocode syntax.} - - * StdDev/Mean based using measured power values of each sample +This algorithm did not give good results in small samplesets so later +an improved algorithm was introduced which was instead on normal +distributed random numbers and with power values for each sample in +the set. + +The power values of a drum kit are floating point numbers without any +restrictions but assumed to be positive. Then the input 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 normal distributed at random from $\mathcal{N}(p', \sigma^2)$, +where the mean value, $\mu$, set to the input value $l$ and +and the stddev, $\sigma$, is a parameter controlled by the user +expressed in fractions of the size and span of the sampleset. +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. -Later a new algorithm was created using a normal distributed random -number for the sample selection with the mean controlled by the input -velocity and the stddev calculated on the number of samples in the -instrument as well as their power span. {\tiny\begin{verbatim} stddev \ ________ _________________ / \ / nearest power \ -- input note --> | random | -- power --> | sample selector | -- sample --> [0; 1] \________/ \_________________/ + / + mean \end{verbatim}} In order to make this new algorithm the power of each sample must be present along with the sample data. -\todobent{Again, write this algorithm in psudocode syntax.} - - -In both algorithms, to prevent the same sample to be selected twice in a row, a -re-selection is being performed whenever the selected sample is the -same as the last one selected up to a maximum number of times. -This is being stored per instrument. - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- cgit v1.2.3