Interactive Music II SuperCollider入門 5 時間構造をつくる

Preview:

Citation preview

Interactive Music II SuperCollider入門 5 時間構造をつくる

2013年10月31日 東京藝術大学芸術情報センター(AMC) 田所 淳

今日の内容‣ 時間構造をつくる !

‣ エンベロープ(Envelope): 音量の時間的な変化 ‣ EnvGen, Env !

‣ スケジューリング ‣ Rutine

SuperColliderにおける時間構造‣ ここまでは、プログラムした単体の音を鳴らすだけだった ‣ 音楽、音響作品にしていくには、音を時間構造の中で配置していかなくてはならない !

‣ SuperColliderでの時間構造のとらえ方 ‣ シーケンサーや、DAW(ProToolsなど)などの時間の考え方とは異なる

‣ ロジックによる時間構造の構築 (←→ タイムライン) ‣ 時間の流れは一つとは限らない

エンベロープ (Envelope)

エンベロープ (Envelope)‣ 音の3要素: 音高、音量、音色 !

‣ しかし、それ意外にも重要な要素がある ‣ 音の時間的な変化 → エンベロープ !

‣ 同じ音色でも、そのエンベロープが異なると違うキャラクターの音になる

エンベロープ (Envelope)‣ エンベロープ

元の音

エンベロープ信号

エンベロープを適用した音

エンベロープ (Envelope)‣ ADSR (Attack - Decay - Sustain - Release)

エンベロープ (Envelope)‣ SuperColliderで、エンベロープを使用してみる !

‣ Env と EnvGen を使用する ‣ Env - エンベロープの形態を定義 ‣ EnvGen - Envで生成した形態で信号を生成

// Env.linen - アタック、サステイン、リリース、レベルで指定 Env.linen(0.05, 0.2, 0.5, 0.7).plot; !{ var env = Env.linen(0.05, 0.1, 0.5); SinOsc.ar(440) * EnvGen.kr(env, doneAction: 2) }.play

エンベロープ (Envelope)‣ エンベロープ 1 - Env.linen

// Env.perk - パーカッシブなエンベロープ Env.perc(0.01, 2.0).plot; ( { var env = Env.perc(0.01, 2.0); SinOsc.ar(440) * EnvGen.kr(env, doneAction: 2) }.play )

エンベロープ (Envelope)‣ エンベロープ 2 - Env.perc

// Env.triangle - 三角形のエンベロープ Env.triangle(1, 1).plot; ( { var env = Env.triangle(1, 1); SinOsc.ar(440) * EnvGen.kr(env, doneAction: 2) }.play )

エンベロープ (Envelope)‣ エンベロープ 3 - Env.triangle

// Env.sine - ハニング窓 Env.sine(1, 1).plot; ( { var env = Env.sine(1, 1); SinOsc.ar(440) * EnvGen.kr(env, doneAction: 2) }.play )

エンベロープ (Envelope)‣ エンベロープ 3 - Env.sine

// Env.new - 完全に自由なエンベロープ生成 // レベルの配列と、時間の配列で指定 Env.new([0, 1, 0.9, 0], [0.1, 0.5, 1],[-5, 0, -5]).plot; ( { var env = Env.new([0, 1, 0.9, 0], [0.1, 0.5, 1],[-5, 0, -5]); SinOsc.ar(440) * EnvGen.kr(env, doneAction: 2) }.play )

エンベロープ (Envelope)‣ エンベロープ 4 - Env.new

エンベロープ (Envelope)‣ EnvGenで指定されている ”doneAction:2” とは? ‣ エンベロープが終了した後に、するてつづき ‣ 1~14まで規定されている

エンベロープ (Envelope)‣ doneAction !0. do nothing when the UGen is finished 1. pause the enclosing synth, but do not free it 2. free the enclosing synth 3. free both this synth and the preceding node 4. free both this synth and the following node 5. free this synth; if the preceding node is a group then do g_freeAll on it, else free it 6. free this synth; if the following node is a group then do g_freeAll on it, else free it 7. free this synth and all preceding nodes in this group 8. free this synth and all following nodes in this group 9. free this synth and pause the preceding node 10. free this synth and pause the following node 11. free this synth and if the preceding node is a group then do g_deepFree on it, else free it 12. free this synth and if the following node is a group then do g_deepFree on it, else free it 13. free this synth and all other nodes in this group (before and after) 14. free the enclosing group and all nodes within it (including this synth)

エンベロープ (Envelope)‣ doneAction !0. do nothing when the UGen is finished 1. pause the enclosing synth, but do not free it 2. free the enclosing synth 3. free both this synth and the preceding node 4. free both this synth and the following node 5. free this synth; if the preceding node is a group then do g_freeAll on it, else free it 6. free this synth; if the following node is a group then do g_freeAll on it, else free it 7. free this synth and all preceding nodes in this group 8. free this synth and all following nodes in this group 9. free this synth and pause the preceding node 10. free this synth and pause the following node 11. free this synth and if the preceding node is a group then do g_deepFree on it, else free it 12. free this synth and if the following node is a group then do g_deepFree on it, else free it 13. free this synth and all other nodes in this group (before and after) 14. free the enclosing group and all nodes within it (including this synth)

→ Synthを終了して開放

スケジューリング (Scheduling)

スケジューリング (Scheduling)‣ 音楽は時間の中で展開される ‣ どのタイミングで何を行うかを、細かくコントロールする必要

がある

スケジューリング (Scheduling)‣ Routine - ルーチン ‣ データ処理のアクション ‣ 必要なパラメータを設定し、スリープする(次のタイミングを

待つ) ‣ 他のコンピュータ言語でいうThread (スレッド) のようなもの

‣ Routine基本 !!!!!!!

‣ 実行してみる ‣ Post windowに何が表示されるか?

// Routineをスケジューリング- 1 Routine({ 12.do{ arg i; // カウンタ変数 "Count = ".post; i.postln; // カウンタ出力 1.yield; // 1秒待つ } }).play;

スケジューリング (Scheduling)

Count = 0 Count = 1 Count = 2 Count = 3 Count = 4 Count = 5 Count = 6 Count = 7 Count = 8 Count = 9 Count = 10 Count = 11

スケジューリング (Scheduling)‣ Routine - 実行結果 !!!!!!!

‣ 1秒おきに、カウントアップする

‣ Routine応用 - ランダムな時間で生成// Routineをスケジューリング - 2 r = Routine({ //待ち時間を記録する変数 var delta; 12.do { //待ち時間、1~5秒をランダムに生成

delta = rrand(1,5); //メッセージを出力 "Will wait ".post; delta.postln; //1~5秒待つ delta.yield; } }).play;

スケジューリング (Scheduling)

スケジューリング (Scheduling)‣ Routineを使用して、シーケンスパターンを生成してみる ‣ まずは、エンベロープ付きのSin波の楽器を定義 ‣ 定義した楽器を、Routineでくりかえし実行する

‣ Routine実験用のSynth “singrain” を定義// Routine実験用、Synth "singrain" ( SynthDef("singrain", { arg freq = 440, amp = 0.2, sustain = 1; var env, sig; env = EnvGen.kr(Env.perc(0.01, sustain), doneAction: 2); sig = SinOsc.ar([freq, freq * 1.01], 0, amp) * env; Out.ar(0, sig); }).add; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス1 - 反復//反復して演奏

( Routine({ loop{ Synth("singrain"); 1.yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス2 - 等比的に上昇//等比的に上昇 ( Routine({ var freq; 24.do{ arg i; freq = i * 1.5 * 55; Synth("singrain", ["freq", freq]); 0.2.yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス3 - 12音階をランダムに//12音階をランダムに ( Routine({ var freq; loop{ freq = [60,61,62,63,64,65,66,67,68,69,70,71].choose.midicps; Synth("singrain", ["freq", freq]); 0.5.yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス4 - 音程、長さ、音量をランダムに//音程、長さ、音量をランダムに ( Routine({ var freq, amp, sustain; loop{ freq = [60,61,62,63,64,65,66,67,68,69,70,71].choose.midicps; amp = exprand(0.1, 0.5); sustain = rrand(1, 4) * 0.5; Synth("singrain", ["freq", freq, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス5 - 2つの音程//2つの音程 ( Routine({ var freq1, freq2, amp, sustain; loop{ freq1 = [60,61,62,63,64,65,66,67,68,69,70,71].choose.midicps; freq2 = [60,61,62,63,64,65,66,67,68,69,70,71].choose.midicps; amp = exprand(0.1, 0.3); sustain = rrand(1, 4) * 0.5; Synth("singrain", ["freq", freq1, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", freq2, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス6 - 2つの音程(2)//2つの音程 - 2 ( Routine({ var freq1, freq2, amp, sustain; loop{ freq1 = [60,61,62,63,64,65,66,67,68,69,70,71].choose.midicps; freq2 = freq1 * [1.0/1.0, 2.0/1.0, 3.0/2.0, 4.0/3.0, 5.0/4.0].choose; amp = exprand(0.1, 0.3); sustain = rrand(1, 4) * 0.5; Synth("singrain", ["freq", freq1, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", freq2, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス7 - 4つの音程//4つの音程 ( Routine({ var note1, note2, note3, note4, amp, sustain; loop{ note1 = [60,61,62,63,64,65,66,67,68,69,70,71].choose; note2 = note1 + [0, 2, 4, 5, 7, 9].choose - [0, 12].choose; note3 = note1 + [0, 2, 4, 5, 7, 9].choose - [0, 12].choose; note4 = note1 + [0, 2, 4, 5, 7, 9].choose - [0, 12].choose; amp = exprand(0.05, 0.2); sustain = rrand(1, 8); Synth("singrain", ["freq", note1.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note2.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note3.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note4.midicps, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス7 - 4つの音程2//4つの音程2 ( Routine({ var note1, note2, note3, note4, amp, sustain; loop{ note1 = [60,61,62,63,64,65,66,67,68,69,70,71].choose; note2 = note1 + [0, 5, 7].choose - [0, 12].choose; note3 = note2 + [0, 5, 7].choose - [0, 12].choose; note4 = note3 + [0, 5, 7].choose - [0, 12].choose; amp = exprand(0.1, 0.2); sustain = rrand(1, 8); Synth("singrain", ["freq", note1.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note2.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note3.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note4.midicps, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }).play; )

スケジューリング (Scheduling)

‣ Routineによるシーケンス8 - 4つの音程 x 2//4つの音程 x 2 ( r = Routine({ var note1, note2, note3, note4, amp, sustain; loop{ note1 = [60,61,62,63,64,65,66,67,68,69,70,71].choose; note2 = note1 + [0, 5, 7].choose - [0, 12, 24].choose; note3 = note2 + [0, 5, 7].choose - [0, 12, 24].choose; note4 = note3 + [0, 5, 7].choose - [0, 12, 24].choose; amp = exprand(0.05, 0.1); sustain = rrand(1, 8); Synth("singrain", ["freq", note1.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note2.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note3.midicps, "amp", amp, "sustain", sustain]); Synth("singrain", ["freq", note4.midicps, "amp", amp, "sustain", sustain]); (sustain * 0.8).yield; } }); r.play; r.play; )

スケジューリング (Scheduling)

Recommended