LISP code for the piano instrument
;
; FOR PIANO INSTRUMENT:
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13
; Inst start: msr beat div dur: msr beat div Octve PC registral-lyne# Dyn-lvl Spatlztn stereo Artic
; name 0 0 0 1 0 0 5 17 0-5 0-5 0-1 0-5 word
;
;
;
; 14 15 16 17 18
; is-it-drone? cut to start (soundfile-name) (final duration) (rewrite-flag)
; 0-1 or full attack ? in seconds 0-1
;
; (piano 0 0 0 2 0 1 7 14 0 0 3 accent-tenuto 0 cut)
; (piano 0 0 0 1 0 1 5 17 3 0 3 accent-tenuto 0 full "1.0001.aiff" 0.542 1)
; (piano 0 0 0 1 0 1 8 10 4 0 3 bartok-pizz 0 full)
; (piano 0 0 0 1 0 1 7 9 5 0 2 accent-tenuto 0 cut)
; (piano 0 0 0 1 1 4 6 8 0 0 3 accent-tenuto 0 full)
;
;
(setf piano-source-list
; filename att-present release-present duration beg/end of bang- amp
; sustain freq attack-time factor
'(("a3.baboom.aiff" t t 1.197 0.249 0.749 225.2 0.059 0.9)
("aqf6.fade.aiff" () t 0.529 0.2 0.393 843.5 0.098 1.0)
("b1.hit.aiff" t t 2.048 0.329 1.283 58.7 0.040 0.9)
("c4n5.octave.aiff" t t 0.9 0.125 0.671 264.5 0.009 1.1)
("d2.aiff" () t 0.706 0.259 0.345 73.3 0.019 1.1)
("d3.hit.aiff" t () 2.125 0.354 1.094 148.2 0.104 1.0)
("d5.way.out.aiff" t () 2.745 0.11 2.281 588.0 0.008 0.9)
("d5.way.out.octave.aiff" () () 1.339 0.23 1.1 590.0 0.264 0.9)
("e5.hit.aiff" t () 0.379 0.061 0.314 664.0 0.01 1.2)
("eb3.aiff" t t 0.907 0.154 0.528 158.5 0.034 1.1)
("f3.aiff" () () 0.45 0.005 0.442 179.5 0.003 1.0)
("fs5.beating.hit.aiff" t () 0.981 0.140 0.707 744.3 0.039 0.9)
("g3n4.octave.aiff" t t 1.051 0.127 0.7 201.3 0.06 1.2)
("g4.out.aiff" t () 2.573 0.158 2.439 398.4 0.045 1.2)
("gf4.f5.hit.aiff" t () 2.649 0.194 2.433 376.0 0.026 1.2)
))
(defun make-piano (note-number)
(labels
((initialize-note-in-note-list (note-number)
(let ((nll ())
(file-str ()))
(setf nll (length (nth note-number note-list)))
(case nll
; append filename, duration, re-write flag
('16
(setf file-str (princ-to-string (+ note-number (const-frandom 0.0 1.0))))
(setf (nth note-number note-list)
(append (nth note-number note-list)
(list (concatenate 'string file-str ".aiff"))))
(setf (nth note-number note-list)
(append (nth note-number note-list)
(list '0.0)))
(setf (nth note-number note-list)
(append (nth note-number note-list)
(list '0))))
; change re-write flag
('19
(setf (nth piano-rewrite-par (nth note-number note-list)) '0)
(shell (concatenate 'string "rm " (nth piano-filename-par (nth note-number note-list))))
(setf file-str (subseq
(nth piano-filename-par (nth note-number note-list))
0
(- (length (nth piano-filename-par (nth note-number note-list)))
5)))))
file-str)))
;
;
;
(let
((file-str ())
(dynamic '0)
(score-filename ())
(note-spec ())
(this-inst ())
(desired-freq '0.0)
(this-piano-source ())
(desired-dur '0.0)
(stereo-pos '0.0)
(spat-score-name ())
(spat-command ())
(total-dur-of-unspat-note '0.0)
(wet '0.0)
(roomsize '0.0)
(extra-time '0.0)
)
;
;
(setf file-str (initialize-note-in-note-list note-number))
(setf desired-freq
(pitch-to-freq
(nth pitch-octave-par (nth note-number note-list))
(nth pitch-pc-par (nth note-number note-list))))
(setf dynamic (nth pitch-dyn-par (nth note-number note-list)))
; what is the duration in seconds that we asked for
(setf desired-dur (convert-dur-from-mbd-sec
(subseq (nth note-number note-list) pitch-dur-msr-par
(+ pitch-dur-div-par 1))))
; set up cmix score
(setf score-filename (concatenate 'string file-str ".sco"))
(with-open-file (score-file score-filename :direction :output)
;
; make an object instance out of the note
;
(setf note-spec
(if (listp (nth pitch-artic-par (nth note-number note-list)))
; we're going to use extra-params
; if the articulation is a list with extra-parameters like cresc or gliss
(make-instance
(first (nth pitch-artic-par (nth note-number note-list)))
:desired-dur desired-dur
:frequency desired-freq
:dynamic dynamic
:extra-params (nth pitch-artic-par (nth note-number note-list))
:note-number note-number)
; if the articulation is just a word like accent-tenuto or bartok-pizz
(make-instance
(nth pitch-artic-par (nth note-number note-list))
:desired-dur desired-dur
:frequency desired-freq
:dynamic dynamic
:note-number note-number)))
;
(setf this-inst (make-instance 'piano))
(setf total-dur-of-unspat-note (write-cmix-score note-spec this-inst score-file)))
; run CMIX
(shell (concatenate 'string "CMIX < " score-filename))
; remove score file
(shell (concatenate 'string "rm " score-filename))
;
; spatialize. . .
(setf stereo-pos (/ (nth pitch-stereo-par (nth note-number note-list)) '5.0))
(setf spat-score-name (concatenate 'string file-str
".spat.sco"))
(case (nth pitch-spatq-par (nth note-number note-list))
; no spatialization:
('0
; write cmix STEREO score
(with-open-file (spat-score spat-score-name :direction :output)
(format spat-score
"~% rtsetparams(44100, 2) ~%
load(\"STEREO\") ~%
rtinput(\"~a\") ~%
rtoutput(\"~a.spat.aiff\") ~%
STEREO( 0.0, 0.0, ~a, ~a, ~a)~%~%"
; output file,
(concatenate 'string file-str ".aiff")
file-str total-dur-of-unspat-note
(- 1.8 (* 2.0 (abs (- stereo-pos 0.5))))
stereo-pos))
; run it
(shell (concatenate 'string "CMIX < " spat-score-name ))
; remove score-file
(shell (concatenate 'string "rm " spat-score-name ))
; mv file to .aiff
(shell (concatenate 'string "mv " file-str ".spat.aiff" " " file-str ".aiff" )))
;
('1
; yes spatialization:
; if yes,----
; originals are mono, higherish gain facotr with freeverb
; remember spat involves a change of duration: note that.
(setf spat-command (concatenate 'string "freeverbit "
file-str ".aiff "
; roomsize:
(princ-to-string (setf roomsize (const-frandom .4 .7))) " "
; damp:
"0.3 "
; wet:
(princ-to-string (setf wet (const-frandom .3 .5))) " "
; dry:
(princ-to-string (const-frandom .6 .7)) " "
; width:
"3 "
; gain:
".65 "
; extra-time:
(princ-to-string (setf extra-time '0.9))
" dn "
; stereo position:
(princ-to-string (- 1.0 stereo-pos))))
(print spat-command)
(shell spat-command)
; move the rev'd file to the .aiff file
(shell (concatenate 'string "mv "
file-str "_reverbed.aiff " file-str ".aiff")))
;
;
(otherwise (format t "~% you imbecile. Illegal spatialization request in
note number ~a ~%~%" file-str) (bye)))
;
; write exact duration in seconds to note-list
; a 0.0 is already there
(setf (nth piano-dur-par (nth note-number note-list)) (+ extra-time total-dur-of-unspat-note)) )))
;
;
;
;***************************************
;*****************************************
; INSTRUMENT CLASS
;*************************************
;************************************
(defclass piano (inst) ())
;*************************************
;**************************************
; ARTICULATION CLASSES
;**************************************
;***************************************
(defclass accent-tenuto (articulation) ())
(defclass fp (articulation) ())
(defclass tremolo (articulation) ())
(defclass vibrato (articulation) ())
(defclass bartok-pizz (articulation) ())
(defclass nasty-am-tremolo (articulation) ())
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
; AND NOW FOR THE METHODS FOR DIFFERENT ARTICULATIONS
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; PIANO: ACCENT-TENUTO
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note accent-tenuto)
(instr piano)
(score-file t))
(let ((doo-doo ())
(this-piano-source-list ())
(temp-source-list ())
(nof-dups-list (reverse '(1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)))
(desired-freq (frequency note))
(this-piano-source ())
(transp ())
(desired-dur (desired-dur note))
(note-number (note-number note))
(ratio ())
(start '0.0)
(max-body-dur '0.0)
(body-dur '0.0)
(body-inskip '0.0)
(amp '0.0)
(amp-multiplier-by-register '0.0)
(release-data ())
(dur-of-release '0.0)
(pre-release '0.0)
(dur-of-note '0.0)
)
;
;
; sort source-list by proximity to desired-freq
(setf this-piano-source-list
(sort piano-source-list #'
(lambda (elle alla)
(<
(abs (- desired-freq (nth '6 elle)))
(abs (- desired-freq (nth '6 alla)))))))
; duplicate least proximate 1 times, next 2 times, 4 times, etc.
; (1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)
(setf this-piano-source-list
(dotimes (ctr (length this-piano-source-list) temp-source-list)
(setf temp-source-list
(append temp-source-list
(make-list
(nth ctr nof-dups-list)
:initial-element (nth ctr this-piano-source-list))))))
; reduce the list to the first 30 elements
(setf this-piano-source-list
(subseq this-piano-source-list 0 30))
; pick the source piano sound we'll be using here
(setf this-piano-source (getel this-piano-source-list))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100)
rtinput(\"~a\") ~%
rtoutput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (nth '0 this-piano-source))
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
;
(setf amp (nth (dynamic note)
'(.05 .2 .3 .56 .78 .99)))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.0 1.0 .945 .86 .77 .71 .64)))
; multiply by the source-note-loudness-factor
(setf amp (* .96 amp amp-multiplier-by-register
(nth '8 this-piano-source)))
;
; "cut" means start the sound after the attack garbage
; "full" means include the full attack garbage
;
; "extra body" refers to when we need a long duration and
; therefor have to resort to granular synthesis
;
; we'll keep track of data to be used for the "Release" in the list
; called release-data
;
;
; 6 possible procedures:
; cut -- always start at bang-attack-time
; 1 cut + need extra body
; 2 cut + don't need extra body
;
; full -- if attack exists, start there
; 3 full + need extra body
; 4 full + don't need extra body
; if attack does not exist,
; 5 full + need extra body (same procedure as 1 above)
; 6 full + don't need extra body (same procedure as 2 above)
(case (nth piano-attq-par (nth note-number note-list))
('cut
(if (< desired-dur
(/ (- (nth '3 this-piano-source) (nth '7 this-piano-source)) ratio))
;
;*************************************************************************8
; cut + don't need extra body
; write makegen based on time
(progn
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;*************************************************************************
; cut + need extra body
(progn
; first, the attack
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000) (+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom 1.16 1.29)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
;
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) ()))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5))))))))
;
; we have to pass on the PREVIOUS start time. and--- it+(/ body-dur ratio)
;
;
;**************************************************
;**************************************************
;**************************************************
('full
(if (second this-piano-source)
(if (< desired-dur
(/ (nth '3 this-piano-source) ratio))
;*************************************************************************
; full + don't need extra body + attack exist on source
;
; write makegen based on time
(progn
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;
;*************************************************************************
; full + need extra body
(progn
; first, the attack
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
(/ (nth 5 this-piano-source) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom 1.16 1.29)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start of body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (nth '5 this-piano-source) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))
;
;********************************************************************************
;********************************************************************************
; full + attack not exist on source
(if (< desired-dur
(/ (- (nth '3 this-piano-source)
(nth '7 this-piano-source)) ratio))
;*************************************************************************
; full + don't need extra body + attack not exist on source
; write makegen based on time
(progn
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;*************************************************************************
; full + need extra body + attack not exist on source
(progn
; first, the attack
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom 1.16 1.29)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))))
;
;*************************************************************************
;*************************************************************************
;*************************************************************************
;*************************************************************************
(otherwise (format t "lame-ass parameter 14 in note ~a"
(nth 15 (nth note-number note-list))) (bye)))
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
(unless (or (nth '3 release-data) (null (nth '2 this-piano-source)))
; unless release has already been written
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(setf pre-release (* (const-frandom .3 .35) dur-of-release))
; start-time of release = last-end-time - 110% of pre-release
; compensate for ratio
(setf start (- (+ (first release-data) (second release-data))
(* 1.1 (/ pre-release ratio))))
(if (< start 0.0) (setf start 0.0))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(* 1000.0 pre-release)
(* 1000.0 (- (+ pre-release dur-of-release)
(const-frandom .01 .02)))
(* 1000.0 (+ pre-release
dur-of-release)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(- (nth 5 this-piano-source) pre-release)
(/ (+ dur-of-release pre-release) ratio)
amp
transp)
(setf release-data (list start
(/ (+ dur-of-release pre-release) ratio) () )))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))))
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; PIANO: FP
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note fp)
(instr piano)
(score-file t))
(let ((doo-doo ())
(this-piano-source-list ())
(temp-source-list ())
(nof-dups-list (reverse '(1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)))
(desired-freq (frequency note))
(this-piano-source ())
(transp ())
(desired-dur (desired-dur note))
(note-number (note-number note))
(ratio ())
(start '0.0)
(max-body-dur '0.0)
(body-dur '0.0)
(body-inskip '0.0)
(amp '0.0)
(amp-multiplier-by-register '0.0)
(release-data ())
(dur-of-release '0.0)
(pre-release '0.0)
(dur-of-note '0.0)
)
;
;
;
; sort source-list by proximity to desired-freq
(setf this-piano-source-list
(sort piano-source-list #'
(lambda (elle alla)
(<
(abs (- desired-freq (nth '6 elle)))
(abs (- desired-freq (nth '6 alla)))))))
; duplicate least proximate 1 times, next 2 times, 4 times, etc.
; (1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)
(setf this-piano-source-list
(dotimes (ctr (length this-piano-source-list) temp-source-list)
(setf temp-source-list
(append temp-source-list
(make-list
(nth ctr nof-dups-list)
:initial-element (nth ctr this-piano-source-list))))))
; reduce the list to the first 30 elements
(setf this-piano-source-list
(subseq this-piano-source-list 0 30))
; pick the source piano sound we'll be using here
(setf this-piano-source (getel this-piano-source-list))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100)
rtinput(\"~a\") ~%
rtoutput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (nth '0 this-piano-source))
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
;
(setf amp (nth (dynamic note)
'(.05 .2 .3 .56 .78 .99)))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.0 1.0 .945 .86 .77 .71 .64)))
; multiply by the source-note-loudness-factor
(setf amp (* .97 amp amp-multiplier-by-register
(nth '8 this-piano-source)))
;
; "cut" means start the sound after the attack garbage
; "full" means include the full attack garbage
;
; "extra body" refers to when we need a long duration and
; therefor have to resort to granular synthesis
;
; we'll keep track of data to be used for the "Release" in the list
; called release-data
;
;
; 6 possible procedures:
; cut -- always start at bang-attack-time
; 1 cut + need extra body
; 2 cut + don't need extra body
;
; full -- if attack exists, start there
; 3 full + need extra body
; 4 full + don't need extra body
; if attack does not exist,
; 5 full + need extra body (same procedure as 1 above)
; 6 full + don't need extra body (same procedure as 2 above)
(case (nth piano-attq-par (nth note-number note-list))
('cut
(if (< desired-dur
(/ (- (nth '3 this-piano-source)
(nth '7 this-piano-source)) ratio))
;
;*************************************************************************
; cut + don't need extra body
; write makegen based on time
;
(progn
(if (> desired-dur .17)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 25)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;*************************************************************************
; cut + need extra body
(progn
; first, the attack
(if (> (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) .17)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) 1000) (+ 5 (random 25)))
(const-frandom .05 .12)
(* (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000) (+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
;
; now the extra body
;
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .19)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
;
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) ()))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5))))))))
;
; we have to pass on the PREVIOUS start time. and--- it+(/ body-dur ratio)
;
;
;**************************************************
;**************************************************
;**************************************************
('full
(if (second this-piano-source)
(if (< desired-dur
(/ (nth '3 this-piano-source) ratio))
;*************************************************************************
; full + don't need extra body
;
; write makegen based on time
(progn
(if (> desired-dur .185)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 130 (random 20))
(+ 155 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;
;*************************************************************************
; full + need extra body
(progn
; first, the attack
(if (> (/ (nth 5 this-piano-source) ratio) .185)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 130 (random 20))
(+ 155 (random 5))
(const-frandom .05 .12)
(- (* (/ (nth 5 this-piano-source)
ratio) 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* (/ (nth 5 this-piano-source)
ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
(/ (nth 5 this-piano-source) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .19)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start of body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (nth '5 this-piano-source) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))
;
;********************************************************************************
;********************************************************************************
; full + attack not exist on source
(if (< desired-dur
(/ (- (nth '3 this-piano-source) (nth '7 this-piano-source)) ratio))
;*************************************************************************
; full + don't need extra body + attack not exist on source
; write makegen based on time
(progn
(if (> desired-dur .16)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 130 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;*************************************************************************
; full + need extra body + attack not exist on source
(progn
; first, the attack
(if (> (/ (nth 5 this-piano-source) ratio) .16)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* (/ (nth 5 this-piano-source)
ratio) 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* (/ (nth 5 this-piano-source)
ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .19)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))))
;
;*************************************************************************
;*************************************************************************
;*************************************************************************
;*************************************************************************
(otherwise (format t "lame-ass parameter 14 in note ~a"
(nth 15 (nth note-number note-list))) (bye)))
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
(unless (or (nth '3 release-data) (null (nth '2 this-piano-source)))
; unless release has already been written
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(setf pre-release (* (const-frandom .3 .35) dur-of-release))
; start-time of release = last-end-time - 110% of pre-release
; compensate for ratio
(setf start (- (+ (first release-data) (second release-data))
(* 1.1 (/ pre-release ratio))))
(if (< start 0.0) (setf start 0.0))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(* 1000.0 pre-release)
(* 1000.0 (- (+ pre-release dur-of-release)
(const-frandom .01 .02)))
(* 1000.0 (+ pre-release
dur-of-release)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(- (nth 5 this-piano-source) pre-release)
(/ (+ dur-of-release pre-release) ratio)
(* amp (const-frandom .06 .1))
transp)
(setf release-data (list start
(/ (+ dur-of-release pre-release) ratio) () )))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))))
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; PIANO: TREMOLO
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note tremolo)
(instr piano)
(score-file t))
(let ((base-amp '0.0)
(amp-multiplier-by-register '0.0)
(this-piano-source ())
(note-number (note-number note))
(ratio 0.0)
(desired-freq (frequency note))
(transp '0.0)
(dur '0.0)
(inskip '0.0)
(amp '0.0)
(start '0.0)
(desired-dur (desired-dur note))
(dur-of-release '0.0)
(release-data ())
(dur-of-note '0.0)
)
;
;
; for each tremolation, pick either:
; 50 ms in the middle of the note (adjust amp accordingly)
; 100 ms from the bang of the note
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100) ~%
rtoutput(\"~a\") ~%"
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
(setf base-amp
(* .95
(nth (dynamic note)
'(.026 .1 .35 .61 .83 .99))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.1 1.0 .845 .76 .67 .61 .54)))))
;
(loop
; pick the source piano sound we'll be using here
(setf this-piano-source (getel piano-source-list))
; write the filename out:
(format score-file "~%rtinput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (first this-piano-source)))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
(if (< (random 8) 4)
; use 60-100 ms from middle of the note
(prog ()
(setf dur (const-frandom .07 .12))
(if (< (- (nth 5 this-piano-source) (nth 4 this-piano-source))
dur)
(setf dur (- (- (nth 5 this-piano-source) (nth 4 this-piano-source)) 0.03)))
(setf inskip (const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) dur)))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* .65 base-amp (nth '8 this-piano-source)))
; write a makegen to score , a bit less than bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 20 (random 30))
(+ 130 (random 30))
(+ 161 (random 30)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.15 0.3)))))
(setf start (+ start (const-frandom 0.03 0.05))))
; use 90-140 beginning of the note
(prog ()
(setf dur (const-frandom .09 .17))
(setf inskip (nth '7 this-piano-source))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* 0.55 base-amp (nth '8 this-piano-source)))
; write a makegen to score, clearly bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 5 (random 10))
(+ 130 (random 30))
(+ 161 (random 50)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.35 0.5))))))
(setf start (+ start (const-frandom 0.03 0.05)))))
; update start?
(if (> start desired-dur) (return)))
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 10 (random 20))
100
(+ 101 (random 10)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(nth 5 this-piano-source)
dur-of-release
amp
transp)
(setf release-data (list start
(/ (+ dur-of-release) ratio) () ))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))))
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; PIANO: VIBRATO
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note vibrato)
(instr piano)
(score-file t))
(let ((base-amp '0.0)
(amp-multiplier-by-register '0.0)
(this-piano-source ())
(note-number (note-number note))
(ratio 0.0)
(desired-freq (frequency note))
(transp '0.0)
(dur '0.0)
(inskip '0.0)
(amp '0.0)
(start '0.0)
(desired-dur (desired-dur note))
(dur-of-release '0.0)
(release-data ())
(dur-of-note '0.0)
(series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(values ())
(series-countr '0)
(new-series ())
; for use with series:
(trans-fact '0)
)
;
; for each tremolation, pick either:
; 50 ms in the middle of the note (adjust amp accordingly)
; 100 ms from the bang of the note
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100)
rtoutput(\"~a\") ~%"
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
(setf base-amp
(* .95
(nth (dynamic note)
'(.026 .1 .35 .61 .83 .99))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
;
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.1 1.0 .845 .76 .67 .61 .54)))))
;
;
; set up list of TRANS adders/subtractors for vibrato
;
;
; calculate curve of values
; first transpose the series randomly:
(setf trans-fact (random 19))
(setf series
(dolist (elle series new-series)
(setf new-series
(append new-series (list
(mod (+ elle trans-fact) 19))))))
(setf new-series ())
;
; then use it to make values curve:
(dotimes (countr (* desired-dur 50))
(setf values
(append values
; calculates a trans-modifier:
(list (- (* 0.000789474 (nth series-countr series)) 0.007105266))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
;
;
;
(setf series-countr '0)
;
; loop to (granularly) make the note happen:
;
(loop
; pick the source piano sound we'll be using here
(setf this-piano-source (getel piano-source-list))
; write the filename out:
(format score-file "~%rtinput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (first this-piano-source)))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
;
; modify trans factor by current modifier.
(setf transp (+ transp
(nth series-countr values)))
;
(if (< (random 8) 4)
; use 60-100 ms from middle of the note
(prog ()
(setf dur (const-frandom .07 .12))
(if (< (- (nth 5 this-piano-source) (nth 4 this-piano-source))
dur)
(setf dur (- (- (nth 5 this-piano-source) (nth 4 this-piano-source)) 0.03)))
(setf inskip (const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) dur)))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* .65 base-amp (nth '8 this-piano-source)))
; write a makegen to score , a bit less than bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 20 (random 30))
(+ 130 (random 30))
(+ 161 (random 30)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.15 0.3)))))
(setf start (+ start (const-frandom 0.03 0.05))))
; use 90-140 beginning of the note
(prog ()
(setf dur (const-frandom .09 .17))
(setf inskip (nth '7 this-piano-source))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* 0.55 base-amp (nth '8 this-piano-source)))
; write a makegen to score, clearly bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 5 (random 10))
(+ 130 (random 30))
(+ 161 (random 50)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; old:
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.35 0.5))))))
(setf start (+ start (const-frandom 0.03 0.05)))))
; when are we done the loop?
(setf series-countr (+ series-countr 1))
(if (> start desired-dur) (return)))
;
;**************************************************************
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
;**************************************************************
;
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 10 (random 20))
100
(+ 101 (random 10)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(nth 5 this-piano-source)
dur-of-release
amp
transp)
(setf release-data (list start
(/ (+ dur-of-release) ratio) () ))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))))
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;************************** BARTOK-PIZZ ******************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;******************************************************************************
;
;
;
; write a bunch of random beginnings (40 ms of somewhere in the first 70 ms)
; on top of one another.
;
; keep everything the same, but add the above
;
; then write a body at low amplitude
;
;
(defmethod write-cmix-score ((note bartok-pizz)
(instr piano)
(score-file t))
(let ((doo-doo ())
(this-piano-source-list ())
(temp-source-list ())
(nof-dups-list (reverse '(1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)))
(desired-freq (frequency note))
(this-piano-source ())
(transp ())
(desired-dur (desired-dur note))
(note-number (note-number note))
(ratio ())
(start '0.0)
(max-body-dur '0.0)
(body-dur '0.0)
(body-inskip '0.0)
(amp '0.0)
(amp-multiplier-by-register '0.0)
(release-data ())
(dur-of-release '0.0)
(pre-release '0.0)
(dur-of-note '0.0)
)
;
; sort source-list by proximity to desired-freq
(setf this-piano-source-list
(sort piano-source-list #'
(lambda (elle alla)
(<
(abs (- desired-freq (nth '6 elle)))
(abs (- desired-freq (nth '6 alla)))))))
; duplicate least proximate 1 times, next 2 times, 4 times, etc.
; (1 1 1 1 1 2 2 2 2 2 4 4 4 8 8 16)
(setf this-piano-source-list
(dotimes (ctr (length this-piano-source-list) temp-source-list)
(setf temp-source-list
(append temp-source-list
(make-list
(nth ctr nof-dups-list)
:initial-element (nth ctr this-piano-source-list))))))
; reduce the list to the first 30 elements
(setf this-piano-source-list
(subseq this-piano-source-list 0 30))
; pick the source piano sound we'll be using here
(setf this-piano-source (getel this-piano-source-list))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100)
rtinput(\"~a\") ~%
rtoutput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (nth '0 this-piano-source))
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
;
(setf amp (nth (dynamic note)
'(.05 .2 .3 .56 .78 .99)))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.0 1.0 .945 .86 .77 .71 .64)))
; multiply by the source-note-loudness-factor
(setf amp (* .97 amp amp-multiplier-by-register
(nth '8 this-piano-source)))
;
;
;
;
;
;
; this little extra block is where we write the extra noise'n'shit:
;
; first, make a smaller source-list, for the notes that pile up to
; create the "pizz":
;
; sort source-list by proximity to desired-freq
(setf pizz-piano-source-list
(sort piano-source-list #'
(lambda (elle alla)
(<
(abs (- desired-freq (nth '6 elle)))
(abs (- desired-freq (nth '6 alla)))))))
; duplicate to present a good distribution
(setf pizz-piano-source-list
(dotimes (ctr (length pizz-piano-source-list) temp-source-list)
(setf temp-source-list
(append temp-source-list
(make-list
(nth ctr (reverse '(1 1 1 1 1 2 2 2 2 2 2 2 2 2 4 4 4 4 4)))
:initial-element (nth ctr pizz-piano-source-list))))))
; reduce the list to the first 30 elements
(setf pizz-piano-source-list
(subseq pizz-piano-source-list 0 30))
;
;
;
;
(dotimes (countaa (+ 5 (random 15)))
(format score-file "rtinput(\"~a\") ~%
makegen(1, 24, 3000, 0, 0, ~a, 1, ~a, 1, ~a, 0) ~%~%
TRANS(0, ~a, ~a, ~a, ~a, 0, 0) ~%~%
~%"
; the file
(concatenate 'string piano-notes-directory
(first (nth (random (length pizz-piano-source-list)) pizz-piano-source-list)))
; for the makegen curve
(+ 4 (random 4))
(+ 34 (random 7))
(+ 43 (random 18))
; inskip
(random 0.025)
; duration
(+ .02 (random .05))
; amplitude
(* .25 (nth (dynamic note)
'(.1 .25 .36 .58 .85 .99)))
; transp
(random .15)))
;
;
;
;
;
; reset the rtinput file:
(format score-file "rtinput(\"~a\") ~%~%"
(concatenate 'string piano-notes-directory (nth '0 this-piano-source)))
;
; lower the amplitudes of the body.
;
;
; "cut" means start the sound after the attack garbage
; "full" means include the full attack garbage
;
; "extra body" refers to when we need a long duration and
; therefor have to resort to granular synthesis
;
; we'll keep track of data to be used for the "Release" in the list
; called release-data
;
;
; 6 possible procedures:
; cut -- always start at bang-attack-time
; 1 cut + need extra body
; 2 cut + don't need extra body
;
; full -- if attack exists, start there
; 3 full + need extra body
; 4 full + don't need extra body
; if attack does not exist,
; 5 full + need extra body (same procedure as 1 above)
; 6 full + don't need extra body (same procedure as 2 above)
(case (nth piano-attq-par (nth note-number note-list))
('cut
(if (< desired-dur
(/ (- (nth '3 this-piano-source)
(nth '7 this-piano-source)) ratio))
;
;*************************************************************************
; cut + don't need extra body
; write makegen based on time
;
(progn
(if (> desired-dur .17)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 25)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;*************************************************************************
; cut + need extra body
(progn
; first, the attack
(if (> (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) .17)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) 1000) (+ 5 (random 25)))
(const-frandom .05 .12)
(* (/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000) (+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
;
; now the extra body
;
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .09)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
;
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) ()))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5))))))))
;
; we have to pass on the PREVIOUS start time. and--- it+(/ body-dur ratio)
;
;
;**************************************************
;**************************************************
;**************************************************
('full
(if (second this-piano-source)
(if (< desired-dur
(/ (nth '3 this-piano-source) ratio))
;*************************************************************************
; full + don't need extra body
;
; write makegen based on time
(progn
(if (> desired-dur .185)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 130 (random 20))
(+ 155 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;
;*************************************************************************
; full + need extra body
(progn
; first, the attack
(if (> (/ (nth 5 this-piano-source) ratio) .185)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 130 (random 20))
(+ 155 (random 5))
(const-frandom .05 .12)
(- (* (/ (nth 5 this-piano-source)
ratio) 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* (/ (nth 5 this-piano-source)
ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
0.0
(/ (nth 5 this-piano-source) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .09)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start of body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (nth '5 this-piano-source) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))
;
;********************************************************************************
;********************************************************************************
; full + attack not exist on source
(if (< desired-dur
(/ (- (nth '3 this-piano-source) (nth '7 this-piano-source)) ratio))
;*************************************************************************
; full + don't need extra body + attack not exist on source
; write makegen based on time
(progn
(if (> desired-dur .16)
(format score-file "~%makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 130 (random 5))
(const-frandom .05 .12)
(- (* desired-dur 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* desired-dur 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
(- (* desired-dur 1000) (+ 30 (random 20)))
(* desired-dur 1000)))
; write single TRANS statement
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
desired-dur
amp
transp)
(setf release-data (list start desired-dur
; was release written?
(> (* ratio desired-dur) (nth '5 this-piano-source)))))
;
;
;*************************************************************************
; full + need extra body + attack not exist on source
(progn
; first, the attack
(if (> (/ (nth 5 this-piano-source) ratio) .16)
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,~a, ~a,~a, ~a,0)~%"
(+ 6 (random 6))
(+ 100 (random 25))
(+ 131 (random 5))
(const-frandom .05 .12)
(- (* (/ (nth 5 this-piano-source)
ratio) 1000) (+ 5 (random 20)))
(const-frandom .05 .12)
(* (/ (nth 5 this-piano-source)
ratio) 1000))
(format score-file "~% makegen(1, 24, 3000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 6 (random 6))
; the "end" is end-of-sustain portion of the source sample
(- (* (nth '5 this-piano-source) 1000)
(+ 50 (random 40)))
(* (nth '5 this-piano-source) 1000)))
(format score-file "~% TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(setf inskip (nth '7 this-piano-source))
(/ (- (nth 5 this-piano-source)
(nth 7 this-piano-source)) ratio)
amp
transp)
; now the extra body
(format score-file "~%~%~%~%")
(setf body-amp (* amp (const-frandom .06 .09)))
; we must account for change in duration
(setf max-body-dur (- (nth 5 this-piano-source)
(nth 4 this-piano-source)))
; start in body is 40% into attack
(setf start (* (const-frandom 0.35 .5)
(/ (- (nth '5 this-piano-source) inskip) ratio)))
(loop (if (> start desired-dur) (return))
(setf body-dur (const-frandom
(* .75 max-body-dur) max-body-dur))
(setf body-inskip
(const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) body-dur)))
(format score-file "makegen(1, 24, 2000, 0, 0, ~a, 1, ~a, 1, ~a, 0)~%"
(const-frandom 3.0 6.0)
(const-frandom 10.0 13.0)
(const-frandom 19.0 21.0))
(format score-file "~%TRANS( ~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
body-inskip (/ body-dur ratio)
body-amp transp)
(setf release-data (list start (/ body-dur ratio) () ))
(setf start (+ start
(* (/ body-dur ratio) (const-frandom 0.35 0.5)))))))))
;
;*************************************************************************
;*************************************************************************
;*************************************************************************
;*************************************************************************
(otherwise (format t "lame-ass parameter 14 in note ~a"
(nth 15 (nth note-number note-list))) (bye)))
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
(unless (or (nth '3 release-data) (null (nth '2 this-piano-source)))
; unless release has already been written
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(setf pre-release (* (const-frandom .3 .35) dur-of-release))
; start-time of release = last-end-time - 110% of pre-release
; compensate for ratio
(setf start (- (+ (first release-data) (second release-data))
(* 1.1 (/ pre-release ratio))))
(if (< start 0.0) (setf start 0.0))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(* 1000.0 pre-release)
(* 1000.0 (- (+ pre-release dur-of-release)
(const-frandom .01 .02)))
(* 1000.0 (+ pre-release
dur-of-release)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(- (nth 5 this-piano-source) pre-release)
(/ (+ dur-of-release pre-release) ratio)
(* amp (const-frandom .06 .1))
transp)
(setf release-data (list start
(/ (+ dur-of-release pre-release) ratio) () )))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))))
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; PIANO: NASTY-AM-TREMOLO
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note nasty-am-tremolo)
(instr piano)
(score-file t))
(let ((base-amp '0.0)
(amp-multiplier-by-register '0.0)
(this-piano-source ())
(note-number (note-number note))
(ratio 0.0)
(desired-freq (frequency note))
(transp '0.0)
(dur '0.0)
(inskip '0.0)
(amp '0.0)
(start '0.0)
(desired-dur (desired-dur note))
(dur-of-release '0.0)
(release-data ())
(dur-of-note '0.0)
(trans-fact '0)
(series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(new-series ())
(series-countr '0)
(modu-vals ())
(modufreq '0.0)
(this-bit-dur '0.0)
(bitcounter '0)
)
;
;
; for each tremolation, pick either:
; 50 ms in the middle of the note (adjust amp accordingly)
; 100 ms from the bang of the note
;
; set up stuff in score
;
(format score-file
"~% rtsetparams(44100, 1) ~%
load(\"TRANS\") ~%
reset(44100) ~%
rtoutput(\"~a\") ~%
bus_config(\"TRANS\", \"in 0\", \"aux 0 out\") ~%~%
~%~%"
(concatenate 'string
(subseq
(nth piano-filename-par
(nth note-number note-list))
0
(- (length
(nth piano-filename-par
(nth note-number note-list)))
5))
".aiff"))
;
;
(setf base-amp
(* .95
(nth (dynamic note)
'(.026 .1 .35 .61 .83 .99))
(setf amp-multiplier-by-register
(nth (nth pitch-octave-par (nth note-number note-list))
; if register is
; 1 2 3 4 5 6 7 8 9 10 11 12
'(1.1 1.1 1.1 1.1 1.1 1.1 1.0 .845 .76 .67 .61 .54)))))
;
(loop
; pick the source piano sound we'll be using here
(setf this-piano-source (getel piano-source-list))
; write the filename out:
(format score-file "~%rtinput(\"~a\") ~%"
(concatenate 'string piano-notes-directory (first this-piano-source)))
; what is the transposition factor, in octave.pc notation?
(setf transp (/ (log
(setf ratio
(/ desired-freq
(nth '6 this-piano-source)))
1.059463)
100))
(if (< (random 8) 4)
; use 60-100 ms from middle of the note
(prog ()
(setf dur (const-frandom .07 .12))
(if (< (- (nth 5 this-piano-source) (nth 4 this-piano-source))
dur)
(setf dur (- (- (nth 5 this-piano-source) (nth 4 this-piano-source)) 0.03)))
(setf inskip (const-frandom
(nth '4 this-piano-source)
(- (nth '5 this-piano-source) dur)))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* .65 base-amp (nth '8 this-piano-source)))
; write a makegen to score , a bit less than bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 20 (random 30))
(+ 130 (random 30))
(+ 161 (random 30)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.15 0.3)))))
(setf start (+ start (const-frandom 0.03 0.05))))
; use 90-140 beginning of the note
(prog ()
(setf dur (const-frandom .09 .17))
(setf inskip (nth '7 this-piano-source))
; multiply by the source-note-loudness-factor and mid-note factor (1.2)
(setf amp (* 0.55 base-amp (nth '8 this-piano-source)))
; write a makegen to score, clearly bang in, fade out
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 5 (random 10))
(+ 130 (random 30))
(+ 161 (random 50)))
; write the trans statement
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
inskip
dur
amp
transp)
; (setf start (+ start
; (* (/ dur ratio) (const-frandom 0.35 0.5))))))
(setf start (+ start (const-frandom 0.03 0.05)))))
; update start?
(if (> start desired-dur) (return)))
;**************************************************************
;*********** RELEASE ***************************************
;**************************************************************
(setf dur-of-release (- (nth 3 this-piano-source)
(nth 5 this-piano-source)))
(format score-file "~%makegen(1, 24, 2000, 0,0, ~a,1, ~a,1, ~a,0)~%"
(+ 10 (random 20))
100
(+ 101 (random 10)))
(format score-file "~%TRANS(~a, ~a, ~a, ~a, ~a, 0, 0)~%"
start
(nth 5 this-piano-source)
dur-of-release
amp
transp)
(setf release-data (list start
(/ (+ dur-of-release) ratio) () ))
;
; keep track of final duration of everything
; use release-data to do it.
;
; return the final duration
;
(setf dur-of-note (+ (first release-data) (second release-data)))
;
;
;AND NOW, the AM stuff:
;
;
(format score-file
"~%~%load(\"AM\") ~%~%
bus_config(\"AM\", \"aux 0 in\", \"out 0\") ~%~%
makegen(2, 10, 10000, 1)~%~%" )
(setf trans-fact (random 19))
(setf series
(dolist (elle series new-series)
(setf new-series
(append new-series (list
(mod (+ elle trans-fact) 19))))))
(setf new-series ())
;
; then use it to make a modulation-freq value list:
(dotimes (countr (* 100 dur-of-note))
(setf modu-vals
(append modu-vals
(list
(+ 2.0 (* (random 10.0)
; used ta be 1.473684211
(expt (nth series-countr series) (random 3)) )))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
;;;;;;;;;;;;;;;
(setf start '0.0)
(if (< (- dur-of-note start) .125)
(setf this-bit-dur (- dur-of-note start))
(setf this-bit-dur (+ .04 (random .07))))
(loop
;
; makegen 1
;
(format score-file "makegen(1, 24, 2000, 0,0, ~a,1,~a,1,~a,0)~%"
(+ 1 (random 3))
(+ 9 (random 4))
(+ 19 (random 4)))
(setf modufreq (nth bitcounter modu-vals))
; write AM statement
;
(format score-file
"AM(~a, 0, ~a, 0.8, ~a, 0, 0) ~%~%"
start this-bit-dur modufreq)
;
;
; set stuff for the next go-around
(setf start (+ start .06 (random .037)))
(setf bitcounter (+ bitcounter 1))
(if (>= start dur-of-note) (return))
(if (< (- dur-of-note start) .125)
(setf this-bit-dur (- dur-of-note start))
(setf this-bit-dur (+ .04 (random .07)))))
;
; return duration of note
;
dur-of-note))
;
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************