Last active
August 29, 2015 14:05
-
-
Save Agnostic/0ca2536acd908d5db056 to your computer and use it in GitHub Desktop.
C Major + Bass with Impromptu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; C Major Chord | |
; By Gilberto Avalos | |
; You need Impromptu to run this script | |
; http://impromptu.moso.com.au/downloads.html | |
; Clear all | |
(au:clear-graph) | |
; Define piano instrument | |
(define piano (au:make-node "aumu" "dls " "appl")) | |
(au:connect-node piano 0 *au:output-node* 0) | |
(au:update-graph) | |
; Variables | |
(define initialNote 48) ; C / Do | |
; Internal Variables | |
(define note initialNote) | |
(define notes 0) | |
; Play function | |
(define play | |
(lambda (base_note bass) | |
; Bass | |
(if (> bass 0) | |
(play-note (now) piano bass 80 15000) | |
) | |
(if (and (= notes 0) (> note base_note) ) | |
(set! note (+ note 1)) | |
) | |
(if (= notes 2) | |
(set! notes -1) | |
) | |
; (print "Play Note" note notes) | |
; Play note | |
(play-note (now) piano note 100 10000) | |
(if (< notes 1) | |
(set! note (+ note 4)) | |
) | |
(if (= notes 1) | |
(set! note (+ note 3)) | |
) | |
(set! notes (+ notes 1)) | |
) | |
) | |
; Tone | |
(define tone 0) | |
; Loop function | |
(define loop | |
(lambda () | |
(define bass 0) | |
; First tone | |
(if (= tone 0) | |
(set! note initialNote) | |
) | |
; Bass 1 | |
(if (= tone 0) | |
(set! bass (- initialNote 12)) | |
) | |
; Second tone | |
(if (= tone 3) | |
(set! note (+ initialNote 2)) | |
) | |
; Bass 2 | |
(if (= tone 3) | |
(set! bass (- (+ initialNote 4) 12)) | |
) | |
; Third tone | |
(if (= tone 6) | |
(set! note (+ initialNote 7)) | |
) | |
; Bass 3 | |
(if (= tone 6) | |
(set! bass (- (+ initialNote 7) 12)) | |
) | |
; Call Play | |
(play note bass) | |
; Increase tone | |
(set! tone (+ tone 1)) | |
; Reset tone to 0 | |
(if (= tone 9) | |
(set! tone 0) | |
) | |
; Calling loop again | |
(callback (+ (now) (* 0.20 *second*)) loop ) | |
) | |
) | |
; Call loop | |
(loop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know why I can't evaluate multiple sentences in the same IF statement.