Main Page       Index


morag.lsp


 morag.lsp
 Version 1.00 	29 April 2005
 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

 An fm instrument using two cross mixed modulators and a single carrier. 
 The name Morag is after a character in Magnus Mills "The restraint of
 beast".


function

morag

 (morag step dur [:rc][:r1][:r2][:i][:lf1][:lf2][:rho1][:rho2][:env][:menv][:fm][:pms][:lftab])
 An fm nstrument with two LFO controlled modulators and a single carrier. 

 step   - MIDI step.
 dur    - Flonum. Tones duration in seconds.
 :rc    - Flonum. Carrier frequency ratio, default 1.000
 :r1    - Flonum. Modulator 1 frequency ratio, default 1.000
 :r2    - Flonum. Modulator 2 frequency ratio, default 2.000
 :i     - Flonum. Modulation index, default 1.00
 :lf1   - Flonum. LFO 1 frequency, default 0.500 Hz
 :lf2   - Flonum. LFO 2 frequency, default same as LFO1
 :rho1  - Flonum | Symbol. LFO 1 phase, may have numeric value in degrees
          or the symbol 'random. Default 0.
 :rho2  - Flonum | Symbo. LFO 2 phase, may have numeric value in degrees
          or the symbol 'random. Default 90+rho1, if rho1 is numeric, 
          otherwise 'random.
 :env   - Sound. Overall amplitude envelope. Default rectangular "gate".
 :menv  - Sound. Modulator envelope, default same as env.
 :fm    - Sound. External fm source, default silence.
 :pms   - Flonum. Modulation index used for external fm source, default 0.1
 :lftab - Wtab. Lfo wave table, default *tri-table*
 return - Sound.


View the Sourcecode :



;; morag.lsp
;; Version 1.00 	29 April 2005
;; 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
;;
;; An fm instrument using two cross mixed modulators and a single carrier. 
;; The name Morag is after a character in Magnus Mills "The restraint of
;; beast".
;;

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


;; @doc function morag 
;; (morag step dur [:rc][:r1][:r2][:i][:lf1][:lf2][:rho1][:rho2][:env][:menv][:fm][:pms][:lftab])
;; An fm nstrument with two LFO controlled modulators and a single carrier. 
;;
;; step   - MIDI step.
;; dur    - Flonum. Tones duration in seconds.
;; :rc    - Flonum. Carrier frequency ratio, default 1.000
;; :r1    - Flonum. Modulator 1 frequency ratio, default 1.000
;; :r2    - Flonum. Modulator 2 frequency ratio, default 2.000
;; :i     - Flonum. Modulation index, default 1.00
;; :lf1   - Flonum. LFO 1 frequency, default 0.500 Hz
;; :lf2   - Flonum. LFO 2 frequency, default same as LFO1
;; :rho1  - Flonum | Symbol. LFO 1 phase, may have numeric value in degrees
;;          or the symbol 'random. Default 0.
;; :rho2  - Flonum | Symbo. LFO 2 phase, may have numeric value in degrees
;;          or the symbol 'random. Default 90+rho1, if rho1 is numeric, 
;;          otherwise 'random.
;; :env   - Sound. Overall amplitude envelope. Default rectangular "gate".
;; :menv  - Sound. Modulator envelope, default same as env.
;; :fm    - Sound. External fm source, default silence.
;; :pms   - Flonum. Modulation index used for external fm source, default 0.1
;; :lftab - Wtab. Lfo wave table, default *tri-table*
;; return - Sound.
;;

(defun morag (step dur &key rc r1 r2 i lf1 lf2 rho1 rho2 env menv fm pms lftab)
  (let (chz hz1 hz2)
    (setf hz (step-to-hz step))
    (setf chz (* hz (or rc 1.000)))
    (setf hz1 (* hz (or r1 1.000)))
    (setf hz2 (* hz (or r2 2.000)))
    (setf i (or i 1.000))
    (setf lf1 (or lf1 0.500))
    (setf lf2 (or lf2 lf1))
    (setf rho1 (or rho1 0))
    (setf rho2 (or rho2 (if (numberp rho1)(+ rho1 90) 'random)))
    (setf env (or env (rgate dur)))
    (setf menv (or menv env))
    (setf fm (or fm (s-rest dur)))
    (setf pms (or pms 0.1))
    (setf lftab (or lftab *tri-table*))

    (mult (fmosc (hz-to-step chz)
		 (sum (scale (* chz pms) fm)
		      (mult 
		       (scale (* chz i)
			      (sum (mult (fmosc (hz-to-step hz1)
						(scale (* hz1 pms) fm))
					 (lfo lf1 dur lftab (phase rho1)))
				   (mult (fmosc (hz-to-step hz2)
						(scale (* hz2 pms) fm))
					 (lfo lf2 dur lftab (phase rho2)))))
		       menv)))
	  env)))


Main Page       Index