prise en charge des indications de tempo des fichiers musicxml. Si absent, le tempo...
[minwii.git] / src / instruments / Instrument.py
1 '''
2 Created on 15 juil. 2009
3
4 @author: Samuel Benveniste
5 '''
6
7 class Instrument:
8 '''
9 Object representing an instrument.
10
11 notes:
12 The MIDI numbers of the notes played by this instrument (usually a scale)
13 channel:
14 The channel corresponding to the instrument in the synthesizer
15 image:
16 The image for the instrument
17 '''
18
19 def __init__(self, notes, channel, image, octave = 0):
20 '''
21 Constructor
22
23 notes:
24 The MIDI numbers of the notes played by this instrument (usually a scale)
25 channel:
26 The channel corresponding to the instrument in the synthesizer
27 image:
28 The image for the instrument
29 '''
30
31 self.notes = [loop+12*octave for loop in notes]
32 self.octave = octave
33 self.channel = channel
34 self.image = image
35
36 def getNote(self,noteNumber):
37 if noteNumber == None :
38 return(None)
39 else :
40 return(self.notes[noteNumber])
41
42 def getNoteByNoteNumber(self,baseMidiNoteNumber):
43 if baseMidiNoteNumber == None:
44 return(None)
45 else :
46 return(baseMidiNoteNumber+self.octave*12)