Exemplo n.º 1
0
import sys
sys.path.append("../")

from midiutil.TrackGen import LoopingArray
from midiutil.MidiGenerator import MidiGenerator

midiGenerator = MidiGenerator(tempo=120)

x = LoopingArray([5,1,6])
note = 0
scale = []
for _ in range(10):
    scale += [36+note]
    note += x.next()

tracks = {
          'Bass track': {
                         'notearrays': [
                                        {
                                         'beat': LoopingArray([(0.25,1.0)]),
                                         'notearray': LoopingArray([[x] for x in scale],
                                                                   functioniterator=[
                                                                                     ('add',LoopingArray([1,2,3,4,5])),
                                                                                     ('dec',LoopingArray([0,0,1,2])),
                                                                                     ]),
                                         'velocities': LoopingArray([x for x in range(100,110)],
                                                                    functioniterator=[
                                                                                      ('add',LoopingArray([1,2,4,1,3])),
                                                                                     ('dec',LoopingArray([0,7,3,2])),
                                                                                      ])
                                        }
Exemplo n.º 2
0
import sys
sys.path.append("../")

from midiutil.TrackGen import LoopingArray, StaticIterator
from midiutil.MidiGenerator import MidiGenerator
from midiutil.Scales import *

midiGenerator = MidiGenerator()

sc = HARMONIC_MINOR_SCALE
scale = [[x] for x in buildScale(sc, 48, 80)]

l = 3
pos = 0
for k in range(2):
    for i in range(16):
        midiGenerator.add_track(
            0,
            pos,
            beat=LoopingArray([(0.5, 1.0), (0.5, 1.0), (1.0, 2.0),
                               (0.5, 0.5)]),
            notes=LoopingArray(
                scale,
                functioniterator=[
                    ('add', StaticIterator(value=1)),
                    ('mult', LoopingArray([5 + (i), 3 + (i * 2), 2 + (i * 3)]))
                ],
                id='notes'),
            velocities=LoopingArray([100, 90, 110, 70, 80]),
            length=l)
        pos += l
Exemplo n.º 3
0
import sys
sys.path.append("../")

from midiutil.TrackGen import LoopingArray
from midiutil.MidiGenerator import MidiGenerator

midiGenerator = MidiGenerator(tempo=90)

scale = reduce(lambda x, y: x + y,
               [[y + (12 * x) + 36 for y in [0, 7, 14, 8, 10, 7, 8]]
                for x in range(2)])

pos = 0
for base in [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]:
    #base = 10

    tracks = {
        'running notes': {
            'notearrays': [{
                'beat':
                LoopingArray([(1, 1), (0.5, 0.5), (0.25, 0.25), (1.5, 1.5)]),
                'notearray':
                LoopingArray([[scale[(base + (x * 2)) % len(scale)]]
                              for x in range(5)]),
                'velocities':
                LoopingArray([100, 90, 110, 70, 80])
            }, {
                'beat':
                LoopingArray([(0.5, 0.5), (0.25, 0.25), (2.0, 2.0)]),
                'notearray':
                LoopingArray([[scale[(base + (x * 3)) % len(scale)]]
Exemplo n.º 4
0
import sys
sys.path.append("../")

from midiutil.TrackGen import LoopingArray
from midiutil.MidiGenerator import MidiGenerator

midiGenerator = MidiGenerator(tempo=145)

scale = reduce(lambda x, y:x + y, [[36 + y + (12 * (x)) for y in [0, 2, 3, 5, 7, 8, 11]] for x in range (5)])

base = 16

def PatternGenerator(seed, n, reduce_function, max):
	pattern = seed
	for _ in range(n):
		pattern.append(reduce(reduce_function, pattern) % max)
	return pattern[1:]

def GetLoopingArray(base, arr):
	print arr
	return LoopingArray([[scale[(base + x) % len(scale)]] for x in arr])
	

tracks = {
          'Notes 1': {
                         'notearrays': [
                                        {
                                         'beat': LoopingArray([(2,2)]),
                                         'notearray': GetLoopingArray(base, PatternGenerator([1], 10, lambda x, y: x+y, 11)),
                                         'velocities': LoopingArray([100,90,95,70])
                                        }
Exemplo n.º 5
0
import sys
sys.path.append("../")

from midiutil.MidiGenerator import MidiGenerator
from midiutil.Scales import *
from midiutil.TrackGen import *

midiGenerator = MidiGenerator(tempo=105)

sc = HARMONIC_MINOR_SCALE

playable_mscale = [[x] for x in buildScale(sc, 48, 80)]

pos = 0
for y in range(128):
    beat = LoopingArray([(0.25, 0.25)])
    notes = LoopingIndexedArray(playable_mscale,
                                [[z + (y**z)] for z in range(8)])
    velocities = LoopingArray([127])
    length = 4

    midiGenerator.add_track(0,
                            pos,
                            beat=beat,
                            notes=notes,
                            velocities=velocities,
                            length=length)

    notes = LoopingIndexedArray([[x]
                                 for x in buildScale(sc, 48 - 12, 80 - 12)],
                                [1 + (y**1)])