MauriceNorris wrote: ↑Wed Jan 20, 2021 2:59 pm
@torbenscharling
I didn't compile it, no. You don't need to. Ableton does the compiling for you (from the .py file)
I just copied the melodic_pattern.py from the Live 10 to Live 11.
Are you copying the .py or the .pyc file to Ableton 11? If it's the .pyc then this will almost certainly produce an error as this is the file that Ableton 10 has already compiled. Ableton needs to 'see' the .py file and then compile it itself.
You're welcome to use my melodic_pattern.py though if you like? You can download it here:
https://drive.google.com/file/d/1Sm-0Ze ... sp=sharing
Just make sure you backup your original melodic_pattern.pyc (which I'm guessing you already have) and delete the melodic_pattern.pyc script that isn't working for you. If it's working for you (and I can't see any reason it shouldn't) you should just be able to copy the part where you define the scales from your old script into mine.
Hope this helps.
Indeed it does help tremendously !!! THANKS SO MUCH !! This has been bugging the h... out of me cause I couldn't get ableton support on this so I had no idea if I could safely upgrade to 11 and had to do it in time to get the 20% discount so now I got both bases covered so I'm ready for when 11 is released (apart from reading the damn manual lol) anyway thanks again, now I don't have to worry so much about what happened. But just in case anyone has a clue what went wrong (I'm pretty sure I did the same, copying over the .py file) so here it is copy pasted (the one giving me the error consistently):
# uncompyle6 version 3.7.0
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: c:\Jenkins\live\output\Live\win_64_static\Release\python-bundle\MIDI Remote Scripts\pushbase\melodic_pattern.py
# Compiled at: 2020-01-07 14:24:16
from __future__ import absolute_import, print_function, unicode_literals
from ableton.v2.base import NamedTuple, lazy_attribute, memoize, find_if
from . import consts
from .matrix_maps import FEEDBACK_CHANNELS
import Live
CIRCLE_OF_FIFTHS = tuple([ 7 * k % 12 for k in range(12) ])
ROOT_NOTES = CIRCLE_OF_FIFTHS[0:6] + CIRCLE_OF_FIFTHS[-1:5:-1]
NOTE_NAMES = (u'C', u'D\u266d', u'D', u'E\u266d', u'E', u'F', u'G\u266d', u'G', u'A\u266d',
u'A', u'B\u266d', u'B')
def pitch_index_to_string(index):
if 0 <= index < 128:
return NOTE_NAMES[(index % 12)] + str(index / 12 - 2)
return consts.CHAR_ELLIPSIS
class Scale(NamedTuple):
name = ''
notes = []
def to_root_note(self, root_note):
return Scale(name=NOTE_NAMES[root_note], notes=[ root_note + x for x in self.notes ])
@memoize
def scale_for_notes(self, notes):
return [ self.to_root_note(b) for b in notes ]
def __unicode__(self):
return self.name
def __str__(self):
return unicode(self).encode('utf-8')
def __eq__(self, other):
if isinstance(other, Scale):
return self.name == other.name and self.notes == other.notes
return False
EXTRA_SCALES = (
("ionian pentatonic", (0, 4, 5, 7, 11)),
("mixolydian pent.", (0, 4, 5, 7, 10)),
("ritusen", (0, 2, 5, 7, 9)),
("egyptian", (0, 2, 5, 7, 10)),
("neo. major pent.", (0, 4, 5, 6, 10)),
("vietnamese 1", (0, 3, 5, 7,
),
("lydian pentatonic", (0, 4, 6, 7, 11)),
("malkos raga", (0, 3, 5, 8, 10)),
("locrian pentatonic", (0, 3, 5, 6, 10)),
("minor six pent.", (0, 3, 5, 7, 9)),
("flat six pent.", (0, 2, 4, 7,
),
("scriabin", (0, 1, 4, 7, 9)),
("whole tone pent.", (0, 4, 6, 8, 10)),
("lydian #5P pent.", (0, 4, 6, 8, 11)),
("lydian dom. pent.", (0, 4, 6, 7, 10)),
("minor #7M pent.", (0, 3, 5, 7, 11)),
("sup. locrian pent.", (0, 3, 4, 6, 10)),
("minor hexatonic", (0, 2, 3, 5, 7, 11)),
("augmented", (0, 3, 4, 7, 8, 11)),
("major blues", (0, 2, 3, 4, 7, 9)),
("piongio", (0, 2, 5, 7, 9, 10)),
("prometheus neo.", (0, 1, 4, 6, 9, 10)),
("prometheus", (0, 2, 4, 6, 9, 10)),
("mystery #1", (0, 1, 4, 6, 8, 10)),
("6-tone symmetric", (0, 1, 4, 5, 8, 9)),
("locrian major", (0, 2, 4, 5, 6, 8, 10)),
("dbl. harm. lydian", (0, 1, 4, 6, 7, 8, 11)),
("locrian #2", (0, 2, 3, 5, 6, 8, 10)),
("mixolydian b6", (0, 2, 4, 5, 7, 8, 10)),
("dorian b2", (0, 1, 3, 5, 7, 9, 10)),
("ultralocrian", (0, 1, 3, 4, 6, 8, 9)),
("locrian 6", (0, 1, 3, 5, 6, 9, 10)),
("augmented hep.", (0, 3, 4, 5, 7, 8, 11)),
("lydian diminished", (0, 2, 3, 6, 7, 9, 11)),
("lead. whole tone", (0, 2, 4, 6, 8, 10, 11)),
("lydian minor", (0, 2, 4, 6, 7, 8, 10)),
("balinese", (0, 1, 3, 5, 7, 8, 11)),
("neopolitan major", (0, 1, 3, 5, 7, 9, 11)),
("hungarian major", (0, 3, 4, 6, 7, 9, 10)),
("oriental", (0, 1, 4, 5, 6, 9, 10)),
("flamenco", (0, 1, 3, 4, 6, 7, 10)),
("todi raga", (0, 1, 3, 6, 7, 8, 11)),
("persian", (0, 1, 4, 5, 6, 8, 11)),
("enigmatic", (0, 1, 4, 6, 8, 10, 11)),
("major augmented", (0, 2, 4, 5, 8, 9, 11)),
("lydian #9", (0, 3, 4, 6, 7, 9, 11)),
("purvi raga", (0, 1, 4, 5, 6, 7, 8, 11)),
("spanish hept.", (0, 1, 3, 4, 5, 7, 8, 10)),
("bebop", (0, 2, 4, 5, 7, 9, 10, 11)),
("bebop minor", (0, 2, 3, 4, 5, 7, 9, 10)),
("bebop major", (0, 2, 4, 5, 7, 8, 9, 11)),
("bebop locrian", (0, 1, 3, 5, 6, 7, 8, 10)),
("minor bebop", (0, 2, 3, 5, 7, 8, 10, 11)),
("ichikosucho", (0, 2, 4, 5, 6, 7, 9, 11)),
("minor six dim.", (0, 2, 3, 5, 7, 8, 9, 11)),
("kafi raga", (0, 3, 4, 5, 7, 9, 10, 11)),
("composite blues", (0, 2, 3, 4, 5, 6, 7, 9, 10))
)
SCALES = tuple([ Scale(name=x[0], notes=x[1]) for x in Live.Song.get_all_scales_ordered() + EXTRA_SCALES ])
def scale_by_name(name):
return find_if(lambda m: m.name == name, SCALES)
class NoteInfo(NamedTuple):
index = None
channel = 0
color = 'NoteInvalid'
class MelodicPattern(NamedTuple):
steps = [
0, 0]
scale = range(12)
root_note = 0
origin = [0, 0]
chromatic_mode = False
width = None
height = None
@lazy_attribute
def extended_scale(self):
if self.chromatic_mode:
first_note = self.scale[0]
return range(first_note, first_note + 12)
else:
return self.scale
@property
def is_aligned(self):
return not self.origin[0] and not self.origin[1] and abs(self.root_note) % 12 == self.extended_scale[0]
def note(self, x, y):
if not self._boundary_reached(x, y):
channel = y % len(FEEDBACK_CHANNELS) + FEEDBACK_CHANNELS[0]
return self._get_note_info(self._octave_and_note(x, y), self.root_note, channel)
return NoteInfo()
def __getitem__(self, i):
root_note = self.root_note
if root_note <= -12:
root_note = 0 if self.is_aligned else -12
return self._get_note_info(self._octave_and_note_linear(i), root_note)
def _boundary_reached(self, x, y):
return self.width is not None and x >= self.width or self.height is not None and y >= self.height
def _octave_and_note_by_index(self, index):
scale = self.extended_scale
scale_size = len(scale)
octave = index / scale_size
note = scale[(index % scale_size)]
return (octave, note)
def _octave_and_note(self, x, y):
index = self.steps[0] * (self.origin[0] + x) + self.steps[1] * (self.origin[1] + y)
return self._octave_and_note_by_index(index)
def _color_for_note(self, note):
if note == self.scale[0]:
return 'NoteBase'
else:
if note in self.scale:
return 'NoteScale'
return 'NoteNotScale'
def _get_note_info(self, (octave, note), root_note, channel=0):
note_index = 12 * octave + note + root_note
if 0 <= note_index <= 127:
return NoteInfo(index=note_index, channel=channel, color=self._color_for_note(note))
else:
return NoteInfo()
def _octave_and_note_linear(self, i):
origin = self.origin[0] or self.origin[1]
index = origin + i
return self._octave_and_note_by_index(index)