Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Framework/CSound/CSoundConstants.py
blob: 05a17e7c8930cd5f35c626145e6b58a321d7144f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
from Framework.Constants import Constants
from Framework.CSound.Instrument import Instrument

class CSoundConstants:
    #PATHS
    SOUNDS_DIR = Constants.TAM_TAM_ROOT + "/Resources/Sounds"
    FILES_DIR = Constants.TAM_TAM_ROOT + "/Resources"
    
    #SERVER
    SERVER_ADDRESS = "localhost"
    SERVER_PORT = 40007

    SERVER_REQUIRED = 0

    INIT_ATTEMPTS = 2
    INIT_DELAY = 1.0
    
    #SOUNDS
    
    # animals
    OUNK = "ounk"
    DOG = "dog"
    DUCK = "duck"
    BIRD = "bird"
    CAT = "cat"
    DUCK2 = "duck2"
    HORSE = "horse"
    
    # synthesis
    FM2 = "fm2"

    # melodic percussion
    GAM = "gam"
    GONG = "gong"
    PIANO = "piano"
    RHODES = "rhodes"
    KALIMBA = "kalimba"
    
    # non-melodic percussion
    DRUM1CHINE = "drum1chine"
    DRUM1CRASH = "drum1crash"
    DRUM1FLOORTOM = "drum1floortom"
    DRUM1HARDRIDE = "drum1hardride"
    DRUM1HATPEDAL = "drum1hatpedal"
    DRUM1HATSHOULDER = "drum1hatshoulder"
    DRUM1KICK = "drum1kick"
    DRUM1RIDEBELL = "drum1ridebell"
    DRUM1SNARE = "drum1snare"
    DRUM1SNARESIDESTICK = "drum1snaresidestick"
    DRUM1SPLASH = "drum1splash"
    DRUM1TOM = "drum1tom"
    DRUM1KIT = "drum1kit"

    DRUM2DARBUKADOOM = "drum2darbukadoom"
    DRUM2DARBUKAFINGER = "drum2darbukafinger"
    DRUM2DARBUKAPIED = "drum2darbukapied"
    DRUM2DARBUKAPIEDSOFT = "drum2darbukapiedsoft"
    DRUM2DARBUKAROLL = "drum2darbukaroll"
    DRUM2DARBUKASLAP = "drum2darbukaslap"
    DRUM2DARBUKATAK = "drum2darbukatak"
    DRUM2HATFLANGER = "drum2hatflanger"
    DRUM2HATPIED = "drum2hatpied"

    DRUM2HATPIED2 = "drum2hatpied2"
    DRUM2TAMBOURINEPIED = "drum2tambourinepied"
    DRUM2TAMBOURINEPIEDSOFT = "drum2tambourinepiedsoft"
    DRUM2KIT = "drum2kit"

    DRUM3COWBELL = "drum3cowbell"
    DRUM3COWBELLTIP = "drum3cowbelltip"
    DRUM3CUP = "drum3cup"
    DRUM3DJEMBELOW = "drum3djembelow"
    DRUM3DJEMBEMID = "drum3djembemid"
    DRUM3DJEMBESIDESTICK = "drum3djembesidestick"
    DRUM3DJEMBESLAP = "drum3djembeslap"
    DRUM3DJEMBESTICKMID = "drum3djembestickmid"
    DRUM3METALSTAND = "drum3metalstand"
    DRUM3PEDALPERC = "drum3pedalperc"
    DRUM3RAINSTICK = "drum3rainstick"
    DRUM3TAMBOURINEHIGH = "drum3tambourinehigh"
    DRUM3TAMBOURINELOW = "drum3tambourinelow"
    DRUM3KIT = "drum3kit"

    # weird
    BOTTLE = "bottle"
    CLANG = "clang"
    CLING = "cling"
    DOOR = "door"
    LAUGH = "laugh"
    OW = "ow"
    SHEEP = "sheep"
    TCHIWO = "tchiwo"
    WATER = "water"
    ZAP = "zap"
    DICEINST = "diceinst"
    GUIDICE1 = "guidice1"
    GUIDICE2 = "guidice2"
    GUIDICE3 = "guidice3"
    GUIDICE4 = "guidice4"
    GUIDICE5 = "guidice5"
    GUIDICE6 = "guidice6"
    GUIDICE7 = "guidice7"
    GUIDICE8 = "guidice8"
    GUIDICE9 = "guidice9"
    GUIDICE10 = "guidice10"

    # string
    ACGUIT = "acguit"
    BASSE = "basse"
    GUIT = "guit"
    KOTO = "koto"
    MANDO = "mando"
    SITAR = "sitar"
    VIOLIN = "violin"

    # perc
    MARACAS = "maracas"
    MARIMBA = "marimba"
    TRIANGLE = "triangle"
    
    # wind
    CLARINETTE = "clarinette"
    FLUTE = "flute"
    TRUMPET = 'trumpet'
    VOIX = "voix"
    DIDJERIDU = "didjeridu"
    HARMONICA = "harmonica"
    HARMONIUM = "harmonium"
    OCARINA = "ocarina"
    SAXO = "saxo"
    SHENAI = "shenai"
    TUBA = "tuba"

    # recorded snds
    MIC1 = "mic1"
    MIC2 = "mic2"
    MIC3 = "mic3"
    MIC4 = "mic4"

    # synthLab snds
    LAB1 = "lab1"
    LAB2 = "lab2"
    LAB3 = "lab3"
    LAB4 = "lab4"

    LOW, MID, HIGH, PUNCH = range( 4 )

    # Sounds categories: musicInst, animals, drum, people, electronic, concret, mic
    #INSTRUMENTS ( csound table, csound instrument, register, instrumentClass, category )
    INSTRUMENT_TABLE_OFFSET = 5000
    INST_FREE = 5000
    INST_TIED = 5001
    INST_PERC = 5002
    INST_SIMP = 5003

    INSTRUMENTS = { 
                    OUNK :                    Instrument(  0, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    GAM :                     Instrument(  1, INST_TIED, HIGH, 'melo', 'musicInst', .69388, .7536, .02922 ),
                    GONG :                    Instrument(  2, INST_SIMP, LOW, 'melo', 'musicInst', 0, 0, 0 ),
                    GUIT :                    Instrument(  3, INST_TIED, MID, 'melo', 'musicInst', .08592, .75126, .33571 ),
                    KOTO :                    Instrument(  4, INST_TIED, HIGH, 'melo', 'musicInst', .56523, .70075, .05954 ),
                    CLARINETTE :              Instrument(  5, INST_TIED, MID, 'melo', 'musicInst', .57905, .73319, .04934 ),
                    FLUTE :                   Instrument(  6, INST_TIED, MID, 'melo', 'musicInst', .47169, .53693, .02481 ),
                    MIC1:                     Instrument(  7, INST_TIED, MID, 'melo', 'mic', .1, .9, .1 ),
                    MIC2:                     Instrument(  8, INST_TIED, MID, 'melo', 'mic', .1, .9, .1 ),
                    MIC3:                     Instrument(  9, INST_TIED, MID, 'melo', 'mic', .1, .9, .1 ),
                    MIC4:                     Instrument( 10, INST_TIED, MID, 'melo', 'mic', .1, .9, .1 ),
                    DRUM1HATPEDAL:            Instrument( 11, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1HATSHOULDER:         Instrument( 12, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1HARDRIDE:            Instrument( 13, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1RIDEBELL:            Instrument( 14, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1SNARE:               Instrument( 15, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1SNARESIDESTICK:      Instrument( 16, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1CRASH:               Instrument( 17, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1SPLASH:              Instrument( 18, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1TOM:                 Instrument( 19, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1FLOORTOM:            Instrument( 20, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0),
                    DRUM1CHINE:               Instrument( 21, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM1KICK:                Instrument( 22, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    PIANO:                    Instrument( 23, INST_TIED, MID, 'melo', 'musicInst', 2.39418, 2.53339, .01323 ),
                    DOG:                      Instrument( 24, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    DUCK:                     Instrument( 25, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    DRUM2DARBUKADOOM:         Instrument( 26, INST_SIMP, LOW, 'drum', 'drum', 0, 0 ,0 ),
                    DRUM2DARBUKAPIED:         Instrument( 27, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2DARBUKAPIEDSOFT:     Instrument( 28, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2HATFLANGER:          Instrument( 29, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2DARBUKATAK:          Instrument( 30, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2DARBUKAFINGER:       Instrument( 31, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2DARBUKAROLL:         Instrument( 32, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2DARBUKASLAP:         Instrument( 33, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2HATPIED:             Instrument( 34, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2TAMBOURINEPIED:      Instrument( 35, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2HATPIED2:            Instrument( 36, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM2TAMBOURINEPIEDSOFT:  Instrument( 37, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3COWBELL:             Instrument( 38, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3COWBELLTIP:          Instrument( 39, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0),
                    DRUM3CUP:                 Instrument( 40, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3DJEMBELOW:           Instrument( 41, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3DJEMBEMID:           Instrument( 42, INST_SIMP, HIGH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3DJEMBESIDESTICK:     Instrument( 43, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3DJEMBESLAP:          Instrument( 44, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3DJEMBESTICKMID:      Instrument( 45, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3METALSTAND:          Instrument( 46, INST_SIMP, MID, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3PEDALPERC:           Instrument( 47, INST_SIMP, LOW, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3RAINSTICK:           Instrument( 48, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3TAMBOURINEHIGH:      Instrument( 49, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    DRUM3TAMBOURINELOW:       Instrument( 50, INST_SIMP, PUNCH, 'drum', 'drum', 0, 0, 0 ),
                    HARMONICA:                Instrument( 51, INST_TIED, MID, 'melo', 'electronic', .1531, .19188, .01792 ),
                    FM2:                      Instrument( 52, INST_TIED, MID, 'melo', 'electronic', .43443, .5784, .05127 ),
                    BIRD:                     Instrument( 53, INST_TIED, MID, 'melo', 'animals', .1, 1, .05 ),
                    CAT:                      Instrument( 54, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    DUCK2:                    Instrument( 55, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    BOTTLE:                   Instrument( 56, INST_TIED, MID, 'melo', 'concret', .20532, .41064, .05292 ),
                    CLANG:                    Instrument( 57, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
                    OW:                       Instrument( 58, INST_SIMP, MID, 'melo', 'people', 0, 0, 0 ),
                    SHEEP:                    Instrument( 59, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    WATER:                    Instrument( 60, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
                    ZAP:                      Instrument( 61, INST_TIED, MID, 'melo', 'electronic', .299, .7323, .09895 ),
                    TRUMPET:                  Instrument( 62, INST_TIED, MID, 'melo', 'musicInst', .39934, .45537, .02729),
                    MARACAS:                  Instrument( 63, INST_SIMP, MID, "melo", 'musicInst', 0, 0, 0),
                    MARIMBA:                  Instrument( 64, INST_TIED, MID, "melo", 'musicInst', .7096, .81391, .02425),
                    TRIANGLE:                 Instrument( 65, INST_TIED, MID, "melo", 'musicInst', 1.21002, 1.31805, .01268),
                    LAUGH:                    Instrument( 66, INST_SIMP, MID, 'melo', 'people', 0, 0, 0 ),
                    VOIX:                     Instrument( 67, INST_TIED, MID, 'melo', 'people', .89608, .96092, .02343 ), 
                    CLING:                    Instrument( 68, INST_TIED, MID, 'melo', 'electronic', .09096, .7878, .18026 ),
                    TCHIWO:                   Instrument( 69, INST_TIED, MID, 'melo', 'electronic', .91515, 1.00094, .02122 ),
                    DOOR:                     Instrument( 70, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
                    BASSE :                   Instrument( 71, INST_TIED, MID, 'melo', 'musicInst', .58455, .67433, .03638 ),
                    ACGUIT :                  Instrument( 72, INST_TIED, MID, 'melo', 'musicInst', .58503, .8667, .13699 ),
                    DICEINST :                   Instrument( 73, INST_SIMP, MID, 'melo', 'musicInst', 0, 0, 0 ),
                    DIDJERIDU :               Instrument( 74, INST_TIED, LOW, 'melo', 'musicInst', .55669, 1.73704, .09178 ),
                    HARMONIUM :               Instrument( 75, INST_TIED, MID, 'melo', 'musicInst', .04674, .41073, .18384 ),
                    HORSE :                   Instrument( 76, INST_SIMP, MID, 'melo', 'animals', 0, 0, 0 ),
                    KALIMBA :                 Instrument( 77, INST_TIED, MID, 'melo', 'musicInst', .20751, .30161, .04658 ),
                    MANDO :                   Instrument( 78, INST_TIED, MID, 'melo', 'musicInst', .50167, .54401, .01984 ),
                    OCARINA :                 Instrument( 79, INST_TIED, MID, 'melo', 'musicInst', .12122, .18965, .02205 ),
                    RHODES :                  Instrument( 80, INST_TIED, MID, 'melo', 'musicInst', .65013, .71429, .02205 ),
                    SAXO :                    Instrument( 81, INST_TIED, MID, 'melo', 'musicInst', .53722, .6583, .05264 ),
                    SHENAI :                  Instrument( 82, INST_TIED, MID, 'melo', 'musicInst', .29003, .33072, .00634 ),
                    SITAR :                   Instrument( 83, INST_TIED, MID, 'melo', 'musicInst', .63187, .67882, .01654 ),
                    TUBA :                    Instrument( 84, INST_TIED, LOW, 'melo', 'musicInst', .51063, .58384, .035 ),
                    VIOLIN :                  Instrument( 85, INST_TIED, MID, 'melo', 'musicInst', .55094, .82054, .14498 ),
                    LAB1 :                    Instrument( 86, INST_SIMP, MID, 'melo', 'musicInst', 0, 0, 0 ),
                    LAB2 :                    Instrument( 87, INST_SIMP, MID, 'melo', 'musicInst', 0, 0, 0 ),
                    LAB3 :                    Instrument( 88, INST_SIMP, MID, 'melo', 'musicInst', 0, 0, 0 ),
                    LAB4 :                    Instrument( 89, INST_SIMP, MID, 'melo', 'musicInst', 0, 0, 0 ),
		    GUIDICE1:		      Instrument( 90, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE2:		      Instrument( 91, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE3:		      Instrument( 92, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE4:		      Instrument( 93, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE5:		      Instrument( 94, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE6:		      Instrument( 95, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE7:		      Instrument( 96, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE8:		      Instrument( 97, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE9:		      Instrument( 98, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 ),
		    GUIDICE10:		      Instrument( 99, INST_SIMP, MID, 'melo', 'concret', 0, 0, 0 )}
                    

    DRUM1INSTRUMENTS = {   24 :   DRUM1KICK,
                                                            26 : DRUM1FLOORTOM,
                                                            28 : DRUM1TOM,
                                                            30 : DRUM1CHINE,
                                                            32 : DRUM1SPLASH,  
                                                            34 : DRUM1CRASH,
                                                            36 : DRUM1SNARESIDESTICK,
                                                            38 : DRUM1SNARESIDESTICK,
                                                            40 : DRUM1SNARE,
                                                            42 : DRUM1RIDEBELL,
                                                            44 : DRUM1HARDRIDE,
                                                            46 : DRUM1HATSHOULDER,
                                                            48 : DRUM1HATPEDAL }

    DRUM2INSTRUMENTS = {   24 : DRUM2DARBUKADOOM,
                                                            26 : DRUM2DARBUKAPIED,
                                                            28 : DRUM2DARBUKAPIEDSOFT,
                                                            30 : DRUM2HATFLANGER,
                                                            32 : DRUM2DARBUKATAK,
                                                            34 : DRUM2DARBUKATAK,
                                                            36 : DRUM2DARBUKAFINGER,
                                                            38 : DRUM2DARBUKAROLL,
                                                            40 : DRUM2DARBUKASLAP,
                                                            42 : DRUM2HATPIED,
                                                            44 : DRUM2TAMBOURINEPIED,
                                                            46 : DRUM2HATPIED2,
                                                            48 : DRUM2TAMBOURINEPIEDSOFT } 

    DRUM3INSTRUMENTS = {   24 : DRUM3DJEMBELOW,
                                                            26 : DRUM3PEDALPERC,
                                                            28 : DRUM3DJEMBESLAP,
                                                            30 : DRUM3TAMBOURINEHIGH,
                                                            32 : DRUM3TAMBOURINELOW,
                                                            34 : DRUM3RAINSTICK,
                                                            36 : DRUM3DJEMBEMID,
                                                            38 : DRUM3DJEMBESIDESTICK,
                                                            40 : DRUM3DJEMBESTICKMID,
                                                            42 : DRUM3COWBELL,
                                                            44 : DRUM3COWBELLTIP,
                                                            46 : DRUM3CUP,
                                                            48 : DRUM3METALSTAND }              

    RECORDABLE_INSTRUMENTS = set( [ MIC1, MIC2, MIC3, MIC4 ] )
    RECORDABLE_INSTRUMENT_CSOUND_IDS = {  MIC1 : 7,
                                          MIC2 : 8,
                                          MIC3 : 9,
                                          MIC4 : 10 }

    #COMMANDS
    LOAD_INSTRUMENT_COMMAND = "perf.InputMessage('f%d 0 0 -1 \"%s\" 0 0 0')\n"
    PLAY_NOTE_COMMAND =       "perf.InputMessage('i %d.%d %f %f %f %f %f %f %d %f %f %d %f %f %f %f')\n"
    PLAY_NOTE_COMMAND_MINUS_DELAY =       "perf.InputMessage('i 5777 0.0 0.001 %d.%d %s %f %f %f %f %f %d %f %f %d %f')\n"
    PLAY_NOTE_OFF_COMMAND =   "perf.InputMessage('i %s.%s .2 0.01 1. 0. 0. 0.5 %d 0 0 0 0')\n" % ('%d', '%d', INSTRUMENT_TABLE_OFFSET )
    MIC_RECORDING_COMMAND =   "perf.InputMessage('i5201 0 10 %d')\n"
    UNLOAD_TABLES_COMMAND = "perf.InputMessage('i%d 0 0.1 %d')\n" % (INST_FREE, len(INSTRUMENTS))