#| ********************************************* Rethinking the Weather Jen Carlile March 14, 2005 Music 220B Final Project ************************************************|# ;(compile-file "piano.ins") ;(compile-file "cut.ins") ;(load "piano.cmucl") ;(load "cut.cmucl") (setf *clm-locsig-type* mus-interp-sinusoidal) ;;Basic Functions (defun sun (duration amp pitch) (loop for i from 0 to 23 do (p (* i (/ duration 24)) ;one note per hour of the day, spread out over the piece length :duration (* (/ duration 18) (between 1.0 2.0)) :keyNum (+ pitch (* 0.05 (between -1.5 1.5))) :strike-velocity amp :DryPedalResonanceFactor 0.5 :singleStringDecayRateFactor 1/12 :degree (* i (/ 360 24)) )) ) (defun cloud (startTime numNotes duration &key (startKey 60) ;60 = middle C (tuning 1.0) ;how 'detuned' is the cloud--1 corresponds to chromatic scale, fractions to microtonal tuning (centerDegree 45) (distance 1.0) (cloudWidth 15) (decayFactor 1/1) ;1/2 takes twice as long to decay as normal (keyVelocity 0.4) ;range from 0 to 1.0 (durSpreadLo 1.0) ;how long will the cloud particles last (durSpreadHi 2.0) (cloudSpread 5) );magnitude of the cloud detuning (loop for i from 0 to numNotes do (p (+ startTime (+ (* i (/ duration numNotes)) (between 0.0 0.1))) ;start time :duration (* (/ duration numNotes) (between durSpreadLo durSpreadHi)) :keyNum (+ startKey (* tuning (between (* -1 cloudSpread) cloudSpread))) :strike-velocity keyVelocity :DryPedalResonanceFactor 0.5 :singleStringDecayRateFactor decayFactor :degree (+ centerDegree (ran :from (* -1 cloudWidth) :below cloudWidth :type :triangular)) :distance distance :stiffnessFactor-table '(80 1.0 108 0.9 110 0.9 120 0.8 130 0.8 150 0.7)) (p (+ startTime (+ (* i (/ duration numNotes)) (between 0.0 0.1))) ;start time :duration (* (/ duration numNotes) (between durSpreadLo durSpreadHi)) :keyNum (+ startKey (* tuning (between (+ 2 (* -1 cloudSpread)) (- cloudspread 2)))) :strike-velocity keyVelocity :DryPedalResonanceFactor 0.5 :singleStringDecayRateFactor decayFactor :degree (+ centerDegree (ran :from (* -1 cloudWidth) :below cloudWidth :type :triangular)) :distance distance :stiffnessFactor-table '(80 1.0 108 0.9 110 0.9 120 0.8 130 0.8 150 0.7)) ) ) ;; Heap and Layer Clouds #| Fair-weather Cumulus clouds are low-level clouds that usually appear in the late morning orearly afternoon in settle weather. Surface air comes in contact with the sun-warmed earth and the warmer "bubbles" of air rise into the atmosphere where the water vapor in them eventually condenses. The clouds are only a few hundred meters thick because the air mass is generally stable. Individual clouds are well separated by areas of descending air, where there are no clouds. |# (defun fairWeatherCumulus (startTime numNotes duration amp startPitch degree &key (df 1/1)) ;1/2 takes twice as long to decay as normal (cloud startTime numNotes duration :startKey startPitch :tuning 1.0 :centerDegree degree :cloudWidth 20 :decayFactor df :keyVelocity amp :durSpreadLo 1.0 :durSpreadHi 3.0 :cloudSpread 5) ) #| Altostratus, or high stratus, occurs in the middle elevations between 10,000 and 20,000 ft. It is primarily a cloud made of water droplets, not ice, though some of the water droplets may be supercooled. Generally gray in color because of the large size of the droplets, it often covers the entire sky and may be think enough to obscure the sun. If the clouds are thin and ice ctystals are present, the sun looks as it does when seen through a piece of ground glass. It is often the forerunner of a nimbostratus |# (defun altostratus (startTime numNotes duration amp startPitch degree &key (df 1/1)) (cloud startTime numNotes duration :startKey startPitch :tuning 8.0 :centerDegree degree :cloudWidth 100 :decayFactor df :keyVelocity amp :durSpreadLo 6.0 :durSpreadHi 10.0 :cloudSpread 12));was 30 tuning was 8.0 #| Cumulus congestus is an extended development of swelling cumuls that forms in a still more energetic and unstable atmosphere. This cloud mass is made up of thousands of individual convection cells, all at different stages of their growth cycle. The activity of cumuls congestus comes from the release of heat energy when vapor condenses to liquid. The still-growiung top of the cloud is made of sharp endged bumps, evidence that the mass has not turned into the ice of a cumulonimbus cloud |# (defun cumulusCongestus (startTime numNotes duration amp startPitch degree &key(df 1/1)) (fairWeatherCumulus startTime numNotes duration amp startPitch degree :df df) (cloud (+ (/ duration 4) startTime) numnotes (* 5 (/ duration 8)) :startKey (+ 8 startPitch) :tuning 2.0 :centerDegree degree :cloudWidth 10 :decayFactor df :keyVelocity (* 1.5 amp) :durSpreadLo 1.0 :durSpreadHi 2.0 :cloudSpread 5)) #| Altocumulus clouds are residents of the middle altitudes between 10,000 and 20,000 ft. This high-layered heap cloud, one of the most pleasing to the eye, looks like a flock of sheep standing close together in a sky pasture. Altocumulus forms where there is ample moisture and unstable stratification bounded by a stable upper layer. The cloud can cover the entire sky or appear in smaller bands. It is sometimes called buttermilk sky. |# (defun altocumulus (startTime numNotes duration amp startPitch degree &key (df 1/1)) (altostratus startTime numNotes duration amp startPitch degree :df df) (altostratus startTime (* 2 numNotes) duration (* 0.8 amp) (- startPitch 2) degree :df df)) ;; Precipitating clouds #| Nimbostratus is the cloud form that produces continuous rain or snow. It is a thick mass of cloud with no well-defined base, usually covering the whole sky. The color is dark gray. The lower edges may appear ragged. Nimbostratus results from a mass of warm moist air rising over the surface of the warom of occluded front. It can be widespread, covering an area of one of more states. |# (defun nimbostratus (startTime numNotes duration amp startPitch degree &key (df 1/2) (howRainy 0.4)) (altostratus startTime numNotes duration amp startPitch degree :df df) ;;now for some precipitation (let* ((dur (/ duration 3))) ;play soundfile at three diff locations (one-cut (+ startTime 2) howRainy :soundfile "storm/Raining1.wav" :duration duration :degree (- degree 30)) (one-cut (+ startTime 2.2) howRainy :soundfile "storm/Raining1.wav" :duration duration :sound-start-time dur :degree degree) (one-cut (+ startTime 2.1) howRainy :soundfile "storm/Raining1.wav" :duration duration :sound-start-time (* 2 dur) :degree (+ degree 30)) )) #| Cumulonimbus is the most energetic of all the cumulus, or heap family. It is made up of many thousands of individual convection cells. The top penetrates above the freezing level, where water droplets are transformed into ice crystals. Heavy downpours of rain fall from the base of cumulonimbus clouds. In some conditions the precipitation may be in the form of the ice balls we call hail. In other conditions, lightning with consequent thunder, discharges from cloud to ground or from cloud to cloud |# (defun cumulonimbus (startTime numNotes duration amp startPitch degree &key(df 1/2) (thunder nil) (numThunder 1)(thunderAmp 0.7)) (cumuluscongestus startTime numNotes duration amp startPitch degree :df df) (if thunder (progn (thunder1 (+ startTime 2.5) thunderAmp :degree degree :num numThunder) (thunder2 (+ startTime 4) thunderAmp :degree degree :num numThunder))) ) ; Some other possible functions to be defined later ;(defun fog (***********)) ;(defun contrails (***********************)) ;; Some functions to play field recordings. These soundfiles are from a thunderstorm I experienced while I was in Stockholm from out my apartment window. (defun sfplayer (startTime amp num soundfile &key(degree 45)(length 12)) (loop repeat num for time = 0 then (+ time length) do (one-cut (+ startTime time) amp :soundfile soundfile :amp-func '(0 0 0.01 1 0.95 1 0.99 0) :degree degree))) (defun thunder1 (startTime amp &key(degree 45)(num 1) ) (sfplayer startTime amp num "storm/Thunder1.wav" :degree degree :length 12)) (defun thunder2 (startTime amp &key(degree 45) (num 1)) (sfplayer startTime amp num "storm/Thunder2.wav" :degree degree :length 12)) (defun piano (startTime amp &key(degree 45) (num 1)) (sfplayer startTime amp num "storm/piano1.wav" :degree degree :length 9)) (defun rainThunderPiano (startTime amp &key (degree 45) (num 1)) (sfplayer startTime amp num "storm/rainthunderpiano1.wav" :degree degree :length 64)) (defun rainCarThunder (startTime amp &key(degree 45) (num 1)) (sfplayer startTime amp num "storm/raincarthunder.wav" :degree degree :length 46)) (defun likefireworks (startTime amp &key(degree 45) (num 1)) (sfplayer startTime amp num "storm/likefireworks.wav" :degree degree :length 30)) (defun piano2 (startTime amp &key (degree 45) (num 1)) (sfplayer startTime amp num "storm/piano2.wav" :degree degree :length 19)) (defun rainingHard (startTime amp &key (degree 45) (num 1)) (sfplayer startTime amp num "storm/raininghard.wav" :degree degree :length 24)) (defun siren (startTime amp &key (degree 45) (num 1) (thunder t)) (if thunder (sfplayer startTime amp num "storm/sirenthunder.wav" :degree degree :length 24) (sfplayer startTime amp num "storm/siren.wav" :degree degree :length 44))) ;; Rethinking the Weather (with-sound (:channels 2) (with-mix() "sun" 0 (sun 260 0.3 84)) (with-mix() "cl1a" 0 (altostratus 0 30 20 0.2 50 46)) (with-mix() "cl1" 10 (fairWeatherCumulus 0 70 8 0.1 75 21 :df 1/3)) ; -35 change these degrees if you want more than 2 channels (with-mix() "cl2" 17 (fairWeatherCumulus 0 50 10 0.1 85 81 :df 1/3)); 260 ;(with-mix() "cl3" 8 (fairWeatherCumulus 0 40 12 0.3 62 50 :df 1/4)) ;50 (with-mix() "cl4" 24 (fairWeatherCumulus 0 30 3 0.4 40 36 :df 1/4)) ;200 (with-mix() "cl5" 25 (cumulusCongestus 0 100 20 0.21 53 55 :df 1/2)) ;220 (with-mix() "cl6" 43 (altocumulus 0 42 20 0.25 68 44 :df 1/2));0 clips! (with-mix() "cl7" 50 (altostratus 0 40 20 0.3 62 44 :df 1/3));0 (with-mix() "cl8" 70 (altostratus 0 45 20 0.2 70 44 :df 1/3));180 (with-mix() "cl9" 80 (nimbostratus 0 40 30 0.4 62 45 :df 1/4 :howRainy 0.2)) (with-mix() "cl10" 100 (thunder1 0 0.5 :num 3 :degree 20)) (with-mix() "cl11" 104 (cumulonimbus 0 130 32 0.1 65 44 :df 1/3 :thunder t :numthunder 2)) (with-mix() "cl11b" 113 (fairWeatherCumulus 0 30 3 0.25 45 60 :df 1/2)) (with-mix() "cl12" 115 (rainThunderPiano 0 0.9 :num 1)) (with-mix() "cl13" 140 (siren 0 0.4 :thunder t)) (with-mix() "cl14" 170 (piano 0 0.6 :num 3)) (with-mix() "cl15" 180 (rainCarThunder 0 0.5)) (with-mix() "cl16" 210 (rainingHard 0 0.1)) (with-mix() "cl17" 220 (altostratus 0 30 20 0.2 50 46)) (with-mix() "cl18" 240 (thunder2 0 0.3 :num 2)) (with-mix() "cl19" 250 (likefireworks 0 0.35)) (with-mix() "cl20" 260 (nimbostratus 0 35 15 0.3 48 38 :df 1/2 :howRainy 0.1)) (with-mix() "cl21" 265 (piano2 0 0.2)) (with-mix() "cl22" 266 (piano 0 0.2)) (with-mix() "cl23" 267 (cumulusCongestus 0 20 5 0.2 38 51)) ) #| ;;TESTING MY FUNCTIONS (with-sound (:channels 2) (fairWeatherCumulus 0 90 10 0.2 75 45 :df 1/3)) (with-sound (:channels 2) (altostratus 0 40 20 0.1 62 45 :df 1/5)) (with-sound (:channels 2) (altocumulus 0 40 20 0.1 50 45 :df 1/5));62 is nice maybe try 50? (with-sound (:channels 2) (sun 12 0.3 84)) (with-sound (:channels 2) (cumulusCongestus 0 100 10 0.1 62 45 :df 1/5)) (with-sound (:channels 2) (nimbostratus 0 40 20 0.4 62 45 :df 1/7 :howRainy 0.3)) (with-sound (:channels 2) (cumulonimbus 0 200 20 0.2 65 45 :df 1/5 :thunder t :numthunder 2)) (with-sound (:channels 2) (thunder1 0 0.5 :num 3)) |#