Skip to content

Instantly share code, notes, and snippets.

@Agnostic
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Agnostic/0ca2536acd908d5db056 to your computer and use it in GitHub Desktop.
Save Agnostic/0ca2536acd908d5db056 to your computer and use it in GitHub Desktop.
C Major + Bass with Impromptu
; 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)
@Agnostic
Copy link
Author

Agnostic commented Aug 8, 2014

I don't know why I can't evaluate multiple sentences in the same IF statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment