Last active
September 13, 2021 07:00
-
-
Save yotamorimoto/2276956 to your computer and use it in GitHub Desktop.
event and pbind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Pbind シンセ生成と引数にわたすストリームを bind (結びつけ) | |
| 音楽のフレーズの生成を可能にする | |
| Pbind(\instrument, シンセの名前, 引数名、値、引数名、値…).play; | |
| 先につくったハイハットのシンセ | |
| ( | |
| SynthDef(\hat, {| amp=0.1, pan=0 | | |
| var sig, env; | |
| env = EnvGen.kr(Env.perc(0, 0.03), 1, amp, doneAction: 2); | |
| sig = WhiteNoise.ar; | |
| sig = HPF.ar(sig, 8000); | |
| sig = Pan2.ar(sig, pan, env); | |
| Out.ar(0, sig); | |
| }).add; | |
| ) | |
| ~(チルダ)は宣言なしでグローバル変数をつくる | |
| ~hatA = Pbind(\instrument, \hat, \dur, 0.25, \amp, Pseq([0.4, 0.2, 0.3, 0.2], inf)); | |
| ~hatA.play; | |
| \dur はあらかじめ決められたキーワード | |
| ここでは 1/4 拍ごとにシンセが生成される | |
| \amp は引数で定義済み | |
| ここでは強拍にアクセントがある 16 分音符 4 つの繰返しをつくっている | |
| テンポはデフォルトで1拍が1秒 | |
| TempoClock.default.tempo = 1; // = 60 bpm (beat per minuet) | |
| 変更する | |
| TempoClock.default.tempo = 80/60; // = 80 bpm | |
| 音をとめる | |
| ~hatA.stop; | |
| 実践1 | |
| ハイハットシンセの pan 引数を動かすパターンをつくる | |
| 実践2 | |
| ハイハットシンセの amp 引数をランダムに動かすパターンをつくる | |
| Prand, Pwhite などを使う |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment