Esempio n. 1
0
def getNextNote(melody, beat, scale, chords, bar): #gives a note
	global lastInterval
	beat = int(beat)#just making sure there is not a value like 3.0
	if (melody.getLastNote() == None):
		return scale[chords[beat/bar]]
	else:
		while True: #remove this, and you will get worse dissonances
			interval = probabilities.getInterval(lastInterval)
			note = melody.getLastNote() + interval
			lastInterval = interval
			if (beat/bar < len(chords)):
				difference = abs(note-scale[chords[beat/bar]])
			else:	
				difference = 0 #this is just stupid, but is not used anymore
			if (note%1200 in scale and note > -1000 and note < 3000 and difference != 100 and difference != 200 and difference != 600 and difference != 1100):
				return note
Esempio n. 2
0
def getNextNote(melody, beat, scale, chords, bar):  #gives a note
    global lastInterval
    beat = int(beat)  #just making sure there is not a value like 3.0
    if (melody.getLastNote() == None):
        return scale[chords[beat / bar]]
    else:
        while True:  #remove this, and you will get worse dissonances
            interval = probabilities.getInterval(lastInterval)
            note = melody.getLastNote() + interval
            lastInterval = interval
            if (beat / bar < len(chords)):
                difference = abs(note - scale[chords[beat / bar]])
            else:
                difference = 0  #this is just stupid, but is not used anymore
            if (note % 1200 in scale and note > -1000 and note < 3000
                    and difference != 100 and difference != 200
                    and difference != 600 and difference != 1100):
                return note
Esempio n. 3
0
def generateTheme(bar, length, scale, chords):#does not use all info at the moment
	global lastInterval
	theme = []
	space = length
	lastnote = 0
	note = 0
	while (space > 0):
		if (theme == []):
			rythm = 0
			lastnote = scale[0]
		else:
			rythm = probabilities.getRythm(space, theme[-1][0])
			lastnote = theme[-1][1]
		space = space - rythm
		while True:
			interval = probabilities.getInterval(lastInterval)
			note = lastnote + interval
			lastInterval = interval
			if (note%1200 in scale and note > -1000 and note < 3000):
				break
		theme.append([rythm, note])
		lastnote = note
	return theme
Esempio n. 4
0
def generateTheme(bar, length, scale,
                  chords):  #does not use all info at the moment
    global lastInterval
    theme = []
    space = length
    lastnote = 0
    note = 0
    while (space > 0):
        if (theme == []):
            rythm = 0
            lastnote = scale[0]
        else:
            rythm = probabilities.getRythm(space, theme[-1][0])
            lastnote = theme[-1][1]
        space = space - rythm
        while True:
            interval = probabilities.getInterval(lastInterval)
            note = lastnote + interval
            lastInterval = interval
            if (note % 1200 in scale and note > -1000 and note < 3000):
                break
        theme.append([rythm, note])
        lastnote = note
    return theme