LISP code for the wwave instrument
;
; FOR WWAVE 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
; wave
; is-it-drone? wave-form (soundfile-name) (final duration) (rewrite-flag)
; 0-1 word (oboe, clar) in seconds 0-1
; 0-5
;(setf note-list '(
; (wave 0 0 0 2 0 1 7 14 0 0 3 accent-tenuto 0 ebclar)
; (wave 0 0 0 1 0 1 5 17 3 0 3 accent-tenuto 0 bass-clar "1.0001.aiff" 0.542 1)
; (wave 0 0 0 1 0 1 8 10 4 0 3 (cresc 4 0) 0 mhrn)
; (wave 0 0 0 1 0 1 7 9 5 0 2 accent-tenuto 0 bass-clar)
; (wave 0 0 0 1 1 4 6 8 0 0 3 accent-tenuto 0 cbassoon)
; for cresc, the main dynamic should be the higher one
; (wave 0 0 0 2 0 1 7 13 1 0 3 accent-tenuto 0 ebclar)
; (wave 0 0 0 2 0 1 7 14 2 0 3 accent-tenuto 0 bass-clar)
; (wave 0 0 0 2 0 1 8 16 3 0 3 accent-tenuto 0 ebclar)
; (wave 0 0 0 2 0 1 9 12 4 0 3 accent-tenuto 0 ebclar)
; (wave 0 0 0 2 0 1 9 14 5 0 3 accent-tenuto 0 bass-clar)
;))
;
;
;coolest timbres are:
; bass clar
; contrabassoon (high is nice also)
; eb clar
;
;
;
;Articulation/agitation. (might be a list):
;------------------------------------------
; (staccatto: short duration)
; accent/ten
; Fp
; tremolo --- internal rate changes determined by random row form
; vibrato (on wave & filt & piano) --- internal rate changes determined by random row form
; gliss (random)
; cresc (list includes start and end dynamic)
; bartok-pizz
; cresc-decresc
; soft-attack (uses a cresc./decresc preset)
;-------------------------------------------
;
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
; WWAVE WWAVE WWAVE WWAVE WWAVE WWAVE WWAVE WWAVE
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
;**************************************************************************************
(defun make-wave (note-number)
(let ((file-str ())
(score-filename ())
(score-file ())
(wave-type ())
(timbre-makegen-list ())
(timbre-makegen-command ())
(loudness-modifier-list ())
(stretch-amount ())
(formant-makegen-list ())
(formant-makegen-command ())
(dynamic 2)
(noffiles 2)
(desired-dur 1.0)
(frequency 440)
(note-spec ())
(this-inst ())
(spat-score-name ())
(stereo-pos '0.0)
(roomsize '0.0)
(wet '0.0)
(extra-time '0.0)
(spatcommand ())
)
;
; do error checking for everything, print message and exit if found
;
;
; LOCAL FUNCTIONS
;
(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 wwave-rewrite-par (nth note-number note-list)) '0)
(shell (concatenate 'string "rm " (nth wwave-filename-par (nth note-number note-list))))
(setf file-str (subseq
(nth wwave-filename-par (nth note-number note-list))
0
(- (length (nth wwave-filename-par (nth note-number note-list)))
5)))))
file-str)))
;
;
; MAIN BODY MAIN BODY MAIN BODY MAIN BODY MAIN BODY MAIN BODY
;
;
; figure out filename (or use old one) fill in dur and flag,
; so note-list is length 18 AND get base file-name string
;
(setf file-str (initialize-note-in-note-list note-number))
;
; read wave parameter, generate MAKEGEN-lists for timbre and formants
;
(setf wave-type (nth wwave-waveform-par (nth note-number note-list)))
(setf dynamic (nth pitch-dyn-par (nth note-number note-list)))
;
;**************************************
;**************************************
; DECIDE WHAT INSTRUMENT---MAKE THE
; APPROPRIATE TIMBRE
;**************************************
;**************************************
(case wave-type ('bass-clar
;
;
;******************
; BASS CLARINET
;******************
;
; make the timbre makegen statement string
;
(setf timbre-makegen-list
; change list according to register
(subseq
'(.9 .01 .8 .01 .7 .01 .5 .01 .3 .01 .2 .01 .1 .01
.1 .01 .09 .005 .08 .005 .07 .005 .07 .003
.05 .003 .05 .003 .03 .002 .03 .002 .03
.002 .01 .001 .01 .001 .01 .001 .01 .001) 0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 .3 175 .9 250 .85 400 .6 450 .4
600 .5 1000 .95 1300 .6 1600 .7
1800 .5 2400 .6 2500 .3 22050 0.0))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;******************
; OBOE
;*****************
;
; make the timbre makegen statement string
;
('oboe
(setf timbre-makegen-list
; change list according to register
(subseq
'(1.0 0.5 0.33333334 0.25 0.2 0.16666667
0.14285715 0.125 0.11111111 0.1
0.09090909 0.083333336 0.07692308
0.071428575 0.06666667 0.0625 0.05882353
0.055555556 0.05263158 0.05 0.04761905
0.045454547 0.04347826 0.041666668
0.04 0.03846154 0.037037037 0.035714287
0.03448276 0.033333335 0.032258064
0.03125 0.030303031 0.029411765
0.028571429 0.027777778 0.027027028
0.02631579 0.025641026 0.025 0.024390243
0.023809524 0.023255814 0.022727273
0.022222223 0.02173913
0.021276595 0.020833334 0.02)
0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 0.0 100 0.2 250 0.1 340 0.3 500 0.27 600 0.4
900 0.8 1000 1.0 1500 0.8 1800 0.3 2200 0.27
2500 0.6 2850 .28 3700 .275 4100 0.2
6000 0.1 22050 0.0))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;******************
; CONTRABASSOON
;*****************
;
('cbassoon
(setf timbre-makegen-list
; change list according to register
(subseq
'(1.0 0.5 0.33333334 0.25 0.2 0.16666667
0.14285715 0.125 0.11111111 0.1
0.09090909 0.083333336 0.07692308
0.071428575 0.06666667 0.0625 0.05882353
0.055555556 0.05263158 0.05 0.04761905
0.045454547 0.04347826 0.041666668
0.04 0.03846154 0.037037037 0.035714287
0.03448276 0.033333335 0.032258064
0.03125 0.030303031 0.029411765
0.028571429 0.027777778 0.027027028
0.02631579 0.025641026 0.025 0.024390243
0.023809524 0.023255814 0.022727273
0.022222223 0.02173913
0.021276595 0.020833334 0.02)
0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 0.0 60 0.2 300 0.95 570 0.6
750 0.7 900 0.3 1000 0.2 22050 0.0))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;******************
; MUTED TRUMPET
;*****************
;
('mtrump
(setf timbre-makegen-list
; change list according to register
(subseq
'(1.0 0.5 0.33333334 0.25 0.2 0.16666667
0.14285715 0.125 0.11111111 0.1
0.09090909 0.083333336 0.07692308
0.071428575 0.06666667 0.0625 0.05882353
0.055555556 0.05263158 0.05 0.04761905
0.045454547 0.04347826 0.041666668
0.04 0.03846154 0.037037037 0.035714287
0.03448276 0.033333335 0.032258064
0.03125 0.030303031 0.029411765
0.028571429 0.027777778 0.027027028
0.02631579 0.025641026 0.025 0.024390243
0.023809524 0.023255814 0.022727273
0.022222223 0.02173913
0.021276595 0.020833334 0.02)
0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 0.0 250 0.1 470 0.17 560 0.1 700 0.13
1000 0.1 1300 .08 1500 0.22 2300 0.15 2500 0.3
3200 0.175 5000 1.0 10000 0.3 22050 0.00))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;****************************
;MUTED HORN
;****************************
('mhrn
(setf timbre-makegen-list
; change list according to register
(subseq
'(1.0 0.5 0.33333334 0.25 0.2 0.16666667
0.14285715 0.125 0.11111111 0.1
0.09090909 0.083333336 0.07692308
0.071428575 0.06666667 0.0625 0.05882353
0.055555556 0.05263158 0.05 0.04761905
0.045454547 0.04347826 0.041666668
0.04 0.03846154 0.037037037 0.035714287
0.03448276 0.033333335 0.032258064
0.03125 0.030303031 0.029411765
0.028571429 0.027777778 0.027027028
0.02631579 0.025641026 0.025 0.024390243
0.023809524 0.023255814 0.022727273
0.022222223 0.02173913
0.021276595 0.020833334 0.02)
0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 0.0 250 .2 550 0.5 700 0.5
900 0.42 1050 1.0 1800 .7 2500 0.2
22050 0.00))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;
;***********************************
; Eb CLARINET
;***********************************
;
;
('ebclar
; make the timbre makegen statement string
;
(setf timbre-makegen-list
; change list according to register
(subseq
'(.9 .01 .8 .01 .7 .01 .5 .01 .3 .01 .2 .01 .1 .01
.1 .01 .09 .005 .08 .005 .07 .005 .07 .003
.05 .003 .05 .003 .03 .002 .03 .002 .03 .002
.01 .001 .01 .001 .01 .001 .01 .001) 0
(case (nth pitch-octave-par (nth note-number note-list))
('1 42) ('2 42) ('3 42) ('4 42) ('5 35)
('6 25) ('7 15) ('8 12) ('9 8)
('10 6) ('11 5) ('12 4) ('13 4) (otherwise 4))))
; change list according to loudness
(setf stretch-amount
(case dynamic ('0 0.5) ('1 0.8) ('2 1.0) ('3 1.6)
('4 2.1) ('5 3.0)))
(setf loudness-modifier-list
(dotimes (ct 42 loudness-modifier-list)
(setf loudness-modifier-list
(append loudness-modifier-list
(list (+ 1.0 (* ct (/ (- stretch-amount 1.0) 42))))))))
(setf timbre-makegen-list
(mapcar #'* timbre-makegen-list loudness-modifier-list))
; piddle with it
(setf timbre-makegen-list (piddle timbre-makegen-list 0.02))
; make it into a command string
(setf timbre-makegen-command
(concatenate 'string "~%makegen(-3, 2,"
(princ-to-string (length timbre-makegen-list)) ", 0)~%"
))
(dolist (ell timbre-makegen-list)
(setf timbre-makegen-command
(concatenate 'string timbre-makegen-command
" " (princ-to-string ell))))
;
; make the formant makegen statement
;
(setf formant-makegen-list
'(0 .1 250 0.3 350 0.6 450 0.5
600 0.5 900 0.7 1000 1.0 1250 .4
1800 0.6 2300 0.437 2500 0.439
4500 0.2 5000 0.2 22050 0.0))
(setf formant-makegen-command "~%makegen(-4, 24, 22050")
(dolist (ell formant-makegen-list)
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
", " (princ-to-string ell))))
(setf formant-makegen-command
(concatenate 'string formant-makegen-command
")~%~%")))
;
; in case the wwave instrument-timbre parameter is muffed up
;
(t (format t "~% note number ~a inst-type is muffed up" file-str) (bye)))
;
;**********************************************
;**********************************************
; DONE MAKING TIMBRE/INSTRUMENT
;**********************************************
;**********************************************
;
; open cmix score files. write initial garbage. write timbre, formant makegens
;
;
(setf score-filename (concatenate 'string file-str ".sco"))
(with-open-file (score-file score-filename :direction :output)
;
; write output sound-file name in score file
;
(format score-file "~% output(\"~a\") ~%"
(concatenate 'string file-str ".aiff"))
(format score-file "reset(44100) ~%")
;
; write timbre makegens
(format score-file "~%")
(format score-file timbre-makegen-command)
(format score-file "~%")
(format score-file formant-makegen-command)
(format score-file "~%")
;
; call routine, depending on articulation
; sending desired duration (not including spat) , frequency (in hertz)
; dynamic level
;
(setf desired-dur (convert-dur-from-mbd-sec
(subseq (nth note-number note-list) pitch-dur-msr-par
(+ 1 pitch-dur-div-par))))
;
;
(setf frequency
(pitch-to-freq
(nth pitch-octave-par (nth note-number note-list))
(nth pitch-pc-par (nth note-number note-list))))
;
; make an object instance out of the note
;
(setf note-spec
(if (listp (nth pitch-artic-par (nth note-number note-list)))
; 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 frequency
:dynamic dynamic
:extra-params (rest
(nth pitch-artic-par (nth note-number note-list))))
; 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 frequency
:dynamic dynamic)))
;
; tell what instrument we're using, so the *write-cmix-score*
; will call the correct method
;
(setf this-inst (make-instance 'wwave))
;
; call write-cmix-score
;
(write-cmix-score note-spec this-inst score-file))
;
; pre-create soundfiles
;
(shell (concatenate 'string "sfc1 " file-str ".aiff"))
; run wwave
(shell (concatenate 'string "wwave < " file-str ".sco"))
; remove score file
(shell (concatenate 'string "rm " file-str ".sco"))
;
; nastily AM-ize the soundfile if necessary:
(if (eq (nth pitch-artic-par (nth note-number note-list)) 'nasty-am-tremolo)
(am-it (nth note-number note-list)))
;
; spatialize it:
; first, check if we should spatialize it?
;
(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 desired-dur
(- 1.9 (* 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:
(case (nth pitch-stereo-par (nth note-number note-list))
((0 5) ".58 ") ((1 4) ".68 ") ((2 3) ".7 "))
; 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 spatialzation request in
note number ~a ~%~%" file-str) (bye)))
;
; write exact duration in seconds to note-list
; a 0.0 is already there
(setf (nth wwave-dur-par (nth note-number note-list)) (+ extra-time desired-dur))
)))
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
; DONE MAIN INSTRUMENT PART
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;***************************************
;*****************************************
; INSTRUMENT CLASS
;*************************************
;************************************
(defclass wwave (inst) ())
;*************************************
;**************************************
; ARTICULATION CLASSES
;**************************************
;***************************************
(defclass accent-tenuto (articulation) ())
(defclass fp (articulation) ())
; (cresc x y) from dynamic x to dynamix y
(defclass cresc (articulation) ())
(defclass tremolo (articulation) ())
(defclass vibrato (articulation) ())
(defclass wide-vibrato (articulation) ())
(defclass bartok-pizz (articulation) ())
(defclass soft-attack (articulation) ())
; gliss is defined by wildness (number of points) and
; distance-factor (in semitones of boundary)
;hence for example : (gliss 5 6)
(defclass gliss (articulation) ())
(defclass nasty-am-tremolo (articulation) ())
; for cresc-decresc, specify two numbers
; for middle and endpoint, for proportions
; example: (cresc-decresc 5 9) makes a 0 5 9 curve
(defclass cresc-decresc (articulation) ())
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
; AND NOW FOR THE METHODS FOR DIFFERENT ARTICULATIONS
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;**************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: ACCENT-TENUTO
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note accent-tenuto)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(times ())
(last-usable-time-point ())
(cur-time '0)
(values ())
(amp-makegen ())
(allowable-deviance '0.0)
(deviance-makegen ())
(avg-amount-of-change '0.0)
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
; AMPLITUDE MAKEGEN
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
(setf allowable-deviance (const-frandom 0.1 0.2))
(setf deviance-makegen
(append '(24 200 0)
(list allowable-deviance)
'(3)
(list allowable-deviance)))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
(setf avg-amount-of-change (const-frandom 0.005 0.01))
(setf rate-o-change-makegen
(append '(24 200 0)
(list avg-amount-of-change)
'(3)
(list avg-amount-of-change)))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
; GLISS CURVE -- slight vibrato, wavering
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case (dynamic note)
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: CRESC
;******************************************
;******************************************
;******************************************
;******************************************
; for cresc, the main dynamic should be the higher one
(defmethod write-cmix-score ((note cresc)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(dynamic '2)
(float-hi '1.0)
(float-low '0.0)
(times ())
(last-usable-time-point '0)
(cur-time '0)
(x-increment '0)
(x '0.01)
(values ())
(cter '2)
(direction '1)
(amp-makegen ())
(line ())
(line-length '0)
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
; dynamic is set to louder value of cresc.
(setf dynamic (second (get-smallest-largest (extra-params note))))
;
; AMPLITUDE MAKEGEN
;
; float value of high amp is 1.0
; float value of low amp
;
(setf float-hi '1.0)
(setf float-low
(* .35 (/
(nth (first (get-smallest-largest (extra-params note)))
'(450 1700 6800 15050 20000 26000))
(nth (second (get-smallest-largest (extra-params note)))
'(450 1700 6800 15050 20000 26000)))))
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; build a basic amplitude curve
; to make the curve:
; graph y = x^2
; into a list of y coordinates.
; first figure out the x-increment
; = .98 / (lengthoftimes - 1)
; (first element is 0.0, second is 0.01)
; dotimes, building the curve-list
;
(setf x-increment (/ .98 (- (length times) 1)))
(setf x '0.01)
(dotimes (ctr (- (length times) 1))
(setf values
(append values
(list
(* x x))))
(setf x (+ x x-increment)))
;
;
; make a line going from 1.0 to 1.5
;
(setf line-length (truncate (* (length values) .15)))
(setf x-increment (/ 1.0 line-length))
(setf x '0.0)
(dotimes (ctr line-length)
(setf line
(append line
(list
(+ (* x 0.2) 1.0))))
(setf x (+ x x-increment)))
;
; multiply the second-to-last %15 of values by this line
;
(do ((cur-point-in-values (- (length values) (* 2 (length line)))
(+ cur-point-in-values 1))
(cur-point-in-line '0 (+ cur-point-in-line 1)))
((= cur-point-in-line (length line)))
(setf (nth cur-point-in-values values)
(* (nth cur-point-in-values values)
(nth cur-point-in-line line))))
;
; retrograde line.
; multiply the last %15 of values by this line.
;
(setf line (reverse line))
(do ((cur-point-in-values (- (length values) (length line))
(+ cur-point-in-values 1))
(cur-point-in-line '0 (+ cur-point-in-line 1)))
((= cur-point-in-line (length line)))
(setf (nth cur-point-in-values values)
(* (nth cur-point-in-values values)
(nth cur-point-in-line line))))
;
; values should now hold the proper shape
;
; raise the 0 of the curve to float-low
;
(dotimes (cter (length values))
(setf (nth cter values)
(+ float-low (* (nth cter values) (- 1.0 float-low)))))
; set first and last to 0.0
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
; Retrograde the curve if it's a decrescendo
;
(if (> (first (extra-params note)) (second (extra-params note)))
; cresc up
(setf direction 0)
; decresc/dim down
(setf direction 1))
(if (= direction 0)
(setf values (reverse values)))
;
; piddle with it
; leave the first and last at 0.0
;
(setf values (append
(list (first values))
(piddle (reverse (rest (reverse (rest values)))) 0.01)
(last values)))
(dotimes (ct (length times))
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; the curve--- y=x^3
;
(setf x-increment (/ .98 (- (length times) 1)))
(setf x '0.0)
(dotimes (ctr (length times))
(setf values
(append values
(list
(* x x x))))
(setf x (+ x x-increment)))
; smoosh the curve to .dynamic
(dotimes (elle (length values))
(setf (nth elle values)
(* (nth elle values) (* dynamic .1))))
; add a tiny bit to all values
(dotimes (elle (length values))
(setf (nth elle values)
(+ (nth elle values) (const-frandom 0.03 0.08))))
; retrograde the curve if it's a decrescendo
(if (= direction 0)
(setf values (reverse values)))
;
(dotimes (ct (length times) deviance-makegen)
(setf deviance-makegen (append deviance-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf deviance-makegen
(append '(24)
(list dur-in-ms)
deviance-makegen))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; the curve--- y=x^3
;
(setf x-increment (/ .98 (- (length times) 1)))
(setf x '0.0)
(dotimes (ctr (length times))
(setf values
(append values
(list
(* x x x))))
(setf x (+ x x-increment)))
; smoosh the curve to .dynamic
(dotimes (elle (length values))
(setf (nth elle values)
(* (nth elle values) (* dynamic .01))))
; retrograde the curve if it's a decrescendo
(if (= direction 0)
(setf values (reverse values)))
(dotimes (ct (length times) rate-o-change-makegen)
(setf rate-o-change-makegen (append rate-o-change-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf rate-o-change-makegen
(append '(24)
(list dur-in-ms)
rate-o-change-makegen))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; GLISS CURVE -- slight vibrato, wavering
;
;
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: FP
;******************************************
;******************************************
;******************************************
;******************************************
;
(defmethod write-cmix-score ((note fp)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(dynamic '2)
(float-hi '1.0)
(float-low '0.0)
(times ())
(x '0)
(x-increment '0.0)
(last-usable-time-point '0)
(cur-time '0)
(first-part-length '0)
(values ())
(cter '0)
(direction '1)
(amp-makegen ())
(line ())
(line-length '0)
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
(setf dynamic (dynamic note))
;
; AMPLITUDE MAKEGEN
;
; float value of high amp is 1.0
; float value of low amp
;
(setf float-hi '0.99)
(setf float-low (const-frandom .06 .16))
;
; first 10% is at high amp, next 5% transition, next 85% at low amp
;
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 150) 170)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
(setf first-part-length
(loop
(if (> (nth cter times) 130) (return cter))
(setf cter (+ cter 1))))
(dotimes (counter first-part-length)
(setf values (append values (list float-hi))))
(dotimes (counter (- (- (length times) first-part-length) 1))
(setf values (append values (list float-low))))
(setf values (piddle values '0.01))
; set first and last to 0.0
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
; piddle with it
; leave the first and last at 0.0
;
(dotimes (ct (length times))
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; the curve--- y=x^3
;
(setf x-increment (/ .98 (- (length times) 1)))
(setf x '0.0)
(dotimes (ctr (length times))
(setf values
(append values
(list
(* x x x))))
(setf x (+ x x-increment)))
; smoosh the curve to .dynamic
(dotimes (elle (length values))
(setf (nth elle values)
(* (nth elle values) (* dynamic .1))))
; add a tiny bit to all values
(dotimes (elle (length values))
(setf (nth elle values)
(+ (nth elle values) (const-frandom 0.03 0.08))))
; retrograde the curve so it goes down
(setf values (reverse values))
;
(dotimes (ct (length times) deviance-makegen)
(setf deviance-makegen (append deviance-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf deviance-makegen
(append '(24)
(list dur-in-ms)
deviance-makegen))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; the curve--- y=x^3
;
(setf x-increment (/ .98 (- (length times) 1)))
(setf x '0.0)
(dotimes (ctr (length times))
(setf values
(append values
(list
(* x x x))))
(setf x (+ x x-increment)))
; smoosh the curve to .dynamic
(dotimes (elle (length values))
(setf (nth elle values)
(* (nth elle values) (* dynamic .01))))
; retrograde the curve if it's a decrescendo
(setf values (reverse values))
(dotimes (ct (length times) rate-o-change-makegen)
(setf rate-o-change-makegen (append rate-o-change-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf rate-o-change-makegen
(append '(24)
(list dur-in-ms)
rate-o-change-makegen))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; GLISS CURVE -- slight vibrato, wavering
;
;
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: TREMOLO
;******************************************
;******************************************
;******************************************
;******************************************
;
(defmethod write-cmix-score ((note tremolo)
(instr wwave)
(score-file t))
(let ((series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(dur-in-ms '0)
(dynamic (dynamic note))
(float-hi '0.99)
(float-low (const-frandom .46 .56))
(times ())
(values ())
(last-usable-time-point 0)
(cur-time 0)
(trans-fact (random 19))
(new-series ())
(series-countr '0)
(amp-makegen ())
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp 0)
)
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
; AMPLITUDE MAKEGEN
;
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 150) 170)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 20.0 50.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; 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 (- (length times) 1))
(setf values
(append values
(list (+ float-low (* .0236842
(nth series-countr series))))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
(dotimes (ct (length times))
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 90.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; stuff
; it should vary widely, from very small, to very large
; maybe exponentially? manually?
;
; 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 (- (length times) 1))
(setf values
(append values
(list (case (nth series-countr series)
(0 0.001) (1 0.003) (2 0.005) (3 0.007)
(4 0.01) (5 0.02) (6 0.03) (7 0.04)
(8 0.05) (9 0.06) (10 0.07) (11 0.08) (12 0.1)
(13 0.2) (14 0.3) (15 0.4) (16 0.5)
(17 0.6) (18 0.8)))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) deviance-makegen)
(setf deviance-makegen (append deviance-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf deviance-makegen
(append '(24)
(list dur-in-ms)
deviance-makegen))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
;
(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 (- (length times) 1))
(setf values
(append values
(list (case (nth series-countr series)
(0 0.0001) (1 0.0003) (2 0.0007) (3 0.001)
(4 0.003) (5 0.005) (6 0.008) (7 0.01)
(8 0.015) (9 0.02) (10 0.025) (11 0.03) (12 0.035)
(13 0.04) (14 0.075) (15 0.1) (16 0.15)
(17 0.2) (18 0.4)))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) rate-o-change-makegen)
(setf rate-o-change-makegen (append rate-o-change-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf rate-o-change-makegen
(append '(24)
(list dur-in-ms)
rate-o-change-makegen))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; GLISS CURVE -- slight vibrato, wavering
;
;
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;
;
;
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: VIBRATO
;******************************************
;******************************************
;******************************************
;******************************************
;
;
;
(defmethod write-cmix-score ((note vibrato)
(instr wwave)
(score-file t))
(let ((series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(dur-in-ms '0)
(dynamic (dynamic note))
(float-hi '0.99)
(float-low (const-frandom .46 .56))
(times ())
(values ())
(last-usable-time-point 0)
(cur-time 0)
(trans-fact (random 19))
(new-series ())
(series-countr '0)
(amp-makegen ())
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp 0)
)
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
;
; AMPLITUDE MAKEGEN
;
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 150) 170)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 20.0 50.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 90.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; stuff
; it should vary widely, from very small, to very large
; maybe exponentially? manually?
;
; 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 (- (length times) 1))
(setf values
(append values
(list (/
(case (nth series-countr series)
(0 0.001) (1 0.003) (2 0.005) (3 0.007)
(4 0.01) (5 0.02) (6 0.03) (7 0.04)
(8 0.05) (9 0.06) (10 0.07) (11 0.08) (12 0.1)
(13 0.2) (14 0.3) (15 0.4) (16 0.5)
(17 0.6) (18 0.8)) 4.0))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) deviance-makegen)
(setf deviance-makegen (append deviance-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf deviance-makegen
(append '(24)
(list dur-in-ms)
deviance-makegen))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
;
(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 (- (length times) 1))
(setf values
(append values
(list (/
(case (nth series-countr series)
(0 0.0001) (1 0.0003) (2 0.0007) (3 0.001)
(4 0.003) (5 0.005) (6 0.008) (7 0.01)
(8 0.015) (9 0.02) (10 0.025) (11 0.03) (12 0.035)
(13 0.04) (14 0.075) (15 0.1) (16 0.15)
(17 0.2) (18 0.4)) 3.0))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) rate-o-change-makegen)
(setf rate-o-change-makegen (append rate-o-change-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf rate-o-change-makegen
(append '(24)
(list dur-in-ms)
rate-o-change-makegen))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; GLISS CURVE -- slight vibrato, wavering
;
;
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
(setf values ())
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 50.0 90.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; 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 ())
;
(format t "~%~% series is: ~a ~%~%" series)
; then use it to make values curve:
(dotimes (countr (- (length times) 1))
(setf values
(append values
; calculates a trans-modifier:
(list (- (* 0.000789474 (nth series-countr series)) 0.007105266))
(list (* -1.0 (- (* 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)
;
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
(format t " ~%~%values is: ~a ~%~%" values)
(dotimes (ct (length times))
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format t "~%~% gliss makegen is: ~a ~%~%" gliss-makegen)
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;
;
;
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: WIDE-VIBRATO
;******************************************
;******************************************
;******************************************
;******************************************
;
;
;
(defmethod write-cmix-score ((note wide-vibrato)
(instr wwave)
(score-file t))
(let ((series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(dur-in-ms '0)
(dynamic (dynamic note))
(float-hi '0.99)
(float-low (const-frandom .46 .56))
(times ())
(values ())
(last-usable-time-point 0)
(cur-time 0)
(trans-fact (random 19))
(new-series ())
(series-countr '0)
(amp-makegen ())
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp 0)
)
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
;
; AMPLITUDE MAKEGEN
;
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 150) 170)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 20.0 50.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 90.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; stuff
; it should vary widely, from very small, to very large
; maybe exponentially? manually?
;
; 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 (- (length times) 1))
(setf values
(append values
(list (/
(case (nth series-countr series)
(0 0.001) (1 0.003) (2 0.005) (3 0.007)
(4 0.01) (5 0.02) (6 0.03) (7 0.04)
(8 0.05) (9 0.06) (10 0.07) (11 0.08) (12 0.1)
(13 0.2) (14 0.3) (15 0.4) (16 0.5)
(17 0.6) (18 0.8)) 4.0))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) deviance-makegen)
(setf deviance-makegen (append deviance-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf deviance-makegen
(append '(24)
(list dur-in-ms)
deviance-makegen))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes a list
; of times every 100 ms or so
(setf cur-time (second times))
(setf values ())
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
;
(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 (- (length times) 1))
(setf values
(append values
(list (/
(case (nth series-countr series)
(0 0.0001) (1 0.0003) (2 0.0007) (3 0.001)
(4 0.003) (5 0.005) (6 0.008) (7 0.01)
(8 0.015) (9 0.02) (10 0.025) (11 0.03) (12 0.035)
(13 0.04) (14 0.075) (15 0.1) (16 0.15)
(17 0.2) (18 0.4)) 3.0))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
;
(dotimes (ct (length times) rate-o-change-makegen)
(setf rate-o-change-makegen (append rate-o-change-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf rate-o-change-makegen
(append '(24)
(list dur-in-ms)
rate-o-change-makegen))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; GLISS CURVE -- slight vibrato, wavering
;
;
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
(setf values ())
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 50.0 90.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
; 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 (- (length times) 1))
(setf values
(append values
; calculates a trans-modifier:
(list (* .003684211 (nth series-countr series)))
(list (* -1.0 (* .003684211 (nth series-countr series))))))
(setf series-countr (+ series-countr 1))
(if (> series-countr 18) (setf series-countr '0)))
(setf series-countr '0)
;
; set first and last to 0.0
;
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
(dotimes (ct (length times))
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;****************************************************************************
;
;
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: BARTOK-PIZZ
;******************************************
;******************************************
;******************************************
;******************************************
;
;
(defmethod write-cmix-score ((note bartok-pizz)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(dynamic '2)
(float-hi '1.0)
(float-low '0.0)
(times ())
(last-usable-time-point '0)
(cur-time '0)
(first-part-length '0)
(pizztimes '(0))
(pizzvalues ())
(lvvalues ())
(lvtimes ())
(values ())
(cter '0)
(direction '1)
(amp-makegen ())
(line ())
(line-length '0)
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(boo '0)
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
(setf dynamic (dynamic note))
;
; AMPLITUDE MAKEGEN
;
; float value of high amp is 1.0
; float value of low amp
;
(setf float-hi '0.99)
(setf float-low (const-frandom .1 .2))
;
; first 100 ms at high amp, rest at low amp
;
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 150) 170)))
; this is a loop that makes a list of times every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
(setf first-part-length
(loop
(if (> (nth cter times) 100) (return cter))
(setf cter (+ cter 1))))
(dotimes (counter first-part-length)
(setf values (append values (list float-hi))))
(dotimes (counter (- (- (length times) first-part-length) 1))
(setf values (append values (list float-low))))
(setf values (piddle values '0.01))
; set first and last to 0.0
(setf (first values) 0.0)
(setf values (append values '(0.0)))
;
; piddle with it
; leave the first and last at 0.0
;
(dotimes (ct (length times))
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(if (> dur-in-ms 235)
(format score-file " makegen(-5, 24, 2000, 0,~a, ~a,~a, ~a,~a, ~a,~a) ~%~%"
(const-frandom 0.6 0.9)
(setf boo (+ 50 (random 50))) (const-frandom 0.6 0.9)
(+ boo 100 (random 30)) (const-frandom 0.005 0.01)
dur-in-ms (const-frandom 0.005 0.01))
(format score-file " makegen(-5, 24, 2000, 0,~a, ~a,~a, ~a,~a, ~a,~a) ~%~%"
(const-frandom 0.6 0.9)
(setf boo (+ 50 (random 50))) (const-frandom 0.6 0.9)
(+ boo 100 (random 30)) (const-frandom 0.005 0.01)
170 (const-frandom 0.005 0.01)))
;
;
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
;
(if (> dur-in-ms 290)
(format score-file " makegen(-6, 24, 2000, 0,~a, ~a,~a, ~a,~a, ~a,~a) ~%~%"
(const-frandom 0.1 0.4)
(setf boo (+ 90 (random 50))) (const-frandom 0.1 0.4)
(+ boo 100 (random 50)) (const-frandom 0.001 0.009)
dur-in-ms (const-frandom 0.001 0.009))
(format score-file " makegen(-6, 24, 2000, 0,~a, ~a,~a, ~a,~a, ~a,~a) ~%~%"
(const-frandom 0.1 0.4)
(setf boo (+ 90 (random 50))) (const-frandom 0.1 0.4)
(+ boo 100 (random 50)) (const-frandom 0.001 0.009)
220 (const-frandom 0.001 0.009)))
;
;
;
; GLISS CURVE
;
; pizztimes is (0)
; add around 3-6 until greater than (0. . . . 50)
;
(setf cur-time '0)
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 6.0 13.0))))
(when (> cur-time 70.0) (return))
(setf pizztimes (append pizztimes (list cur-time))))
(dolist (elle pizztimes)
(setf pizzvalues
(append pizzvalues
(list
(const-frandom -.2 .2)))))
;
;
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
(setf cur-time (+ 40 (first (last pizztimes))))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf lvtimes (append lvtimes (list cur-time))))
(setf lvtimes (append lvtimes (list last-usable-time-point) (list dur-in-ms)))
;
(setf lvvalues '(0.0))
(dotimes (ct (- (length lvtimes) 2))
(setf lvvalues
(append lvvalues (list
(const-frandom -0.0005 0.0005)))))
(setf lvvalues (append lvvalues (list '0.0)))
;
;
(dotimes (ct (length pizztimes))
(setf gliss-makegen (append gliss-makegen
(list (nth ct pizztimes)) (list (nth ct pizzvalues)))))
(dotimes (ct (length lvtimes))
(setf gliss-makegen (append gliss-makegen
(list (nth ct lvtimes)) (list (nth ct lvvalues)))))
;
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
; ACTUAL WWAVE STATEMENT
;
(setf amp (case dynamic
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: SOFT-ATTACK
;******************************************
;******************************************
;******************************************
;******************************************
;
(defmethod write-cmix-score ((note soft-attack)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(times ())
(last-usable-time-point ())
(cur-time '0)
(values ())
(amp-makegen ())
(allowable-deviance '0.0)
(deviance-makegen ())
(avg-amount-of-change '0.0)
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
; AMPLITUDE MAKEGEN
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
; now change the first few elements of values so
; that a soft-attack is formed
;
(setf (second values)
(const-frandom 0.01 0.03))
(if (> (length values) 2)
(setf (third values)
(const-frandom 0.03 0.07)))
(if (> (length values) 3)
(setf (fourth values)
(const-frandom 0.07 0.14)))
(if (> (length values) 4)
(setf (fifth values)
(const-frandom 0.15 0.4)))
(if (> (length values) 5)
(setf (sixth values)
(const-frandom 0.4 0.5)))
(if (> (length values) 6)
(setf (seventh values)
(const-frandom 0.5 0.6)))
(if (> (length values) 7)
(setf (eighth values)
(const-frandom 0.6 0.7)))
(if (> (length values) 8)
(setf (ninth values)
(const-frandom 0.85 0.9)))
(if (> (length values) 9)
(setf (tenth values)
(const-frandom 0.9 0.95)))
(if (> (length values) 10)
(setf (nth 10 values)
(const-frandom 0.95 1.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
(setf allowable-deviance (const-frandom 0.1 0.2))
(setf deviance-makegen
(append '(24 200 0)
(list allowable-deviance)
'(3)
(list allowable-deviance)))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
(setf avg-amount-of-change (const-frandom 0.005 0.01))
(setf rate-o-change-makegen
(append '(24 200 0)
(list avg-amount-of-change)
'(3)
(list avg-amount-of-change)))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
; GLISS CURVE -- slight vibrato, wavering
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case (dynamic note)
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: (GLISS W D)
;******************************************
;******************************************
;******************************************
;******************************************
(defmethod write-cmix-score ((note gliss)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(times ())
(last-usable-time-point ())
(cur-time '0)
(values ())
(amp-makegen ())
(allowable-deviance '0.0)
(deviance-makegen ())
(avg-amount-of-change '0.0)
(rate-o-change-makegen ())
(gliss-makegen ())
(wildness (first (extra-params note)))
(distance (second (extra-params note)))
(this-distance '0.0)
(ave-time-dist '0)
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
; AMPLITUDE MAKEGEN
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
(setf allowable-deviance (const-frandom 0.1 0.2))
(setf deviance-makegen
(append '(24 200 0)
(list allowable-deviance)
'(3)
(list allowable-deviance)))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
(setf avg-amount-of-change (const-frandom 0.005 0.01))
(setf rate-o-change-makegen
(append '(24 200 0)
(list avg-amount-of-change)
'(3)
(list avg-amount-of-change)))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; GLISS CURVE --
;
; number of values is wildness, then + 4 for original pitch
; stability periods
;
(setf values ())
(setf this-distance (const-frandom
(* 0.7 distance) (* 1.4 distance)))
(dotimes (cto wildness)
(setf values
(append values
(list
(const-frandom
(* -1.0 (/ distance 100.0))
(/ distance 100.0)))))
(setf this-distance (const-frandom
(* 0.7 distance) (* 1.4 distance))))
(setf values (append '(0.0 0.0) values '(0.0 0.0)))
;
; times, find average distance between.
; always use less
;
(setf ave-time-dist
(/ dur-in-ms (length values)))
(setf times '(0))
(setf cur-time '0.0)
(dotimes (ctq (- (length values) 1))
(setf times
(append times
(list
(setf cur-time
(+ cur-time (const-frandom
(* .8 ave-time-dist)
(* 2.1 ave-time-dist))))))))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case (dynamic note)
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;**********************************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: NASTY-AM-TREMOLO
;******************************************
;******************************************
;******************************************
;******************************************
;
;
; just a copy of accent-tenuto.
;
; do the AM-ing in the main file and in the proc below
;
;
(defmethod write-cmix-score ((note nasty-am-tremolo)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(times ())
(last-usable-time-point ())
(cur-time '0)
(values ())
(amp-makegen ())
(allowable-deviance '0.0)
(deviance-makegen ())
(avg-amount-of-change '0.0)
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
;
; AMPLITUDE MAKEGEN
;
; list of times in ms of amp changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 10))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 1's, of length -2 (for outer 0's)
;
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom .9 1.0)))))
(setf values (append values (list '0.0)))
;
;
(setf amp-makegen ())
(dotimes (ct (length times) amp-makegen)
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
(setf allowable-deviance (const-frandom 0.1 0.2))
(setf deviance-makegen
(append '(24 200 0)
(list allowable-deviance)
'(3)
(list allowable-deviance)))
(format score-file "~% makegen(-5")
(dolist (elle deviance-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; CURVE OF HARMONIC STRENGTH AVG-AMT-OF-CHANGE
;
(setf avg-amount-of-change (const-frandom 0.005 0.01))
(setf rate-o-change-makegen
(append '(24 200 0)
(list avg-amount-of-change)
'(3)
(list avg-amount-of-change)))
(format score-file "~% makegen(-6")
(dolist (elle rate-o-change-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
; GLISS CURVE -- slight vibrato, wavering
;
; list of times in ms of gliss changes, for makegen curve
(setf times (append (list '0) (list (+ (random 20) 30))))
(setf last-usable-time-point (- dur-in-ms (+ (random 20) 30)))
; this is a loop that makes random deviations of amp. every 100 ms or so,
(setf cur-time (second times))
(loop
(setf cur-time (+ cur-time (truncate (const-frandom 60.0 130.0))))
(when (> cur-time last-usable-time-point) (return))
(setf times (append times (list cur-time))))
(setf times (append times (list last-usable-time-point) (list dur-in-ms)))
;
;
; for the values in the amp makegen, first make a list of
; almost 0's, of length -2 (for outer 0's)
(setf values '(0.0))
(dotimes (ct (- (length times) 2))
(setf values
(append values (list
(const-frandom -0.0005 0.0005)))))
(setf values (append values (list '0.0)))
;
;
(setf gliss-makegen ())
(dotimes (ct (length times) gliss-makegen)
(setf gliss-makegen (append gliss-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf gliss-makegen
(append '(24)
(list dur-in-ms)
gliss-makegen))
; write it to the file
(format score-file "~% makegen(-7")
(dolist (elle gliss-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
; ACTUAL WWAVE STATEMENT
;
(setf amp (case (dynamic note)
('0 450) ('1 1700) ('2 6800) ('3 15050) ('4 20000) ('5 26000)))
(format score-file "wwave(0.0, ~a , ~a , ~a )" (desired-dur note)
amp (frequency note))))
;
;
; the extra procedure to AM-ize a wwave note
;
;
(defun am-it (note)
(let (
(am-sco-filename ())
(am-aiff-filename ())
(main-aiff-filename ())
(file-str (subseq
(nth filt-filename-par note)
0
(- (length (nth filt-filename-par note)) 5)))
(series '(6 1 4 3 8 5 18 2 16 0 14 17 13 9 12 7 10 15 11))
(modu-vals ())
(dur-of-note
(convert-dur-from-mbd-sec
(subseq note pitch-dur-msr-par
(+ 1 pitch-dur-div-par))))
(series-countr '0)
(start '0)
(new-series ())
(this-but-dur '0.0)
(modufreq '0.0)
(bitcounter '0)
)
;
(setf am-score-filename "temp.am.sco")
(setf am-aiff-filename "temp.am.aiff")
(setf main-aiff-filename
(concatenate 'string file-str ".aiff"))
;
; open score file
(with-open-file (score-file am-score-filename :direction :output)
(format score-file
"rtsetparams(44100, 1) ~%~%
reset(44100) ~%~%
load(\"AM\") ~%~%
rtinput(\"~a\") ~%~%
rtoutput(\"~a\") ~%~%
makegen(2, 10, 10000, 1)~%~%"
main-aiff-filename am-aiff-filename)
(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)
(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 .03 (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))))))
;
; run the score
(shell (concatenate 'string "CMIX < " am-score-filename))
; move .am.aiff to .aiff
(shell (concatenate 'string "mv " am-aiff-filename " " main-aiff-filename))
;
))
;
;************************************************************************
;*************************************************************************
;**************************************************************************
;******************************************************************************
;******************************************
;******************************************
;******************************************
;******************************************
; WWAVE: (CRESC-DECRESC M E)
;******************************************
;******************************************
;******************************************
;******************************************
; for cresc, the main dynamic should be the higher one
(defmethod write-cmix-score ((note cresc-decresc)
(instr wwave)
(score-file t))
(let ((dur-in-ms '0.0)
(dynamic (dynamic note))
(mid (first (extra-params note)))
(end (second (extra-params note)))
(float-hi '1.0)
(float-low '.12)
(times ())
(last-usable-time-point '0)
(cur-time '0)
(x-increment '0)
(x '0.01)
(values ())
(cter '2)
(direction '1)
(amp-makegen ())
(line ())
(line-length '0)
(deviance-makegen ())
(rate-o-change-makegen ())
(gliss-makegen ())
(amp '0))
; write makegen 2 -- amp env.
; 5 -- allowable deviation
; 6 -- average amnt of change of harms
; 7 -- gliss curve (for vib, etc.)
;
(setf dur-in-ms (truncate (* 1000.0 (desired-dur note))))
; dynamic is set to louder value of cresc.
(setf dynamic (dynamic note))
;
; AMPLITUDE MAKEGEN
;
;
(setf times
(append
'(0.0)
(list (/ (* (const-frandom .02 .03)
end)
(desired-dur note)))
(list (* (const-frandom .23 .35) mid))
(list (* (const-frandom .55 .75) mid))
(list (* (const-frandom .85 .9) mid))
(list (* (const-frandom .93 .97) mid))
(list mid)
(list (+ mid (* (const-frandom .03 .05) (- end mid))))
(list (+ mid (* (const-frandom .1 .3) (- end mid))))
(list (+ mid (* (const-frandom .35 .45) (- end mid))))
(list (+ mid (* (const-frandom .55 .65) (- end mid))))
(list (- end (/ (* (const-frandom .02 .03)
end)
(desired-dur note))))
(list end)))
;
;
(setf values
(append
'(0.0)
(list (const-frandom 0.03 0.07))
(list (const-frandom 0.1 0.3))
(list (const-frandom 0.4 0.5))
(list (const-frandom 0.6 0.8))
(list (const-frandom 0.85 0.95))
'(1.0)
(list (const-frandom 0.85 0.95))
(list (const-frandom 0.6 0.8))
(list (const-frandom 0.3 0.4))
(list (const-frandom 0.1 0.3))
(list (const-frandom 0.03 0.07))
'(0.0)))
;
;
(dotimes (ct (length times))
(setf amp-makegen (append amp-makegen
(list (nth ct times)) (list (nth ct values)))))
; finally, write in the 24, xxxxxx values
(setf amp-makegen
(append '(24)
(list dur-in-ms)
amp-makegen))
; write it to the file
(format score-file "~% makegen(-2")
(dolist (elle amp-makegen)
(format score-file ", ~a" elle))
(format score-file ")~% ~% ~%")
;
;
; CURVE OF ALLOWABLE HARMONIC STRENGTH DEVIATION
;
;
(setf times
(append
'(0.0)
(list (/ (* (const-frandom .02 .03)
end)
(desired-dur note)))
(list (* (const-frandom .3 .5) mid))
(list (* (const-frandom .55 .65) mid))