Physical Modelling and Waveshaping
Here is the (very simple!) header of the instrument and a short description of its parameters:
(defcinstrument singer (beg amp data)
Glotal excitations:
(with-sound () (singer 0 .1 '((.4 ehh.shp test.glt 523.0 .8 0.0 .01) (.6 oo.shp test.glt 523.0 .7 .1 .01))))
(with-sound () (singer 0 .1 '((.05 ehh.shp test.glt 523.0 0.8 0.0 .01) (.15 ehh.shp test.glt 523.0 0.8 0.0 .01) (.05 kkk.shp test.glt 523.0 0.0 0.0 .01) (.05 kkk.shp test.glt 523.0 0.0 0.0 .01) (.02 kk+.shp test.glt 523.0 0.0 1.0 .01) (.08 kk+.shp test.glt 523.0 0.0 0.2 .01) (.05 ooo.shp test.glt 523.0 0.8 0.0 .01) (.15 ooo.shp test.glt 523.0 0.8 0.0 .01) (.05 eee.shp test.glt 523.0 0.8 0.0 .01) (.15 eee.shp test.glt 523.0 0.8 0.0 .01) (.05 ehh.shp test.glt 523.0 0.8 0.0 .01) (.15 ehh.shp test.glt 523.0 0.8 0.0 .01) (.05 mmm.shp test.glt 523.0 0.8 0.0 .01) (.15 mmm.shp test.glt 523.0 0.8 0.0 .01) (.10 mmm.shp test.glt 523.0 0.0 0.0 .01) )))In the following example we are using a soundfile as an excitation function. In this case a gunshot would be processed by the vocal tract of the model. Highly unpleasant, I guess.
(with-sound () (singer 0 .1 '((.05 ehh.shp "pistol.snd" 523.0 0.8 0.0 .01) (.15 ehh.shp "pistol.snd" 523.0 0.8 0.0 .01) (.05 kkk.shp "pistol.snd" 523.0 0.0 0.0 .01) (.05 kkk.shp "pistol.snd" 523.0 0.0 0.0 .01) (.02 kk+.shp "pistol.snd" 523.0 0.0 1.0 .01) (.08 kk+.shp "pistol.snd" 523.0 0.0 0.2 .01) (.05 ooo.shp "pistol.snd" 523.0 0.8 0.0 .01) (.15 ooo.shp "pistol.snd" 523.0 0.8 0.0 .01) (.05 eee.shp "pistol.snd" 523.0 0.8 0.0 .01) (.15 eee.shp "pistol.snd" 523.0 0.8 0.0 .01) (.05 ehh.shp "pistol.snd" 523.0 0.8 0.0 .01) (.15 ehh.shp "pistol.snd" 523.0 0.8 0.0 .01) (.05 mmm.shp "pistol.snd" 523.0 0.8 0.0 .01) (.15 mmm.shp "pistol.snd" 523.0 0.8 0.0 .01) (.10 mmm.shp "pistol.snd" 523.0 0.0 0.0 .01) )))
Here is the header of the instrument and a short description of some of its parameters:
(definstrument (p :language :c :c-options "-c -O3") (&key (start 0.0) (duration 1.0) (keyNum 60.0) (strike-velocity 0.5) (pedal-down nil) (release-time-margin 0.75) (amp .5) ;;slider controls (detuningFactor 1.0) (detuningFactor-table '()) (stiffnessFactor 1.0) (stiffnessFactor-table '()) (pedalPresenceFactor .3) (longitudinalMode 10.5) (StrikePositionInvFac -0.9) (singleStringDecayRateFactor 1.0) ;; parameter tables indexed by keyNum ;; NB: you can override the loudPole-table by directly setting :loudPole to a value loudPole (loudPole-table default-loudPole-table) softPole (softPole-table default-softPole-table) loudGain (loudGain-table default-loudGain-table) softGain (softGain-table default-softGain-table) strikePosition (strikePosition-table default-strikePosition-table) detuning2 (detuning2-table default-detuning2-table) detuning3 (detuning3-table default-detuning3-table) stiffnessCoefficient (stiffnessCoefficient-table default-stiffnessCoefficient-table) singleStringDecayRate (singleStringDecayRate-table default-singleStringDecayRate-table) singleStringZero (singleStringZero-table default-singleStringZero-table) singleStringPole (singleStringPole-table default-singleStringPole-table) releaseLoopGain (releaseLoopGain-table default-releaseLoopGain-table) DryTapFiltCoefT60 (DryTapFiltCoefT60-table default-DryTapFiltCoefT60-table) DryTapFiltCoefTarget (DryTapFiltCoefTarget-table default-DryTapFiltCoefTarget-table) DryTapFiltCoefCurrent (DryTapFiltCoefCurrent-table default-DryTapFiltCoefCurrent-table) DryTapAmpT60 (DryTapAmpT60-table default-DryTapAmpT60-table) sustainPedalLevel (sustainPedalLevel-table default-sustainPedalLevel-table) pedalResonancePole (pedalResonancePole-table default-pedalResonancePole-table) pedalEnvelopeT60 (pedalEnvelopeT60-table default-pedalEnvelopeT60-table) soundboardCutoffT60 (soundboardCutoffT60-table default-soundboardCutoffT60-table) DryPedalResonanceFactor (DryPedalResonanceFactor-table default-DryPedalResonanceFactor-table) unaCordaGain (unaCordaGain-table default-unaCordaGain-table))
(with-sound (:output "/zap/thnormal.snd") (loop for i from 0 to 7 do (p (* i .5) :duration .5 :keyNum (+ 24 (* 12 i)) :strike-velocity .5 ; 0 to 1, 0 is softest played note, 1 is loud note :amp .4 ;overall volume level :DryPedalResonanceFactor .25 ;0 no open string resonance ;1.0 is about full resonance of dampers raised ;can be greater than 1.0 )))
(with-sound (:output "/zap/thstiff.snd") (loop for i from 0 to 7 do (p (* i .5) :duration .5 :keyNum (+ 24 (* 12 i)) :strike-velocity .5 ;0 to 1, 0 is softest played note, 1 is loud note :amp .4 ;overall volume level :DryPedalResonanceFactor .25 ;0 no open string resonance ;1.0 is about full resonance of dampers raised ;can be greater than 1.0 ;;modification to do detunedness :detuningFactor-table '(24 5 36 7.0 48 7.5 60 12.0 72 20 84 30 96 100 108 300) ;scales the above detuning values ; so 1.0 is nominal detuning ; 0.0 is exactly in tune (no two stage decay...) ; > 1.0 is out of tune... ;;modification to do stiffness :stiffnessFactor-table '(21 1.5 24 1.5 36 1.5 48 1.5 60 1.4 72 1.3 84 1.2 96 1.0 108 1.0) ;0.0 to 1.0 is less stiff, 1.0 to 2.0 is more stiff... )))
(with-sound (:output "/zap/thdamped.snd") (loop for i from 0 to 7 do (p (* i .5) :duration .5 :keyNum (+ 24 (* 12 i)) :strike-velocity .5 ;0 to 1, 0 is softest played note, 1 is loud note :amp .4 ;overall volume level :DryPedalResonanceFactor .25 ;0 no open string resonance ;1.0 is about full resonance of dampers raised ;can be greater than 1.0 ;;modifications to do damped sounds :singleStringDecayRate-table '(21 -5 24.000 -5.000 36.000 -5.4 41.953 -5.867 48.173 -7.113 53.818 -8.016 59.693 -8.875 66.605 -9.434 73.056 -10.035 78.931 -10.293 84.000 -12.185) :singleStringPole-table '(21 .8 24 0.7 36.000 .6 48 .5 60 .3 84 .1 96 .03 108 .03) :stiffnessCoefficient-table '(21.000 -0.920 24.000 -0.900 36.000 -0.700 48.000 -0.250 60.000 -0.100 75.179 -0.040 82.986 -0.040 92.240 .3 96.000 .5 99.000 .7 108.000 .7) ;these are the actual allpass coefficients modified here ;to allow dampedness at hig freqs )))
(defcinstrument plucky (beg dur freq amplitude &optional (maxA 1.0))
(defcinstrument bow (beg dur frq amplitude &optional (maxA 1.0))NOTE: freq is off in this one (in PRC's original also)
(defcinstrument brass (beg dur freq amplitude &optional (maxA 1.0)) (defcinstrument clarinet (beg dur freq amplitude &optional (maxA 1.0)) (defcinstrument flute (beg dur freq amplitude &optional (maxA 1.0))
(definstrument pluck (start dur freq amp &key (weighting 0.9) (lossfact 0.99) (decaytime 6) (attacktime 0.01))
©1997/98 Fernando Lopez-Lezcano. All Rights Reserved. nando@ccrma.stanford.edu
|