Exemplo n.º 1
0
def generate_blues_scale(key="C"):
    """Returns an ordered list of the notes of the blues scale in this key. \
For example: if the key is set to 'C', this function will return \
`['C', 'D#', 'F', 'F#', 'G', 'A#']`. \
This function will raise an !NoteFormatError if the key isn't recognised"""

    if not (notes.is_valid_note(key)):
        raise NoteFormatError, "Unrecognised format for key '%s'" % key

    result = []

    fifth_index = notes.fifths.index(key[0])

    result.append(intervals.unison(key))
    result.append(notes.diminish(intervals.third(key, key)))
    result.append(intervals.third(key, key))
    result.append(intervals.fourth(key, key))
    result.append(notes.diminish(intervals.fifth(key, key)))
    result.append(intervals.fifth(key, key))
    result.append(notes.diminish(intervals.seventh(key, key)))

    # Remove redundant #'s and b's from the result
    result = map(notes.remove_redundant_accidentals, result)
    tonic = result.index(notes.remove_redundant_accidentals(key))

    result = result[tonic:] + result[:tonic]

    return result
Exemplo n.º 2
0
def triad(note, key):
    """Return the triad on note in key as a list.

    Examples:
    >>> triad('E', 'C')
    ['E', 'G', 'B']
    >>> triad('E', 'B')
    ['E', 'G#', 'B']
    """
    return [note, intervals.third(note, key), intervals.fifth(note, key)]
Exemplo n.º 3
0
def triad(note, key):
    """Return the triad on note in key as a list.

    Examples:
    >>> triad('E', 'C')
    ['E', 'G', 'B']
    >>> triad('E', 'B')
    ['E', 'G#', 'B']
    """
    return [note, intervals.third(note, key), intervals.fifth(note, key)]
Exemplo n.º 4
0
def get_note_pattern(pattern, key):
    if pattern[0] == 1 :
        note = intervals.unison(key)
    elif pattern[0] == 2 :
        note = intervals.second(key, key)
    elif pattern[0] == 3 :
        note = intervals.third(key, key)
    elif pattern[0] == 4 :
        note = intervals.fourth(key, key)
    elif pattern[0] == 5 :
        note = intervals.fifth(key, key)
    elif pattern[0] == 6 :
        note = intervals.sixth(key, key)
    elif pattern[0] == 7 :
        note = intervals.seventh(key, key)

    if pattern[3] == "bemol":
        note = notes.diminish(note)
    elif pattern[3] == "diese" :
        note = notes.augment(note)
    return note
Exemplo n.º 5
0
'''
Created on Jan 6, 2017

@author: stephenkoh
'''

import mingus.core.intervals as intervals

key = str(input('Please enter a key: '))
note = str(input('Please enter a note: '))
third = intervals.third(note, key)
fifth = intervals.fifth(note, key)
print(note, third, fifth)