Main Page       Index


xmix.lsp


 xmix.lsp
 Version 1.00  31 October 2004
 Author  Steven Jones

 Contact jones57@swbell.net include the word "nyquist" in subject line

 The contents of this file are released under the terms of the GNU General
 Public License. See the file LICENSE.txt

 Cross mix between two signals
 See also mxmix.lsp


function

xmix

 (xmix  a b ctrl)
 Return mixture of signals a and b as a function of control ctrl.

 a      - sound. Source signal a
 
 b      - sound. Source signal b

 ctrl   - flonum or sound. The control is either a real number in the
          interval (0,1) or a signal with amplitude over the same 
          interval.. ctrl values outside of this interval are allowed 
          but the result is no loger a "cross-mix", some amplification 
          and phase inversion will occur.

 return - sound.   fn(c) = ac + (1-c)b


View the Sourcecode :



;; xmix.lsp
;; Version 1.00  31 October 2004
;; Author  Steven Jones
;;
;; Contact jones57@swbell.net include the word "nyquist" in subject line
;;
;; The contents of this file are released under the terms of the GNU General
;; Public License. See the file LICENSE.txt
;;
;; Cross mix between two signals
;; See also mxmix.lsp
;;

(provide 'xmix)
(current-file "xmix")


(defun xmix:static (a b ctrl)
  (sum (scale ctrl a)
       (scale (- 1 ctrl) b)))


(defun xmix:dynamic (a b ctrl)
  (sum (mult ctrl a)
       (mult (sum 1 (scale -1 ctrl) b))))


;; @doc function xmix
;; (xmix  a b ctrl)
;; Return mixture of signals a and b as a function of control ctrl.
;;
;; a      - sound. Source signal a
;; 
;; b      - sound. Source signal b
;;
;; ctrl   - flonum or sound. The control is either a real number in the
;;          interval (0,1) or a signal with amplitude over the same 
;;          interval.. ctrl values outside of this interval are allowed 
;;          but the result is no loger a "cross-mix", some amplification 
;;          and phase inversion will occur.
;;
;; return - sound.   fn(c) = ac + (1-c)b
;;

(defun xmix (a b ctrl)
  (if (numberp ctrl)
      (xmix:static a b ctrl)
    (xmix:dynamic a b ctrl)))


Main Page       Index