# Arpeggio part of Starlight by Muse
@low_range
def arp():
if is_sixteenth_note:
if notes_hit_x("x-x", relative_bar):
note = pick_note(is_ascending=True)
if notes_hit_x("-x-x", relative_bar):
note = pick_note(is_ascending=False)
play(note, release=0.25, velocity=60)
def pick_note(is_ascending):
if previous_note == None:
return root
elif is_ascending:
return get_higher_in_chord(previous_note)
else:
return get_lower_in_chord(previous_note)
def drums():
if notes_hit_x("x--x-x-x", eight_notes):
play(BASS_DRUM)
if is_quarter_note:
play(ACOUSTIC_SNARE)
play(OPEN_HI_HAT)
if is_beginning_of_bar():
play(CRASH_CYMBAL_1)
if notes_hit_x("-x-x", quarter_notes):
play(HAND_CLAP)
def low_intensity_drums():
if bar == 0 and is_beginning_of_bar():
play(BASS_DRUM)
if is_eight_note:
play(RIDE_CYMBAL_1)
@low_range
def bass():
if is_eight_note:
play(root)
chorus_part_1 = (('C#m', 4), ('F#', 4), ('D#', 4), ('G#m', 4), ('A', 4), ('E', 4), ('A', 4), ('D#', 4))
chorus_part_2 = (('G#m', 4), ('D#', 4), ('E', 4), ('B', 4))
chorus_last_part = (('G#m', 4), ('D#', 4), ('E', 4), ('F#7', 4))
PARTS = [
[chorus_part_1, [arp, drums, bass]],
[chorus_part_2, [arp, low_intensity_drums, None]],
[chorus_last_part, [arp, drums, bass]]
]
TRACK_INSTRUMENTS = [Instrument.LEAD_8_BASS_LEAD, Instrument.DRUMS, Instrument.ELECTRIC_BASS_FINGER]
BPM = 122
Pattern Composer
Write code in the editor below and click run when you want to run the code. A midi file will appear
if the code was valid, otherwise an error message is shown. To successfully run the program a valid
song structure object needs to be assigned to the reserved variable PARTS.
To get an overview of syntax and features, look at the docs
here.
NOTE: refreshing the browser will reset the code.
Sound generation and visualization is done with
html-midi-player