Thursday, October 31, 2013

Laptop

Well it turns out a faulty ram chip was to blame for the crash and it was still under warranty so all good there now. I also found out while my memory is a disaster on my meds my ability to think ahead seems to be ok as I found out I did have a backup of all  my Coursea Homework..............go me! The only thing I lost was some time it seems. Woo Hoo.

Here is the final version of my fret calculator:

# From Stewmac
# To calculate the scale length for stringed instruments

# Notes on fret layout
# The most accurate way to lay out your scale is making all measurements
# from the nut (using the "fret to fret" distance only to confirm your layout).
# Laying out frets only by measuring fret to fret will compound error.
# For example, if you're laying out frets by marking with a scribe and your
# accuracy is plus or minus 2 millimeters, you could be off by as much as
# 24 millimeters at the 12th fret.

# Measurements are given from the end of the fingerboard (face of the nut)
# to the center of a fret slot.
# WRITTEN FOR PYTHON 3.3.2
#--------------------------------------------------------------------

Im = ''
const = 17.817 # Do not change this

def fretCal(ScaleLength, nofret):
    '''(number, number)-> float
    Calculates the fret positions for any stringed instrument
    Given 'Scale length', 'number of frets' in inches or mm
    >>> fretCal(19, 18)  
    Fret 1 from nut 1.066 inches
    Fret 2 from nut 2.073 inches
    ............................
    >>> fretCal(635, 22)
    Fret 1 from nut 35.64 mm
    Fret 2 from nut 69.28 mm
    '''
    if ScaleLength < 99:
        scale = ScaleLength
        Im = 'inches'
    if ScaleLength > 100:
        scale = ScaleLength
        Im = 'mm'
       
    for i in range(1, nofret +1):
        ScaleLength = ScaleLength - (ScaleLength / const)
        print('Fret', i, 'from nut',round(scale - ScaleLength, 3),Im)
   
#--------------------------------------------------------------------

No comments:

Post a Comment