55 lines
1.6 KiB
Common Lisp
55 lines
1.6 KiB
Common Lisp
;; https://defaultxr.github.io/cl-collider-tutorial/02-getting-started.html
|
|
|
|
(ql:quickload :cl-collider)
|
|
(in-package :sc-user)
|
|
|
|
(setf *s* (make-external-server "localhost" :port 4444))
|
|
(server-boot *s*) ; already in use
|
|
|
|
|
|
;;; https://defaultxr.github.io/cl-collider-tutorial/03-make-a-sound.html
|
|
(proxy :foo (sin-osc.ar 440 0 0.2)) ; no error, but hear no sound
|
|
;; opened QjackCtl, connected Graph SuperCollider to Air by Aftershokz left
|
|
(proxy :foo (sin-osc.ar 300 0 0.2))
|
|
(proxy :foo (saw.ar 300 0.2))
|
|
|
|
(proxy :foo (saw.ar (sin-osc.kr 0.5 0 150 300) 0.2))
|
|
|
|
(proxy :foo (saw.ar (mouse-y.kr 20 10000 :exponential) 0.2))
|
|
|
|
(proxy :foo ())
|
|
|
|
|
|
;; lets go to 4th
|
|
;; https://defaultxr.github.io/cl-collider-tutorial/04-further-soundmaking.html
|
|
;;
|
|
(defsynth drum ((freq 3000))
|
|
(let* ((env (env-gen.ar (perc 0.001 0.1) :act :free))
|
|
(sig (lpf.ar (white-noise.ar) (* freq env))))
|
|
(out.ar 0 (pan2.ar sig 0 0.2))))
|
|
|
|
(synth 'drum :freq 3000)
|
|
(synth 'drum :freq 400)
|
|
|
|
;; 5th is about using .wav files as samples for synthesizers
|
|
|
|
;; 6th is about doing sequenses
|
|
(defsynth simple ((gate 1) (freq 440) (pan 0) (amp 0.5))
|
|
(let* ((env (env-gen.kr (asr 0.01 1 0.1) :gate gate :act :free))
|
|
(sig (sin-osc.ar freq 0 0.2)))
|
|
(out.ar 0 (pan2.ar sig pan (* env amp)))))
|
|
|
|
|
|
(defun testing ()
|
|
(let ((syn (synth 'simple :freq (midicps (+ 30 (random 40))))))
|
|
(callback (+ (now) 0.7) #'release syn))
|
|
(callback (+ (now) 1) #'testing))
|
|
|
|
(testing)
|
|
(defun testing ()
|
|
nil)
|
|
|
|
;;; and here's link to cl-patterns
|
|
;; well, let's go do guide for pl-patterns then?
|
|
;; since they'd need setup or something as well
|