-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Humanizer #627
Draft
theGreatWhiteShark
wants to merge
7
commits into
hydrogen-music:master
Choose a base branch
from
theGreatWhiteShark:humanizer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Humanizer #627
theGreatWhiteShark
wants to merge
7
commits into
hydrogen-music:master
from
theGreatWhiteShark:humanizer
Commits on Jul 21, 2018
-
I just took a look at the humanizer and there a couple of things I do not understand and which are probably not intended to work the way they are doing right now. First of all both the humanization of the velocity and the pitch in *hydrogen.cpp* feature a negative bias of the random variable. Firstly, a random generated and afterwards a constant value determined by the get_humanize_velocity_value() and the get_random_pitch_factor() is subtracted. Is there a reason for this bias? In randomizing the pitch the random variable, which is drawn using the getGaussian() function, is only scaled using the fMaxPitchDeviation value but not with the random pitch factor of the corresponding instrument. The latter is only introduced as a negative bias. This does not seem right. For a better readbility I renamed the input variable of the getGaussian() function into "variance" since this is what it actually is: the variance of the distribution the random variable is drawn from. Also I would propose to use the get_humanize... values as a input to the getGaussian function so it is obvious that the variance will be scaled using the knots for the humanizer. There are two variables *fMaxPitchDeviation* and *nMaxTimeHumanize* defined in the source and only used for the scaling. I expect these are intended to bound the random variable. Since we are generating Gaussian white noise, the random variable is (in theory) able to take any number between minus and plus infinity. I used the two variables instead to bound the random variable to assure plausible fluctuations. But this might messed up the scaling applied here. I just looked at the humanizer so far and lack the overall knowledge of the internal working of Hydrogen. Could someone take a look at the scaling here? Last but not least I have a question: What exactly is the *swing* intended to accomplish? It is implemented as a constant and positive additive term to the offset of a note. No randomization or whatsoever takes place here. correct scaling of the humanizer inputs Using integration by substitution on the second moment of a distribution one can verify that the scaling of a random variable by a factor `a` multiplies its standard deviation by `a` and its variance by `a^2`. `var(a*x)=a^2var(x)` Therefore, the inputs of the knots of the humanizers have to be squared in order to have the same experience as beforehand. In other words, up to now the behavior was as follows: draw a Gaussian random number with a variance of 0.2 and scale the process by a factor controlled via the rotator buttons, which will scale the variance of the process by the square of their value. I would vote to streamline this behavior by introducing the right range and scaling to the rotator button itself and to display the variance of the white noise in the info region in Hydrogen after moving the button. verbose the maximal humanization variance The factors 0.2 or 0.3 in the calls to `getGaussian` in the humanization parts do act as an upper bound for the variance of the Gaussian white noise. By assigning those value to an approriately names variable their role becomes much more apparent.
Configuration menu - View commit details
-
Copy full SHA for e88c117 - Browse repository at this point
Copy the full SHA e88c117View commit details -
adjust mixerline output for small window sizes
in small window sizes the phrase "Set humanize velocity parameter" needs some time to run through notification area of the mixer. Thus, one is not able to see the actual value when still rotating the knot. Instead, I moved the displayed value to the front of the display message to visible at all times.
Configuration menu - View commit details
-
Copy full SHA for 240eefe - Browse repository at this point
Copy the full SHA 240eefeView commit details -
Choosing noise color in masterMixerLine
The Rotary knob for the **swing** was removed (because I still do not see any use of this variable and no one of the Hydrogen team responds to my questions). Instead two `QComboBox`s have been added via `LCDCombo` objects. They will be used as drop down menus to select the color of the corresponding noise. Those colors can be indiviually chosen for both the humanization of the velocity and the onset. The background picture of the master strip of the MixerLine was changed as well to nicely inegrate the changes.
Configuration menu - View commit details
-
Copy full SHA for 2e0feb6 - Browse repository at this point
Copy the full SHA 2e0feb6View commit details -
handling of the humanization color box signals
The Hydrogen song does now contain the additional functions `get_humanize_time_color`, `set_humanize_time_color` and the equivalent for the velocity. The internal state is stored in the `__humanize_time_color` and `__humanize_velocity_color` intt variables. Both states are written and loaded to file properly now. Every last remaining instance of the swing factor had been removed. first draft of the noise generating functions fixing bugs in auxiliary impl of humanizer The random seed did have the wrong type causing the random number generator to spit `nan`. The factor `maximalHumanizationTimeVariance` has been enlarged. Since the resulting random number will be floored, there is absolutely no point in having it set to 1.
Configuration menu - View commit details
-
Copy full SHA for 378274e - Browse repository at this point
Copy the full SHA 378274eView commit details -
adding Randomizer object for humanization
Instead of a bunch of inline functions and dozens of global variables holding the states of the different generators of colored noise I introduced an object class `Randomizer`. It will contain interfaces to draw new random numbers as public methods and all states as private ones. To allow a better maintainance I moved all code concerning the random number generator in dedicated files `randomizer.cpp` and `randomizer.h`. The randomizer is now designed to be a proper part of Hydrogen. Each time the `Hydrogen::create_instance()` function is called upon starting up Hydrogen an instance of the Randomizer is created as well using `Randomizer::create_instance()`. During the runs of the audio engine the generated instance will be retrieved using `Randomizer::get_instance()`. This way only one seeded random number generator does exist and every random number, regardless of its color, is drawn from it. In addition the generators of the Gaussian white and white uniform noise source have been updated. - the **Gaussian white noise source** now uses both Gaussian random variables produced by the Box-Muller transformation and relies on the updated uniform white algorithm - the **uniform white noise source** was completely reworked and now the algorithm *Ranq1* of the book *Numerical recipes* by Press et al. is used. It is of higher quality and does not produce correlated noise like the `std::rand()` function. Some description has been added to the pink noise source.
Configuration menu - View commit details
-
Copy full SHA for 33b87ae - Browse repository at this point
Copy the full SHA 33b87aeView commit details -
the Hydrogen core backend has now been updated to ask the GUI what noise color was chosen by the user. This will affect the noise source the random increment will be drawn from.
Configuration menu - View commit details
-
Copy full SHA for 2d83ea4 - Browse repository at this point
Copy the full SHA 2d83ea4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cbc822 - Browse repository at this point
Copy the full SHA 7cbc822View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.