def create_riff_1():
    '''Create tick list'''

    PATTERN_LENGTH = 256
    steps = [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30]
    phrase_length = 32

    repeats = int(PATTERN_LENGTH / phrase_length)
    expanded_tick_sequence = []

    nominal_tick_position = 0
    for repeat in range(repeats):
        for entry in steps:
            expanded_tick_sequence.append(entry + nominal_tick_position)
        nominal_tick_position += 32

    for tick_event in expanded_tick_sequence:
        if tick_event >= 0:
            notes = from_chord(["C-3", "E-3", "B-3", "G-2"])
        if tick_event >= 64:
            notes = from_chord(["D-3", "F#3", "B-3", "G-3"])
        if tick_event >= 128:
            notes = from_chord(["C#3", "E-3", "B-3", "A-2"])
        if tick_event >= 176:
            notes = from_chord(["C#3", "Eb3", "F#3", "Bb3"])
        if tick_event >= 208:
            notes = from_chord(["C#3", "F-3", "F#3", "Bb3"])

        for track, note in enumerate(notes):
            pattern.insert_value(chordnoteplug.get_id(), 2, track, 0,
                                 tick_event, note, 0)
            pattern.insert_value(chordnoteplug.get_id(), 2, track, 0,
                                 tick_event + 1, to_note("off"), 0)  # note off

    app_wait(6)
def create_riff_1():
    '''Create tick list'''
    
    PATTERN_LENGTH = 256
    steps = [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30]
    phrase_length = 32

    repeats = int(PATTERN_LENGTH / phrase_length)
    expanded_tick_sequence = []

    nominal_tick_position = 0
    for repeat in range(repeats):
        for entry in steps:
            expanded_tick_sequence.append(entry + nominal_tick_position)
        nominal_tick_position += 32

    for tick_event in expanded_tick_sequence:
      if tick_event >= 0:
        notes = from_chord(["C-3", "E-3", "B-3", "G-2"])
      if tick_event >= 64:
        notes = from_chord(["D-3", "F#3", "B-3", "G-3"])
      if tick_event >= 128:
        notes = from_chord(["C#3", "E-3", "B-3", "A-2"])
      if tick_event >= 176:
        notes = from_chord(["C#3", "Eb3", "F#3", "Bb3"])
      if tick_event >= 208:
        notes = from_chord(["C#3", "F-3", "F#3", "Bb3"])

      for track, note in enumerate(notes):
        pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, tick_event, note, 0)
        pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, tick_event+1, to_note("off"), 0) # note off
      
    app_wait(6)
samples_pattern = create_new_pattern(sample_format, "Samples", PATTERN_LENGTH)

# Load a sample
cur_path = os.getcwd()
file_and_path = os.path.join(cur_path, "Samples", "HHCD4.WAV")
target = player.get_wave(0)
doc.import_wave(file_and_path, target)



# fill the stab pattern
tick_list = get_tick_triggers()
synthID = synth.get_id()
for tick_event in range(PATTERN_LENGTH):
    if tick_event in tick_list:
        notes = from_chord(["C-3", "E-3", "B-3", "G-2"])
        for track, note in enumerate(notes):
            stabs_pattern.insert_value(synthID, 2, track, 0, tick_event, note, 0)
            stabs_pattern.insert_value(synthID, 2, track, 0, tick_event+1, to_note("off"), 0) # note off
player.history_commit(0, 0, "Filled Stabs Pattern")


# fill the kick pattern
for tick_event in range(0, PATTERN_LENGTH, 8):
    kick_pattern.insert_value(kicksynth.get_id(), 2, 0, 0, tick_event, 1, 0)


# add stabs to the first track of the sequence_pattern, assumes presence of one track.
seq_plug = player.get_plugin_by_name("Pattern")
sequence_pattern = player.get_pattern_by_name("00")
sequence_pattern.insert_value(seq_plug.get_id(), 2, 0, 0, 0, stabs_pattern.get_id(), 0)
Example #4
0
kick_pattern = create_new_pattern(kick_format, "Kicks", PATTERN_LENGTH)
samples_pattern = create_new_pattern(sample_format, "Samples", PATTERN_LENGTH)

# Load a sample
cur_path = os.getcwd()
file_and_path = os.path.join(cur_path, "Samples", "Carilon_HHC.wav")
target = player.get_wave(0)
doc.import_wave(file_and_path, target)
''' F i l l i n g   P a t t e r n s '''

# fill the stab pattern
tick_list = get_tick_triggers()
synthID = synth.get_id()
for tick_event in range(PATTERN_LENGTH):
    if tick_event in tick_list:
        notes = from_chord(["C-3", "E-3", "B-3", "G-2"])
        for track, note in enumerate(notes):
            stabs_pattern.insert_value(synthID, 2, track, 0, tick_event, note,
                                       0)
            stabs_pattern.insert_value(synthID, 2, track, 0, tick_event + 1,
                                       to_note("off"), 0)
player.history_commit(0, 0, "Filled Stabs Pattern")

# fill the kick pattern
for tick_event in range(0, PATTERN_LENGTH, 8):
    kick_pattern.insert_value(kicksynth.get_id(), 2, 0, 0, tick_event, 1, 0)

# fill the samples pattern, // TODO maybe set active wave table slot instead..
sample_slot = 1  # 01
for tick_event in range(4, PATTERN_LENGTH, 8):
    samples_pattern.insert_value(matilde_one.get_id(), 2, 0, 0, tick_event,
app_wait(1)

# vestigial
n = int(PATTERN_LENGTH/4) - 1
t = 2+n*4


# Stabbed chords
steps = [0, 3, 7, 11, 14]
length = 16
n = 0 
while True:
  if t > PATTERN_LENGTH-1:
    break
  if n%48>36:
 	notes = from_chord(["C-3", "E-3", "B-3"])
  else: 
    notes = from_chord(["D-3", "F#3", "B-3"])

  t = int(n/len(steps))*length+steps[n % len(steps)]
  for track, note in enumerate(notes):
    pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, t, note, 0)
    pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, t+1, armstrong.zzub_note_value_off, 0) # note off
  n += 1
app_wait(6)


# Loop and tidy
pattern.set_loop_start(0)
pattern.set_loop_end(PATTERN_LENGTH)
pattern.set_loop_enabled(1)
# calculate real delay - but you should use multiple timesources. but look at meeeeee......
app_wait(1)

# vestigial
n = int(PATTERN_LENGTH / 4) - 1
t = 2 + n * 4

# Stabbed chords
steps = [0, 3, 7, 11, 14]
length = 16
n = 0
while True:
    if t > PATTERN_LENGTH - 1:
        break
    if n % 48 > 36:
        notes = from_chord(["C-3", "E-3", "B-3"])
    else:
        notes = from_chord(["D-3", "F#3", "B-3"])

    t = int(n / len(steps)) * length + steps[n % len(steps)]
    for track, note in enumerate(notes):
        pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, t, note, 0)
        pattern.insert_value(chordnoteplug.get_id(), 2, track, 0, t + 1,
                             armstrong.zzub_note_value_off, 0)  # note off
    n += 1
app_wait(6)

# Loop and tidy
pattern.set_loop_start(0)
pattern.set_loop_end(PATTERN_LENGTH)
pattern.set_loop_enabled(1)