Saturday, June 5, 2021

Essential Drum Patterns

Drum Patterns

Essential Drum Patterns

There are 4 basic Drum Patterns for HipHop. This note shows you how to create them using Python. First go to EarSketch, a platform making beat using Python. Click on Start Coding. Copy the following script and then past it to any file .py. Click run and enjoy your wonderful beat.

from earsketch import *
init()
setTempo(90)

# BASIC PATTERNS
p0 = "----"
p1 = "0---"
p13 = "0-0-"
p4 = "---0"
p3 = "--0-"
hihat = CIARA_SET_PERC_HIHAT_1
snare = OS_SNARE03
kick = IRCA_OS_KICK
vocal = CIARA_SET_VOX_HOOK_1

# ESSENTIAL DRUM PATTERNS FOR HIPHOP
def pattern(k):
    """
    DRUM PATTERN
    """
    fitMedia(vocal, 4, 1, 2)
    hihat_pattern = p13*4
    snare_pattern = (p0+p1)*2
    
    if k==1:
        kick_pattern = (p1+p0)*2
    elif k==2:
        kick_pattern = (p13+p0)*2
    elif k==3:
        kick_pattern = p13+p4+p13+p0
    elif k==4:
        kick_pattern = p13+p4+p3+p0
    else:
        raise ValueError("k must be 1, 2, 3 or 4")

    makeBeat(hihat, 1, 1, hihat_pattern)
    makeBeat(snare, 2, 1, snare_pattern)
    makeBeat(kick, 3, 1, kick_pattern)
 
    
pattern(k=4)


finish()

Popular Posts