logistic11.csd; csound logistic11.csd; sox logistic11.wav tmp.wav trim 0 325 pad 1 0; mv tmp.wav logistic11.wav; lame -h -V 0 logistic11.wav logistic11.mp3 class MappingSonification { public $no = 1; public $nog = 101; public $ga_in1= "ga1in1"; public $ga_in2= "ga1in2"; public $time_from = 0.0; public $time_until = 120.0; public $time_add = 10.0; public $minfreq= 0.0; public $maxfreq= 2400.0; public $TETyes= 1; // 平均律にするかどうか (1 / 0) public $TETnum= 5; // 1オクターブをTETnum等分の平均律 public $TETzure= 0.01; // 平均律化後にわざと残すずれ // linen xamp, irise, idur, idec // linseg ia, idur1, ib [, idur2] [, ic] [...] public $envelope = "linseg 0, 0.01,1, p3*0.1,0.5, p3*0.2,0.2, p3*0.7-0.01,0"; public $waveform = "0 8192 10 1"; // 正弦波を表すテーブル public $const_pan= -0.05; public $weight_pan= 1.0; public $const_velo= 0.7; public $weight_velo= -0.7; public $const_dur= 4.0; public $weight_dur= -4.0; // public $weight_intvl= 0.005; public $const_intvl= 0.0001; public $const_intvl= 1.5; public $weight_intvl= -1.3; public $map1c= 0.982; // map1 coeff public $map2c= 0.98; // map2 coeff public $gvolumetable = "0 1024 -7 1.0 1024 1.0"; // "0 1024 -7 0.0 100 1.0 600 0.0 100 1.0 223 1.0"; function __construct($no){ $this->no= $no; $this->nog= $no+100; $this->ga_in1= "ga{$no}in1"; $this->ga_in2= "ga{$no}in2"; } function setParameters($time_from,$time_until,$minfreq,$maxfreq){ $this->time_from= $time_from; $this->time_until= $time_until; $this->minfreq= $minfreq; $this->maxfreq= $maxfreq; } function setParametersTET($TETyes,$TETnum,$TETzure){ $this->TETyes= $TETyes; $this->TETnum= $TETnum; $this->TETzure= $TETzure; } function setParametersPan($a,$b) { $this->const_pan= $a; $this->weight_pan= $b; } function setParametersVelo($a,$b){ $this->const_velo= $a; $this->weight_velo= $b; } function setParametersDur($a,$b) { $this->const_dur= $a; $this->weight_dur= $b; } function setParametersIntvl($a,$b){ $this->const_intvl= $a; $this->weight_intvl= $b; } function map1($x){ return 4.0*$this->map1c*$x*(1.0-$x); } function map2($x){ return 4.0*$this->map2c*$x*(1.0-$x); } public function gaInit() { echo " $this->ga_in1 init 0 $this->ga_in2 init 0 "; } public function makeInstrumentFirst(){ $ga_in1= $this->ga_in1; $ga_in2= $this->ga_in2; echo " instr $this->no kenv1 $this->envelope ; oscil xamp, xcps, ifn [, iphs] atmp1 oscil kenv1*p4, p5, $this->no aL0 = atmp1*p6 aR0 = atmp1*(1-p6) $ga_in1 = $ga_in1 + aL0 $ga_in2 = $ga_in2 + aR0 endin "; } public function makeInstrumentGlobalVolume($gvolumestr){ $phasorfreq = 1.0/($this->time_until + $this->time_add - $this->time_from); echo " kph1 phasor $phasorfreq ilength = ftlen($this->nog) $gvolumestr tablei kph1*ilength, $this->nog"; } public function makeInstrumentGlobal(){ $ga_in1= $this->ga_in1; $ga_in2= $this->ga_in2; echo "instr $this->nog"; $this->makeInstrumentGlobalVolume("kvol1"); echo " denorm $ga_in1 denorm $ga_in2 ; freeverb ainL, ainR, kRoomSize, kHFDamp[, iSRate[, iSkip]] aL, aR freeverb $ga_in1, $ga_in2, 0.7, 0.1 ;aL1 lowpass2 aL, 1200, 1 ;aR1 lowpass2 aR, 1200, 1 ;outs aL1 , aR1 outs (aL*2.0+$ga_in1)*kvol1, (aR*2.0+$ga_in2)*kvol1 $ga_in1 = 0 $ga_in2 = 0 endin "; } public function makeInstrument(){ $this->makeInstrumentFirst(); $this->makeInstrumentGlobal(); } public function freq($mf){ $TETr= pow(2.0,(1.0/$this->TETnum)); // 1音分の周波数の比率 2^(1/$TETnum) $fr= ($this->maxfreq - $this->minfreq)*$mf + $this->minfreq; if ($this->TETyes){ // TETnum-平均律に量子化 $frtmp= round( log($fr/440.0)/log($TETr) ); $frtmp= 440.0*(pow($TETr,$frtmp)); // 440.0*($TETr^$frtmp) $fr= (1-$this->TETzure)*$frtmp + $this->TETzure*$fr; // ずれを残す } return $fr; } public function makeScoreTable(){ $time_end= $this->time_until+ $this->time_add; echo " ; GEN10 : time size 10 str1 str2 str3 str4 ... : weighted sums of simple sinusoids. f $this->no $this->waveform i $this->nog $this->time_from $time_end f $this->nog $this->gvolumetable "; } public function makeScore(){ $this->makeScoreTable(); $mf= 0.125; $mfl= 0.9; // 初期値 $fln= $this->time_from; // 初期値 発音の時刻 while( $fln < $this->time_until ){ $mf= $this->map1($mf); $mfl= $this->map2($mfl); $fr= $this->freq($mf); // 周波数 $fdur= $this->weight_dur* $mf + $this->const_dur; // 音の長さ $fv= ($this->weight_velo*$mf + $this->const_velo)*30000; // 音の強さ $fl= $this->weight_pan* $mfl + $this->const_pan; // 定位 // start dur amp pitch 定位 printf("i%g %g %g %g %g %g\n",$this->no, $fln, $fdur, $fv, $fr, $fl); // 発音のタイミング $fln += $this->weight_intvl*$mfl + $this->const_intvl; } // --------------- while($fln < .. ---------------------- } } ?> nog"; $this->makeInstrumentGlobalVolume("kvol1"); // no reverb echo " outs $this->ga_in1 * kvol1, $this->ga_in2 * kvol1 $this->ga_in1 = 0 $this->ga_in2 = 0 endin "; } } class MappingSonificationNoReverbStrings extends MappingSonificationNoReverb { public function __construct($no) { parent::__construct($no); $this->TETyes= 0; // linseg ia, idur1, ib [, idur2] [, ic] [...] $this->envelope = "linseg 0, 0.2,1, p3*0.1,1.0, p3*0.5,0.8, p3*0.15-0.2,0.0"; $this->waveform = "0 512 7 1 512 -1"; // saw tooth; $this->gvolumetable = "0 1024 -7 0.0 24 1.0 1000 1.0"; // "0 1024 -7 1 512 1 0 -1 512 -1"; // square parent::setParametersVelo(0.04,-0.004); parent::setParametersDur(0.9,-0.05); parent::setParametersIntvl(0.02,0.0002); } public function makeScore(){ $this->makeScoreTable(); // 初期値 $mf= 0.125; $mfl= 0.9; $mfl2= 0.9; $fln= $this->time_from; // 初期値 発音の時刻 while( $fln < $this->time_until ){ $mf= $this->map1($mf); $mfl= $this->map2($mfl); $fr= $this->freq($mf); // 周波数 $fdur= $this->weight_dur* $mf + $this->const_dur; // 音の長さ $fv= ($this->weight_velo*$mf + $this->const_velo)*30000; // 音の強さ // $fl= $this->weight_pan* $mfl + $this->const_pan; // 定位 for ($i=0; $i<10; $i++){ $mfl2= $this->map2($mfl2); $fl= $mfl2-0.1; // start dur amp pitch 定位 printf("i%g %g %g %g %g %g\n",$this->no, $fln, $fdur, $fv, $fr*(1.0+$mfl2*0.03), $fl); } // 発音のタイミング // $fln += $this->weight_intvl * ( ceil(15.0/($mfl+$this->const_intvl)) ); $fln += $this->weight_intvl*$mfl + $this->const_intvl; } // --------------- while($fln < .. ---------------------- } } ?> setParameters(0,220, 0,2400); $a1->setParametersVelo(0.5,-0.5); $a1->gvolumetable = "0 1024 -7 0.0 200 0.2 100 1.2 200 1.0 200 1.0 324 0.8"; $a2 = new MappingSonificationNoReverb($objno++); $a2->setParameters(0,240, 50,300); $a2->setParametersVelo($a1->const_velo*0.6, $a1->weight_velo*0.3); $a2->setParametersDur($a1->const_dur*0.8, $a1->weight_dur*0.5); $a2->setParametersIntvl(0.3,-0.29); $a2->gvolumetable = $a1->gvolumetable; $a3 = new MappingSonificationNoReverbStrings($objno++); $a3->setParameters(0,80, 0,2400); $a3->gvolumetable = "0 1024 -7 0.0 50 0.1 250 0.1 50 1.0 250 1.0 10 0.0 90 0.0 30 1.0 294 1.0"; $a4 = new MappingSonificationNoReverbStrings($objno++); // $a4->setParameters(10,50, 0,440); $a4->setParameters(10,50, 0,400); $a4->setParametersVelo($a3->const_velo*0.4, $a3->weight_velo*0.4); $a4->setParametersDur($a3->const_dur*10, $a3->weight_dur*10); $a4->setParametersIntvl($a3->const_intvl*10, $a3->weight_intvl*10); $a4->gvolumetable = $a3->gvolumetable; $a5 = new MappingSonification($objno++); // pad $a5->setParameters(130,260, 100,600); // linen xamp, irise, idur, idec $a5->envelope = "linen 1, 1, p3, p3"; $a5->setParametersIntvl(0.01,-0.008); $a5->setParametersDur(1.0,-1.0); $a5->setParametersVelo(0.28,-0.28); $a5->setParametersTET(1, 5, 0.05); $a5->gvolumetable = "0 1024 -7 0.0 224 1.0 800 1.0"; $a6 = new MappingSonification($objno++); $a6->setParameters(120,280, 0,2400); $a6->setParametersVelo(0.30,-0.30); // $a6->gvolumetable = "0 1024 -7 0.0 200 0.2 500 1.0 1000 1.0"; // $TETyes,$TETnum,$TETzure $a6->setParametersTET(1, 10, 0.1); $a7 = new MappingSonificationNoReverbStrings($objno++); $a7->setParameters(230,320, 0,400); $a7->gvolumetable = "0 1024 -8 0.0 100 0.5 200 0.5 650 0.0 74 0.0"; $a7->setParametersTET(1, 7, 0.01); $a7->setParametersIntvl(0.1,0.008); $a7->setParametersDur(3.0,-1.0); ?> ; author: KITA Toshihiro http://t-kita.net ; license: http://creativecommons.org/licenses/by/3.0/ ; -d -m0 -W -odevaudio -d -m0 -W -o logistic11.wav sr = 44100 ; サンプリング周波数 kr = 4410 ; 制御信号周波数 ksmps = 10 ; それらの比 nchnls = 2 ; 出力チャネル数 gaInit(); } ?> makeInstrument(); } ?> makeScore(); } ?> e