Пример #1
0
    def markScale(self, scaleName, keyName):
        """Mark the scale in the given key.

        scaleName -- a key found in INTERVALS
        keyName -- see: checkNoteName()

        Does not call update(). Raise Exception if either scaleName or keyName
        is unknown. Return None.
        """
        try:
            keyName = self.checkNoteName(keyName)
        except:
            raise Exception('Unknown key name: {}'.format(repr(keyName)))
        intervals = INTERVALS.get(scaleName, None)
        if intervals is None:
            raise Exception('Unknown scale name: {}'.format(repr(scaleName)))
        self.markedNotes = []
        idx = NOTES.index(keyName)
        shiftedNotes = listRot(NOTES, -idx)
        notes = [shiftedNotes[0]]
        i = 0
        for ii in intervals[:-1]:
            i = i + ii
            notes.append(shiftedNotes[i])
        self.markedNotes = []
        for name in notes:
            noteName = self.checkNoteName(name)
            for string, stringNotes in enumerate(self.allNotes):
                for fret, note in enumerate(stringNotes):
                    if note == noteName:
                        self.markedNotes.append((string, fret,
                                                 note == keyName))
Пример #2
0
 def __init__(self, parent=None):
     super(ScaleWidget, self).__init__('Scales', parent)
     keyLabel = QLabel('Key')
     self.keyComboBox = QComboBox()
     for noteName in [ASC2UNI[x] for x in
                      "Ab A A# Bb B C C# Db D D#"
                      " Eb E F F# Gb G G#".split()]:
         self.keyComboBox.addItem(noteName)
     self.scaleListView = QListWidget()
     for scale in sorted(INTERVALS.keys()):
         self.scaleListView.addItem(scale)
     self.scaleListView.setCurrentRow(0)
     vLayout = QVBoxLayout(self)
     hLayout = QHBoxLayout()
     hLayout.addWidget(keyLabel)
     hLayout.addWidget(self.keyComboBox)
     hLayout.addStretch(1)
     vLayout.addLayout(hLayout)
     vLayout.addWidget(self.scaleListView)
     self.setLayout(vLayout)
Пример #3
0
 def __init__(self, parent=None):
     super(ScaleWidget, self).__init__('Scales', parent)
     keyLabel = QLabel('Key')
     self.keyComboBox = QComboBox()
     for noteName in [
             ASC2UNI[x] for x in "Ab A A# Bb B C C# Db D D#"
             " Eb E F F# Gb G G#".split()
     ]:
         self.keyComboBox.addItem(noteName)
     self.scaleListView = QListWidget()
     for scale in sorted(INTERVALS.keys()):
         self.scaleListView.addItem(scale)
     self.scaleListView.setCurrentRow(0)
     vLayout = QVBoxLayout(self)
     hLayout = QHBoxLayout()
     hLayout.addWidget(keyLabel)
     hLayout.addWidget(self.keyComboBox)
     hLayout.addStretch(1)
     vLayout.addLayout(hLayout)
     vLayout.addWidget(self.scaleListView)
     self.setLayout(vLayout)