Giter VIP home page Giter VIP logo

cl-collider's Introduction

cl-collider

SuperCollider client for CommonLisp.
It support ClozureCL and SBCL.

tutorial video: http://youtu.be/JivNMDUqNQc
live coding demo: https://www.youtube.com/watch?v=xzTH_ZqaFKI

require:

please check version of dependency library.

package: sc

Usage:

Server

(in-package :sc)
(setf *sc-synth-program* "...")  ;; scsynth program path.
(push "..." *sc-plugin-paths*)   ;; scx file's path.
(push "..." *sc-plugin-paths*)   ;; it support extensions
(setf *sc-synthdefs-path* "...") ;; your synthdef file will write here

(defparameter *s* (make-external-server "localhost" :port ... :just-connect-p nil))
(server-boot *s*)
;;....hack music.....
(server-quit *s*)

Synth Definition

(defsynth sine-wave ((note 60))
  (let* ((freq (midicps note))
            (sig (sin-osc.ar [freq (+ freq 2)] 0 .2)))
    (out.ar 0 sig)))

(defparameter *synth* (sine-wave))
(ctrl *synth* :note 72)
(bye *synth*)

Proxy

(proxy :sinesynth
   (sin-osc.ar [440 441] 0 .2))

(proxy :sinesynth
   (with-controls ((lfo-speed 4))
      (sin-osc.ar (* [440 441] (range (lf-pulse.ar [lfo-speed (+ lfo-speed .2)]) 0 1)) 0 .2))
   :fade-time 8.0)

(ctrl (proxy :sinesynth) :lfo-speed 8)
(ctrl (proxy :sinesynth) :gate 0)

Make musical Sequence

(defsynth saw-synth ((note 60) (dur 4.0))
   (let* ((env (env-gen.kr (env [0 .2 0] [(* dur .2) (* dur .8)]) :act :free))
             (freq (midicps note))
    		 (sig (lpf.ar (saw.ar freq env) (* freq 2))))
	  (out.ar 0 [sig sig])))

(defun make-melody (time n &optional (offset 0))
   (when (> n 0)
      (at time (saw-synth :note (+ offset (alexandria:random-elt '(62 65 69 72)))))
      (let ((next-time (+ time (alexandria:random-elt '(0 1 2 1.5)))))
        (callback next-time #'make-melody next-time (- n 1) offset))))

(make-melody (quant 4) 16)
(make-melody (+ 4 (quant 4)) 16 12)

Make Audiofile from Your Sequence

(setf *synth-definition-mode* :load)

;; re-define saw-synth. it's synthdef file write to *sc-synthdefs-path*.
(defsynth saw-synth ((note 60) (dur 4.0))
   (let* ((env (env-gen.kr (env [0 .2 0] [(* dur .2) (* dur .8)]) :act :free))
             (freq (midicps note))
             (sig (lpf.ar (saw.ar freq env) (* freq 2))))
	  (out.ar 0 [sig sig])))

;; redering audio-file.
(with-rendering ("~/Desktop/foo.aiff" :pad 60)
  (make-melody 0.0d0 32)
  (make-melody 8.0d0 32 12)
  (make-melody 16.0d0 32 24))

cl-collider's People

Contributors

byulparan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.