The beat seems erratic

I think I’m not understanding the concept of time in scamp. I expected a simple drum loop but the timing sounds “off”

import random
from scamp import *

s = Session(tempo=120)

drum_kits = ['TR 808', 'Power', 'Standard',]
drums = s.new_part(random.choice(drum_kits))

parts_to_midi = {
    "kick": 36,
    "snare": 38,
    "hihat": 42,
    "open_hihat": 46,
    "ride_cymbal": 51,
    "crash_cymbal": 49,
    "tom": 47,
    "tom_high": 45,
    "tom_mid": 43,
    "tom_low": 41,
    "clap":39,
}

beat = {'kick': [(1, 0.8),  (1, 0.0),  (1, 0.8),  (1, 0.0)], 'snare': [(1, 0.0), (1, 0.6), (1, 0.0), (1, 0.6)], 'hihat': [(0.5, 0.8), (0.5, 0.8),(0.5, 0.8),(0.5, 0.8),(0.5, 0.8),(0.5, 0.8),(0.5, 0.8),(0.5, 0.8)]}

def play_part(inst, part_name):
    this_part = beat[part_name]
    for b in this_part:
        inst.play_note(parts_to_midi[part_name], b[1], b[0])
        
count = 0
while count < 4:
    for part in list(beat.keys()):
        fork(play_part, args=(drums, part))
        
    wait_for_children_to_finish()
    count += 1

What operating system are you on – maybe windows? Anything else that might be relevant? For me it sounds flawless.

yes windows 10 on an older laptop. if it works for you, I’ll try it on a different machine. Thanks for the quick reply.

Paul

Processor Intel(R) Core™ i5-6200U CPU @ 2.30GHz 2.40 GHz
Installed RAM 8.00 GB
System type 64-bit operating system, x64-based processor

It worked on my better machine !! :grinning: