The notes for the track “Ambient Hypnotic” were generated using python-music-gen
You can view the track @ https://soundcloud.com/blackaura/ambient-hypnotic
The MIDI tracks were imported into Ableton Live and software synthesizers and effects were applied.
'''
pymusicgen1 Project
'''
import sys
sys.path.append('../../')
from midiutil.TrackGen import LoopingArray
from midiutil.MidiGenerator import MidiGenerator
midiGenerator = MidiGenerator(tempo=120)
scale = reduce(
lambda x, y: x + y,
[
[y + (12 * x) + 36 + 12
for y in [0, 2, 0, 7, 10, 7, 0, 8]] for x in range(3)
]
)
chordscale = reduce(
lambda x, y: x + y,
[
[y + (12 * x) + 36
for y in [0, 2, 5, 7, 10, 7, 14, 8]] for x in range(5)
]
)
pos = 0
tracks = {
'00.running notes': {
'notearrays': [
{
'beat': LoopingArray(
[(1, 1), (0.5, 0.5), (1.0, 1.0), (0.5, 0.5), (1.5, 1.5)]
),
'notearray': LoopingArray(
[item for sublist in
[[[scale[(10 + ((x + y))) % len(scale)]] for x in range(10)] for y in range(30)]
for item in sublist]
),
'velocities': LoopingArray(
[100, 90, 110, 70, 80]
)
},
]
},
'01. Chords 1': {
'notearrays': [
{
'beat': LoopingArray(
[(0.5, 0.25), (1.0, 0.5), ]
),
'notearray': LoopingArray(
[
[chordscale[x]] for x in [10, 12, 14, 16]
]
),
'velocities': LoopingArray(
[100]
)
},
{
'beat': LoopingArray(
[(0.5, 0.25), (1.0, 0.5), ]
),
'notearray': LoopingArray(
[
[chordscale[x]] for x in [20, 22, 21]
]
),
'velocities': LoopingArray(
[100]
)
},
{
'beat': LoopingArray(
[(0.5, 0.25), (1.0, 0.5), ]
),
'notearray': LoopingArray(
[
[chordscale[x]] for x in [25, 24, 23, 22, 24]
]
),
'velocities': LoopingArray(
[100]
)
}
],
},
'02. Notes 1': {
'notearrays': [
{
'beat': LoopingArray(
[(4.0, 4.0), (8.0, 8.0), ]
),
'notearray': LoopingArray(
[
[chordscale[x]] for x in [
1, 5, 8, 3, 8, 6, 3, 7, 11, 15,
20, 4, 15, 5, 18, 6, 10, 11, 4
]
]
),
'velocities': LoopingArray(
[127, 110, 106]
)
},
]
},
'03. Notes 2': {
'notearrays': [
{
'beat': LoopingArray(
[
(4.0, 1.0), (2.0, 1.0),
(4.0, 1.0), (4.0, 1.0),
(8.0, 1.0), (2.0, 1.0),
]
),
'notearray': LoopingArray(
[
[chordscale[x + 20]] for x in [
1, 2, 3, 8, 9, 10, 5, 6, 7, 13, 14, 15
]
]
),
'velocities': LoopingArray(
[127, 110, 106]
)
},
]
},
'04. CHORZ': {
'notearrays': [
{
'beat': LoopingArray(
[
(4.0, 4.0), (2.0, 2.0),
(4.0, 4.0), (4.0, 4.0),
(8.0, 8.0), (2.0, 2.0),
]
),
'notearray': LoopingArray(
[
[chordscale[x + 14]] for x in [
0, 4, 8, 3, 7, 11, 13
]
]
),
'velocities': LoopingArray(
[127, 110, 106]
)
},
{
'beat': LoopingArray(
[
(4.0, 4.0), (2.0, 2.0),
(4.0, 4.0), (4.0, 4.0),
(8.0, 8.0), (2.0, 2.0),
]
),
'notearray': LoopingArray(
[
[chordscale[x + 10]] for x in [
0, 4, 8, 3, 7, 11, 13
]
]
),
'velocities': LoopingArray(
[127, 110, 106]
)
},
]
},
}
i = 0
keys = tracks.keys()
keys.sort()
print keys
for track in keys:
print 'processing %s' % track
notearrays = tracks[track]['notearrays']
for n in notearrays:
beat = n['beat']
notearray = n['notearray']
velocities = n['velocities']
midiGenerator.add_track(
i,
pos,
beat=beat,
notes=notearray,
velocities=velocities,
length=1024)
i += 1
midiGenerator.write()
Posts