Example #1
0
        public static int FretNumberToClientX(int fretNumber, GuitarModel model, int stringNumber)
        {
            // fret position = fretboardLength/1.0595^fretNumber from the bridge on a standard guitar,
            // for multiscale the fan factor decreses towards 12th (neutral) fret and inverts for higher frets
            // actual fret position per string varies depending on the scale length applicable for the given string (Primary to Secondary scale length)

            if (model.IsMultiScale)
            {
                /*var exp = (float)(fretNumber + 1) / 12;
                 * var pow = Math.Pow(2, exp);
                 * var BASS = model.PrimaryScaleLengthMM - (model.PrimaryScaleLengthMM / pow);
                 * var TREBLE = model.SecondaryScaleLengthMM - (model.SecondaryScaleLengthMM / pow);
                 *
                 *
                 */


                double fretboardLength = model.PrimaryScaleLengthMM;
                double fretPosX        = (fretboardLength - (fretboardLength / Math.Pow(1.0595, fretNumber)));
                return((int)fretPosX);
            }
            else
            {
                double fretboardLength = model.PrimaryScaleLengthMM;
                double fretPosX        = (fretboardLength - (fretboardLength / Math.Pow(1.0595, fretNumber)));
                return((int)fretPosX);
            }
        }
Example #2
0
 public int GetFretboardWidth(GuitarModel model, int stringNumber)
 {
     return(GuitarString.FretNumberToClientX(NumberOfFrets, model, stringNumber));
 }