;; this file: ;; https://dataswamp.org/~incal/ny/init-incal.lsp ;; ;; Nyquist examples: ;; ~/src/nyquist-3.12+ds/demos/src/examples.lsp (setq qr (/ q 4)) (setq q6 (/ q 6)) (setq q8 (/ q 8)) (autonorm-off) (setq *default-sf-dir* "/home/incal/ny/sf/") (setq *snd-list-devices* nil) (setq *snd-device* 7) (defun load-init () (load "/home/incal/ny/init-incal.lsp") ) (defun midi-note-p (n) (when (and (<= 0 n) (<= n 127) ) t) ) (defun orgel-note-p (n) (when (and (<= 1 n) (<= n 88) ) t) ) (defun piano-note-p (n) (when (and (<= 1 n) (<= n 61) ) t) ) (defun play-midi (n) (when (midi-note-p n) (play (osc n)) )) ;; (play-midi 60) (defun play-midi-orgel (n) (when (orgel-note-p n) (play (osc (+ 20 n))) )) ;; (play-midi-orgel 20) (defun play-midi-piano (n) (when (piano-note-p n) (play (osc (+ 35 n))) )) ;; (play-midi-piano 1) (defun play-midi-interval (beg end) (when (and (midi-note-p beg) (midi-note-p end) (< beg end) ) (do ((n beg (setq n (+ 1 n)))) ((< end n)) (play (osc n)) ))) ;; (play-midi-interval 0 127) (defun wave () (let*((sth (truncate (expt 2.0 11))) (snd (sim (scale (/ i (expt 2.0 1)) (build-harmonic 1 sth)) (scale (/ i (expt 2.0 2)) (build-harmonic 2 sth)) (scale (/ i (expt 2.0 3)) (build-harmonic 3 sth)) (scale (/ i (expt 2.0 4)) (build-harmonic 4 sth)) (scale (/ i (expt 2.0 5)) (build-harmonic 5 sth)) ))) (setq *table* (list snd (hz-to-step 1) t)) )) ;; (wave) ;; (star 6.0) (defun note (pitch &optional dur) (let ((d (or dur q))) (osc pitch d *table*) )) (defun note-env (pitch &optional dur) (mult (note pitch (or dur q)) (env 0.05 0.1 0.5 1.0 0.5 0.4) )) (defun star (&optional s) (let ((s (or s 1))) (play (stretch s (seq (note c3 qr) (note a2 qr) (note a2 i) (note c3 i) (note c3 i) (note g3 i) (note g3 i) (sim (note a3 qr) (note e3 qr) ) (note g3 qr) (note a3 qr) (note g3 q) (note f3 i) (note f3 i) (note e3 i) (note e3 i) (sim (note d3 qr) (note c3 qr) ) (note c3 qr) (note d3 qr) (note c3 i) ))))) ;; (star 1.0) (setq a-snd nil) (defun load-sound () (setq a-snd (s-read "/home/incal/src/nyquist-3.12+ds/demos/audio/demo-snd.aiff")) ) (defun init-load-all () (load-sound) (wave) ) (init-load-all) ;; (play a-snd) ;; (play (seq (cue a-snd) (cue a-snd))) ;; (play (loud 6.0 (sim (at 0.0 (cue a-snd)) (at 0.5 (cue a-snd)))))