.
This commit is contained in:
parent
9ef423de71
commit
f937547991
2 changed files with 4 additions and 3 deletions
3
notes.py
3
notes.py
|
@ -30,8 +30,9 @@ def note2freq(name):
|
||||||
return A*rel**(fullnum + 3)
|
return A*rel**(fullnum + 3)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
test_fmt = '{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz'
|
||||||
def test(name, expected):
|
def test(name, expected):
|
||||||
print('{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz'.format(name, note2freq(name), expected))
|
print(test_fmt.format(name, note2freq(name), expected))
|
||||||
|
|
||||||
test('C2' , 65.41)
|
test('C2' , 65.41)
|
||||||
test('Ab4', 415.30)
|
test('Ab4', 415.30)
|
||||||
|
|
|
@ -16,8 +16,8 @@ def uw2tension(uw, freq, SL):
|
||||||
def tension2uw(t, freq, SL):
|
def tension2uw(t, freq, SL):
|
||||||
return (t*uw_const)/(2*SL*freq)**2
|
return (t*uw_const)/(2*SL*freq)**2
|
||||||
|
|
||||||
outfmt = '{:<8} at {:> 5.2f} lbs ({:>+4.2f})'
|
outfmt = '{:<8} at {:> 5.2f} lb ({:>+4.2f})'
|
||||||
finalfmt = 'total: {:>7.2f} lbs ({:>+5.2f})'
|
finalfmt = 'total: {:>7.2f} lb ({:>+5.2f})'
|
||||||
def print_ideal_stock(strings, scale_length=25.512):
|
def print_ideal_stock(strings, scale_length=25.512):
|
||||||
SL = scale_length
|
SL = scale_length
|
||||||
total_tension = 0
|
total_tension = 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue