Mercurial > hg > jslab
view examples/sound/midi/plinky.scm @ 1:5df24c91468d
Oh my what a mess.
author | samer |
---|---|
date | Fri, 05 Apr 2019 16:26:00 +0100 |
parents | bf79fb79ee13 |
children | b67a33c44de7 |
line wrap: on
line source
(load "midi.scm") (load "streams.scm") (import "samer.maths.random.*") (put "regulated" #t) (put "colormap" (redgreen)) (put "symmetric" #t) (tasks) (define N 64) (define M 64) (define matrix (Matrix. "matrix" M N)) (define out (VVector. "out" N)) (define vgen (VGenerator. "gen")) (define rowcol (RowColumn. matrix)) (define decay (VDouble. "decay" 0.002)) (.setGenerator vgen (Binary.)) ; program 46 is cool! ; so are 10, 12, 111 (define midiin (VVector. "midiin" 64)) (define synth (MidiSynth. midiin)) (define m 0) (addtasks (sub 4 (task (.timesEquals matrix (- 1 (.get decay))) (.add matrix vgen) (.changed matrix) )) (Ops.transfer rowcol midiin) (Ops.update midiin) synth (task (.setRow rowcol m) (set! m (if (< m (- M 1)) (+ m 1) 0)) ) ) (define (load-file fn) (let ((f (ifstream fn))) (.load matrix f) (.close f))) (define (f1) (load-file "walking_zither2")) (define (f2) (load-file "walking_zither3")) (define (f3) (load-file "walking_zither4")) (expose) (expose synth)