Minor code refactoring

* switched pitch to be not linear but cubic (smoother control)
* removed unneccessary calculations and functions
* code cleanup (removed some magic numbers)
* modified variables to least possible type (e.g. "short")
* removed unneccessary use of floating point numbers where int is totally appropriate