Package wiat :: Package instruments :: Module Saxophones
[hide private]
[frames] | no frames]

Source Code for Module wiat.instruments.Saxophones

  1  """ Saxophones.py - Definition of saxophone instruments 
  2   
  3      It includes a Selmer Super Action Series 2 alto. 
  4      Tonehole and dimensions measurements done by Gary Scavone and Tristan Matthews. 
  5      Verification and some corrections to the measured data by Antoine Lefebvre 
  6   
  7      Copyright (c) 2008 Antoine Lefebvre 
  8      All rights reserved. 
  9  """ 
 10   
 11  import wiat 
 12  from wiat.TM import * 
 13   
 14  _L_ADAPTER = 0.0215 # length of the neck-body cylindrical adapter 
 15   
 16  _L_NECK = 0.172 + _L_ADAPTER  
 17  # (the short cylinder part entering the main body is not included) 
 18   
 19  _L_TUBE = 0.475 - _L_ADAPTER 
 20  _L_ELBOW = 0.170 
 21   
 22  _D_NECK_IN  = 0.0125 
 23  _D_NECK_OUT = 0.0227 
 24   
 25  _D_BELL_OUT = 0.119 
 26   
 27  # measurement of the bell (this should be redone with more precise equipment) 
 28  _BELLDATA = [(0.,0.057),(0.06,0.063),(0.14,0.07),(0.16,0.073), 
 29               (0.18,0.0765),(0.2,0.093),(0.205,0.119)] 
 30   
 31  _L_MOUTHPIECE_EQUIV = 0.0709 
 32  # equivalent mouthpiece length 
 33   
 34  _Mouthpiece = [Cylinder(_D_NECK_IN, _L_MOUTHPIECE_EQUIV)] 
 35   
 36  _Neck = [Cylinder(_D_NECK_IN, 0.0254), 
 37           Cone(_D_NECK_IN, _D_NECK_OUT, _L_NECK-0.0254-_L_ADAPTER), 
 38           Cylinder(_D_NECK_OUT, _L_ADAPTER) ] 
 39   
 40  _Body = [Cone(_D_NECK_OUT, 0.050, _L_TUBE)] 
 41   
 42  # Elbow = [Cone(0.050, 0.057, ElbowLength)] 
 43  # taking the curvature into account make a significant differences  
 44  # (about 20 cents) 
 45  _Elbow = [CurvedCone(0.050, 0.057, _L_ELBOW, 0.0423)] 
 46   
 47  # the elbow is curved 
 48  # B = r0/R0 = 25.5/42.25 = 0.60 (small end) 
 49  # B = r0/R0 = 29.0/42.25 = 0.69 (large end) 
 50   
 51  _Bell = CreateCylindersAndConesFromList(_BELLDATA) 
 52   
 53   
 54  # bends:  
 55   
 56  _Saxophone = _Neck + _Body + _Elbow + _Bell 
 57   
 58  # old body 
 59  #        Cone(0.057, 0.064, 0.069 + 0.0384), 
 60  #        Cone(0.064, 0.205, 0.14), 
 61           
 62   
 63  # diameter, th heigh min, max, position relative to neck input 
 64  offset = _L_NECK - _L_ADAPTER 
 65   
 66   
 67  # small function to convert tonehole positions from the side to the center 
68 -def __C(d,t,p,d_pad,h_pad):
69 return (d,t,p+d/2.,d_pad,h_pad)
70 71 # 25 tone holes, including register holes 72 _ToneHoles = [ 73 ToneHole(*__C(0.00170, 0.0050, 0.0783, d_pad=0.003, h_pad=0.002)), 74 ToneHole(*__C(0.01350, 0.0020, 0.0290+offset, d_pad=0.02, h_pad=0.002)), 75 ToneHole(*__C(0.01350, 0.0090, 0.0450+offset, d_pad=0.02, h_pad=0.002)), 76 ToneHole(*__C(0.00215, 0.0020, 0.0480+offset, d_pad=0.003, h_pad=0.002)), 77 ToneHole(*__C(0.01330, 0.0020, 0.0580+offset, d_pad=0.02, h_pad=0.002)), 78 ToneHole(*__C(0.01335, 0.0020, 0.0730+offset, d_pad=0.02, h_pad=0.002)), 79 ToneHole(*__C(0.01320, 0.0015, 0.0930+offset, d_pad=0.02, h_pad=0.002)), 80 ToneHole(*__C(0.00960, 0.0020, 0.1070+offset, d_pad=0.02, h_pad=0.002)), 81 ToneHole(*__C(0.01940, 0.0020, 0.1270+offset, d_pad=0.03, h_pad=0.002)), 82 ToneHole(*__C(0.01990, 0.0020, 0.1455+offset, d_pad=0.03, h_pad=0.002)), 83 ToneHole(*__C(0.01510, 0.0020, 0.1625+offset, d_pad=0.03, h_pad=0.002)), 84 ToneHole(*__C(0.01980, 0.0020, 0.1950+offset, d_pad=0.03, h_pad=0.002)), 85 ToneHole(*__C(0.01990, 0.0020, 0.2010+offset, d_pad=0.03, h_pad=0.002)), 86 ToneHole(*__C(0.02350, 0.0020, 0.2260+offset, d_pad=0.03, h_pad=0.002)), 87 ToneHole(*__C(0.02550, 0.0020, 0.2650+offset, d_pad=0.03, h_pad=0.002)), 88 ToneHole(*__C(0.02350, 0.0020, 0.3045+offset, d_pad=0.03, h_pad=0.002)), 89 ToneHole(*__C(0.02770, 0.0020, 0.3360+offset, d_pad=0.03, h_pad=0.002)), 90 ToneHole(*__C(0.02360, 0.0020, 0.3380+offset, d_pad=0.03, h_pad=0.002)), 91 ToneHole(*__C(0.02970, 0.0020, 0.3850+offset, d_pad=0.035, h_pad=0.002)), 92 ToneHole(*__C(0.03540, 0.0010, 0.4230+offset, d_pad=0.04, h_pad=0.002)), 93 ToneHole(*__C(0.03290, 0.0020, 0.4860+offset, d_pad=0.04, h_pad=0.002)), 94 ToneHole(*__C(0.02850, 0.0020, 0.0500+offset+_L_TUBE, 95 d_pad=0.035, h_pad=0.002)), 96 ToneHole(*__C(0.02970, 0.0020,-0.0200+offset+_L_TUBE+_L_ELBOW, 97 d_pad=0.035, h_pad=0.002)), 98 ToneHole(*__C(0.04010, 0.0020, 0.0120+offset+_L_TUBE+_L_ELBOW, 99 d_pad=0.05, h_pad=0.002)), 100 ToneHole(*__C(0.03840, 0.0020, 0.0690+offset+_L_TUBE+_L_ELBOW, 101 d_pad=0.05, h_pad=0.002))] 102 103 # it would be nice to have a state machine giving the closed keys as a function of the key pressed 104 105 # there are 23 buttons to press (10 are 1 to 1 mapping) (4 are left small finger) 106 107 # Dictionary giving closed keys for a given note (standard fingering) 108 # 1: tonehole open 109 # 0: tonehole closed 110 # lowest tonehole to the right 111 112 113 _Fingerings = { 114 'B flat 0': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], 115 'B 0': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], 116 'C 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 117 'D flat 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1], 118 'D 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1], 119 'E flat 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1], 120 'E 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1], 121 'F 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1], 122 'G flat 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1], 123 'G flat 1 (bis)': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,1,1], 124 'G 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1], 125 'A flat 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,1], 126 'A 1': [0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,1,1], 127 'B flat 1': [0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 128 'B flat 1 (bis)': [0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,0,1,0,1,1], 129 'B 1': [0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 130 'C 2 (bis)': [0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 131 'C 2': [0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1,0,1,1], 132 'D flat 2': [0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], # all keys up 133 'D 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1], 134 'E flat 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1], 135 'E 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1], 136 'F 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1], 137 'G flat 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1], 138 'G flat 2 (bis)': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,1,1], 139 'G 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1], 140 'A flat 2': [0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,1], 141 'A 2': [1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,1,1], 142 'B flat 2': [1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 143 'B flat 2 (bis)': [1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1,0,1,0,1,1], 144 'B 2': [1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 145 'C 3 (bis)': [1,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 146 'C 3': [1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1,0,1,1], 147 'D flat 3': [1,0,0,0,0,0,0,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], # all keys up + register key 148 'D 3': [1,0,0,0,0,0,1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 149 'E flat 3': [1,0,0,0,0,1,1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 150 'E 3 (palm)': [1,0,0,0,1,1,1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 151 'E 3 (front)': [1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1], 152 'F 3 (palm)': [1,0,1,0,1,1,1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1], 153 'F 3 (front)': [1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,1], 154 'G flat 3 (palm)':[1,1,1,0,1,1,1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1] } 155 156 SelmerSerieII = Instrument( 157 'Selmer serie II', _Saxophone, UnflangedOpenEnd(_D_BELL_OUT), 158 _ToneHoles, _Fingerings) 159 160 Selmer_wo_holes = Instrument( 161 'Selmer serie II w/o toneholes', _Saxophone, 162 UnflangedOpenEnd(_D_BELL_OUT)) 163