( -*-forth-*- ) ( a sequencer-like application for mole you need creb to run the pd patch this is a single instance version using global send symbols. replace sending words with outlet words if you need multiple instances ) loading.sequencer .s floats ( use floating point numbers ) sd def-bang>thing sd ( controls ) hh def-float>thing hh-accent ( accent -- ) bd-vol def-float>thing bd-vol ( vol -- ) sd-vol def-float>thing sd-vol ( vol -- ) hh-vol def-float>thing hh-vol ( vol -- ) hh-magic def-float>thing hh-magic ( magic.number -- ) bass-freq def-float>thing bass-freq 16 queue tasks ( create a queue to hold a maximum of 16 sequencer tasks ) tasks def-rr-yield yield ( task swapper ) tasks def-rr-start make-task ( task creator ) : task [i] 16 make-task ; ( default stacksize of 16 cells ) ( some 1 tick events ) : bd 80 bd-vol yield ; : bd' 90 bd-vol yield ; : hh 0 hh-accent yield ; : hh' 1 hh-accent yield ; : _ postpone yield ; immediate ( start a pattern ) : start-pattern ( xt -- ) here >r enter-comma ( compile loop wrapper ) postpone begin comma postpone again r> task ; ( start task ) ( install timer ) variable tick-period 67.5 tick-period ! ( 32 ticks / measure - 120 bpm ) : bpm [ 1000 60 * 8 / ]L swap / tick-period ! ; : tick yield tick-period @ timer! ; tick : empty [s] sequencer.protected .s ; : reload tasks queue.reset ( remove dangling pointers ) [s] task.queue.cleared .s [s] empty lookup execute mark load ; reload patterns