SlideShare a Scribd company logo
Interactive Music II
ProcessingとSuperColliderの連携2
東京藝術大学芸術情報センター (AMC)
2014年1月16日
田所 淳
最終課題
‣ 課題 :
‣ SuperCollider、またはSuperColliderとProcessingを連携して
表現する
‣ 音、または音と連動した映像
‣ テーマは自由
‣ 時間: 30分以内であれば、自由
!

‣ 次週(1月23日)の授業で発表してください
先週の復習
SuperCollider client for Processing
‣ ProcessingとSuperColliderの連携には、SuperCollider client
for Processingが便利
‣ OSCp5よりも簡単に、SuperColliderとProcessingの連携が可
能となる
SuperCollider client for Processing
‣ SuperCollider側: 「test_inst」を定義
SynthDef("test_inst",{
arg freq=440, length=1.0, amp=0.5;
var env, out;
env = Env.perc(0.01, length);
out = SinOsc.ar([freq,freq*1.001])
* EnvGen.kr(env, doneAction:2) * amp;
Out.ar(0, out);
}).store;
SuperCollider client for Processing
‣ Processing側: クリックで音が鳴るように
import supercollider.*;
import oscP5.*;

!

Synth synth;

!

void setup () {
size(600, 400);
}

!

void draw() {
background(0);
}

!

//マウスクリックに反応
void mouseReleased() {
//新規に楽器を定義(まだ生成はされず)
synth = new Synth("test_inst");
//引数を設定
synth.set("amp", 0.5);
synth.set("freq", map(mouseY, height, 0, 20, 8000));
//楽器を生成
synth.create();
}
SuperCollider client for Processing
‣ たとえば、ここに円が拡がるアニメーションをつけてみる
SuperCollider client for Processing
‣ Processing側:
import supercollider.*;
import oscP5.*;

!

Synth synth;
int NUM = 100;
float[] radius = new float[NUM];
PVector[] pos = new PVector[NUM];
int counter = 0;

!

void setup () {
size(800, 600);
frameRate(60);
noFill();
stroke(31, 127, 255);
strokeWeight(3);
for (int i = 0; i < NUM; i++) {
radius[i] = 0;
pos[i] = new PVector(width*2, width*2);
}
}
SuperCollider client for Processing
‣ Processing側:
void draw() {
background(0);
for (int i = 0; i < NUM; i++) {
ellipse(pos[i].x, pos[i].y, radius[i], radius[i]);
radius[i] += 1;
if(radius[i] > width*1.5){
radius[i] = 0;
pos[i].x = width*2;
pos[i].y = width*2;
}
}
}

!

void mouseReleased() {
synth = new Synth("test_inst");
synth.set("amp", 0.5);
synth.set("freq", map(mouseY, height, 0, 20, 8000));
synth.create();
int n = counter % NUM;
radius[n] = 0;
pos[n].x = mouseX;
pos[n].y = mouseY;
counter++;
}
SuperCollider client for Processing
‣ 完成!!
SuperCollider client for Processing
‣ SuperColliderの楽器はそのままで、さらに別の例
SuperCollider client for Processing
‣ Processing側:
import supercollider.*;
import oscP5.*;

!

int NUM = 400; //配列の数
//位置のベクトルの配列
PVector[] location = new PVector[NUM];
//速度のベクトルの配列
PVector[] velocity = new PVector[NUM];
//塗りの色の配列
color[] col = new color[NUM];
//円の大きさ(直径)の配列
float[] diameter = new float[NUM];

!

void setup() {
size(640, 480); //640x480pixelの画面を生成
frameRate(60); //フレームレート
noStroke();
for (int i = 0; i < NUM; i++) { //配列の数だけ繰り返し
//位置のベクトルの初期設定
location[i] = new PVector(random(width), random(height));
//速度のベクトルの初期設定
velocity[i] = new PVector(random(-4, 4), random(-4, 4));
//色の初期設定
col[i] = color(random(255), random(255), random(255), 127);
//大きさの初期設定

}

}

diameter[i] = random(3, 40);
SuperCollider client for Processing
‣ Processing側:
void draw() {
background(15); //背景を描画
//配列の数だけ繰り返し
for (int i = 0; i < NUM; i++) {
fill(col[i]); //色を指定
//指定した位置に円を描画
ellipse(location[i].x, location[i].y, diameter[i], diameter[i]);
//位置のベクトルに速度のベクトルを加算、次の位置になる
location[i].add(velocity[i]);
//もし画面の左端、または右端に到達したら
if ((location[i].x > width) || (location[i].x < 0)) {
velocity[i].x *= -1; //X方向のスピドを反転
playSynth(location[i].x, location[i].y);

}
//もし画面の下端、または上端に到達したら

if ((location[i].y > height) || (location[i].y < 0)) {
velocity[i].y *= -1; //Y方向のスピードを反転

}

}

}

playSynth(location[i].x, location[i].y);

!

void playSynth(float x, float y) {
//新規に楽器を定義(まだ生成はされず)
Synth synth = new Synth("test_inst");
//引数を設定
synth.set("amp", 0.1);
synth.set("freq", map(x, height, 0, 20, 8000));
//楽器を生成
SuperCollider client for Processing
‣ Processing側:
!

void playSynth(float x, float y) {
//新規に楽器を定義(まだ生成はされず)
Synth synth = new Synth("test_inst");
//引数を設定
synth.set("amp", 0.1);
synth.set("freq", map(x, height, 0, 20, 8000));
//楽器を生成
}

synth.create();
SuperCollider client for Processing
‣ ボールのバウンドに反応
SuperCollider client for Processing
‣ Processing側:
import supercollider.*;
import oscP5.*;

!

Synth synth;
int NUM = 100;
float[] radius = new float[NUM];
PVector[] pos = new PVector[NUM];
int counter = 0;

!

void setup () {
size(800, 600);
frameRate(60);
noFill();
stroke(31, 127, 255);
strokeWeight(3);
for (int i = 0; i < NUM; i++) {
radius[i] = 0;
pos[i] = new PVector(width*2, width*2);
}
}
いろいろサンプル
SuperCollider client for Processing
‣ 拡がる四角形と、FM
SuperCollider client for Processing
‣ 拡がる四角形と、FM - Processing側:
import supercollider.*;
import oscP5.*;

!

int NUM = 100;
int count = 0;

!

PVector pos[] = new PVector[NUM];
float size[] = new float[NUM];
Synth fm[] = new Synth[NUM];

!

void setup() {
size(640, 480);
frameRate(60);
for (int i = 0; i < NUM; i++) {
pos[i] = new PVector(width*2, height*2);
size[i] = 0;
}
rectMode(CENTER);
}
SuperCollider client for Processing
‣ 拡がる四角形と、FM - Processing側:
void draw() {
background(0);
stroke(255, 127);
noFill();
strokeWeight(3);
for (int i = 0; i < NUM; i++) {
rect(pos[i].x, pos[i].y, size[i], size[i]);
if (size[i] > 0) {
size[i] += 1;
fm[i].set("index", size[i]);
}
if (size[i] > width/4) {
size[i] = 1;
}
}
}
SuperCollider client for Processing
‣ 拡がる四角形と、FM - Processing側:
void mouseReleased() {
int n = count % NUM;
pos[n].x = mouseX;
pos[n].y = mouseY;
size[n] = 1;
count++;
fm[n] = new Synth("fm1");
fm[n].set("amp", 0.2);
fm[n].set("freq", map(mouseY, height, 0, 40, 800));
fm[n].set("pan", map(mouseX, 0, width, -1.0, 1.0));
fm[n].set("modPartial", map(mouseY, 0, height, 1.0, 20.0));
fm[n].set("index", 0.0);
fm[n].create();
}
SuperCollider client for Processing
‣ 拡がる四角形と、FM - SuperCollider側:
//FM
SynthDef("fm1", { arg freq = 440, detune = 2, carPartial = 1, modPartial = 1, index = 3,
mul = 0.2, pan=0.0, amp=0.5;
var mod, car;
mod = SinOsc.ar(
[freq, freq+detune] * modPartial,
0,
freq * index * LFNoise1.kr(10.reciprocal).abs
);
car = Pan2.ar(SinOsc.ar((freq * carPartial) + mod, 0, mul), pan, amp);
Out.ar(0, car);
}).add;
SuperCollider client for Processing
‣ 左右に動く帯と、持続音
SuperCollider client for Processing
‣ 左右に動く帯と、持続音 - Processing側:
import supercollider.*;
import oscP5.*;

!

int BAR_NUM = 100;
int count = 0;

!

float[]
float[]
float[]
color[]

!

x = new float[BAR_NUM];
xSpeed = new float[BAR_NUM];
bWidth = new float[BAR_NUM];
bColor = new color[BAR_NUM];

void setup() {
size(640, 480);
frameRate(30);
colorMode(HSB, 360, 100, 100, 100);
noStroke();
for (int i=0; i<BAR_NUM; i++) {
x[i] = width * 2;
xSpeed[i] = random(-4, 4);
bWidth[i] = 0;
bColor[i] = color(random(360), random(90, 100), random(50, 100), 20);
}
//FX
Synth synth = new Synth("fx");
synth.create();
}
SuperCollider client for Processing
‣ 左右に動く帯と、持続音 - Processing側:
void draw() {
background(0);
for (int i=0; i<BAR_NUM; i++) {
fill(bColor[i]);
rect(x[i], 0, bWidth[i], height);
x[i] += xSpeed[i];
if (x[i] > width || x[i] < -bWidth[i]) {
xSpeed[i] *= -1;
}
}
}

!

void mouseReleased() {
int n = int(random(1, 12));
x[count] = mouseX;
bWidth[count] = n * 40;
count++;
Synth synth = new Synth("mySaw");
synth.set("n", n);
synth.set("gate", 1);
synth.create();
}
SuperCollider client for Processing
‣ 左右に動く帯と、持続音 - SuperCollider側:
!

SynthDef("mySaw", {
arg fadeTime = 10, n = 0, rq = 0.3, detune = 0.001, base = 20, ratio = 1.5, harm = 1.5,
amp = 0.2, gate=0;
var lfo, env, out;
env = EnvGen.kr(Env.new([0,1], [fadeTime], 'sine'));
lfo = SinOsc.ar(rrand(0.03, 0.05), 0, 100, 600);
out = Saw.ar([base+detune.rand, base+detune.rand] * (ratio ** n)) * amp
+ Saw.ar([base*harm+detune.rand, base*harm+detune.rand] * (ratio ** n)) * amp;
out = out * env;
out = RLPF.ar(out, lfo * (1.5 ** n), rq).clip2 * 0.5;
out = out * EnvGen.kr(Env.adsr(releaseTime:20), gate, doneAction: 2);
Out.ar(0, out);
}).store;

!

//エフェクト
SynthDef("fx", {
arg lpf=440, rq=0.5, amp=0.8;
var in, out;
in = In.ar(0, 2);
12.do({ in = AllpassL.ar(in, 0.1, LFNoise2.kr([rrand(0.0, 0.1),rrand(0.0, 0.1)],
0.01,0.06), 4.0) });
out = CompanderD.ar(in) * amp;
ReplaceOut.ar(0, out);
}).store;
SuperCollider client for Processing
‣ 課題の方向性
‣ シンプルなアニメーションと、簡単な楽器
‣ 組合せて、足しあわせることで、面白い結果を
!

‣ 残り時間は、質問受付にします!

More Related Content

PDF
Interactive Music II ProcessingとSuperColliderの連携1
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider入門 2 - 関数とUGen
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider入門 5 時間構造をつくる
Atsushi Tadokoro
 
PDF
IP addresses and location-based services, Have you got it right?
APNIC
 
PPTX
Learning Svelte
Christoffer Noring
 
ODP
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
PDF
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
OpenStack Korea Community
 
Interactive Music II ProcessingとSuperColliderの連携1
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Atsushi Tadokoro
 
Interactive Music II SuperCollider入門 2 - 関数とUGen
Atsushi Tadokoro
 
Interactive Music II SuperCollider入門 5 時間構造をつくる
Atsushi Tadokoro
 
IP addresses and location-based services, Have you got it right?
APNIC
 
Learning Svelte
Christoffer Noring
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
OpenStack Korea Community
 

Viewers also liked (8)

PDF
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
Atsushi Tadokoro
 
PDF
coma Creators session vol.2
Atsushi Tadokoro
 
PDF
プログラム初級講座 - メディア芸術をはじめよう
Atsushi Tadokoro
 
PDF
Interactive Music II Processing基本
Atsushi Tadokoro
 
PDF
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Atsushi Tadokoro
 
PDF
Interactive Music II Processingによるアニメーション
Atsushi Tadokoro
 
PDF
メディア・アート II 第1回: ガイダンス openFrameworks入門
Atsushi Tadokoro
 
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
Atsushi Tadokoro
 
coma Creators session vol.2
Atsushi Tadokoro
 
プログラム初級講座 - メディア芸術をはじめよう
Atsushi Tadokoro
 
Interactive Music II Processing基本
Atsushi Tadokoro
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Atsushi Tadokoro
 
Interactive Music II Processingによるアニメーション
Atsushi Tadokoro
 
メディア・アート II 第1回: ガイダンス openFrameworks入門
Atsushi Tadokoro
 
Ad

Similar to Interactive Music II ProcessingとSuperColliderの連携 -2 (20)

PPTX
Cursor Movement With Gesture_ Project - Copy.pptx
shubhenamazon
 
KEY
Locks? We Don't Need No Stinkin' Locks - Michael Barker
JAX London
 
KEY
Lock? We don't need no stinkin' locks!
Michael Barker
 
DOC
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
KEY
Sbaw090623
Atsushi Tadokoro
 
PPTX
Hypercritical C++ Code Review
Andrey Karpov
 
PPTX
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Tim Chaplin
 
PPTX
How to add an optimization for C# to RyuJIT
Egor Bogatov
 
KEY
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
PDF
Ssaw08 0624
Atsushi Tadokoro
 
PDF
A new execution model for Nashorn in Java 9
Marcus Lagergren
 
PDF
Openframworks x Mobile
Janet Huang
 
PDF
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
Atsushi Tadokoro
 
PDF
Presto anatomy
Dongmin Yu
 
PDF
Verifikation - Metoder og Libraries
InfinIT - Innovationsnetværket for it
 
PDF
Functional Reactive Programming / Compositional Event Systems
Leonardo Borges
 
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
PDF
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Yothin Muangsommuk
 
DOCX
CODING IN ARDUINO
S Ayub
 
PDF
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
Cursor Movement With Gesture_ Project - Copy.pptx
shubhenamazon
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
JAX London
 
Lock? We don't need no stinkin' locks!
Michael Barker
 
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
Sbaw090623
Atsushi Tadokoro
 
Hypercritical C++ Code Review
Andrey Karpov
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Tim Chaplin
 
How to add an optimization for C# to RyuJIT
Egor Bogatov
 
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
Ssaw08 0624
Atsushi Tadokoro
 
A new execution model for Nashorn in Java 9
Marcus Lagergren
 
Openframworks x Mobile
Janet Huang
 
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
Atsushi Tadokoro
 
Presto anatomy
Dongmin Yu
 
Verifikation - Metoder og Libraries
InfinIT - Innovationsnetværket for it
 
Functional Reactive Programming / Compositional Event Systems
Leonardo Borges
 
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Yothin Muangsommuk
 
CODING IN ARDUINO
S Ayub
 
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
Ad

More from Atsushi Tadokoro (20)

PDF
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
Atsushi Tadokoro
 
PDF
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
Atsushi Tadokoro
 
PDF
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Atsushi Tadokoro
 
PDF
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
Atsushi Tadokoro
 
PDF
Tamabi media131118
Atsushi Tadokoro
 
PDF
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Atsushi Tadokoro
 
PDF
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
Atsushi Tadokoro
 
PDF
Media Art II openFrameworks 複数のシーンの管理・切替え
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!
Atsushi Tadokoro
 
PDF
Geidai music131107
Atsushi Tadokoro
 
PDF
iTamabi 13 第7回:ARTSAT API 実践 2 衛星の情報で表現する
Atsushi Tadokoro
 
PDF
Media Art II 2013 第7回 : openFrameworks 3Dグラフィクス、OpenGL
Atsushi Tadokoro
 
PDF
メディア芸術基礎 II Canvas + Javascriptで図形を描く
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider入門 4 - 楽器を定義、変調合成(RM, AM, FM)
Atsushi Tadokoro
 
PDF
iTamabi 13  第6回:ARTSAT API 実践 1 Web APIから情報を取得する
Atsushi Tadokoro
 
PDF
Media Art II 2013 第6回:openFrameworks Addonを使う 2 - ofxOpenCV と ofxCv
Atsushi Tadokoro
 
PDF
Interactive Music II SuperCollider入門 3 - 音を混ぜる(Mix)、楽器を定義(SynthDef)
Atsushi Tadokoro
 
PDF
iTamabi 13 第5回:ARTSAT API 導入
Atsushi Tadokoro
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
Atsushi Tadokoro
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
Atsushi Tadokoro
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Atsushi Tadokoro
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
Atsushi Tadokoro
 
Tamabi media131118
Atsushi Tadokoro
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Atsushi Tadokoro
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
Atsushi Tadokoro
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Atsushi Tadokoro
 
Interactive Music II SuperCollider実習 オリジナルの楽器を作ろう!
Atsushi Tadokoro
 
Geidai music131107
Atsushi Tadokoro
 
iTamabi 13 第7回:ARTSAT API 実践 2 衛星の情報で表現する
Atsushi Tadokoro
 
Media Art II 2013 第7回 : openFrameworks 3Dグラフィクス、OpenGL
Atsushi Tadokoro
 
メディア芸術基礎 II Canvas + Javascriptで図形を描く
Atsushi Tadokoro
 
Interactive Music II SuperCollider入門 4 - 楽器を定義、変調合成(RM, AM, FM)
Atsushi Tadokoro
 
iTamabi 13  第6回:ARTSAT API 実践 1 Web APIから情報を取得する
Atsushi Tadokoro
 
Media Art II 2013 第6回:openFrameworks Addonを使う 2 - ofxOpenCV と ofxCv
Atsushi Tadokoro
 
Interactive Music II SuperCollider入門 3 - 音を混ぜる(Mix)、楽器を定義(SynthDef)
Atsushi Tadokoro
 
iTamabi 13 第5回:ARTSAT API 導入
Atsushi Tadokoro
 

Recently uploaded (20)

DOCX
unit 1 BC.docx - INTRODUCTION TO BUSINESS COMMUICATION
MANJU N
 
DOCX
India's Emerging Global Leadership in Sustainable Energy Production The Rise ...
Insolation Energy
 
PDF
Alan Stalcup - Principal Of GVA Real Estate Investments
Alan Stalcup
 
PDF
Unveiling the Latest Threat Intelligence Practical Strategies for Strengtheni...
Auxis Consulting & Outsourcing
 
PPTX
E-Way Bill under GST – Transport & Logistics.pptx
Keerthana Chinnathambi
 
PDF
Infrastructure and geopolitics.AM.ENG.docx.pdf
Andrea Mennillo
 
PDF
Equinox Gold - Corporate Presentation.pdf
Equinox Gold Corp.
 
PDF
New Royals Distribution Plan Presentation
ksherwin
 
PPTX
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
PDF
askOdin - An Introduction to AI-Powered Investment Judgment
YekSoon LOK
 
PDF
Danielle Oliveira New Jersey - A Seasoned Lieutenant
Danielle Oliveira New Jersey
 
DOCX
UNIT 2 BC.docx- cv - RESOLUTION -MINUTES-NOTICE - BUSINESS LETTER DRAFTING
MANJU N
 
PPTX
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
PPTX
Certificate of Incorporation, Prospectus, Certificate of Commencement of Busi...
Keerthana Chinnathambi
 
PPTX
Integrative Negotiation: Expanding the Pie
badranomar1990
 
PPTX
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
PDF
Bihar Idea festival - Pitch deck-your story.pdf
roharamuk
 
PDF
GenAI for Risk Management: Refresher for the Boards and Executives
Alexei Sidorenko, CRMP
 
PPTX
Struggling to Land a Social Media Marketing Job Here’s How to Navigate the In...
RahulSharma280537
 
PDF
12 Oil and Gas Companies in India Driving the Energy Sector.pdf
Essar Group
 
unit 1 BC.docx - INTRODUCTION TO BUSINESS COMMUICATION
MANJU N
 
India's Emerging Global Leadership in Sustainable Energy Production The Rise ...
Insolation Energy
 
Alan Stalcup - Principal Of GVA Real Estate Investments
Alan Stalcup
 
Unveiling the Latest Threat Intelligence Practical Strategies for Strengtheni...
Auxis Consulting & Outsourcing
 
E-Way Bill under GST – Transport & Logistics.pptx
Keerthana Chinnathambi
 
Infrastructure and geopolitics.AM.ENG.docx.pdf
Andrea Mennillo
 
Equinox Gold - Corporate Presentation.pdf
Equinox Gold Corp.
 
New Royals Distribution Plan Presentation
ksherwin
 
Final PPT on DAJGUA, EV Charging, Meter Devoloution, CGRF, Annual Accounts & ...
directord
 
askOdin - An Introduction to AI-Powered Investment Judgment
YekSoon LOK
 
Danielle Oliveira New Jersey - A Seasoned Lieutenant
Danielle Oliveira New Jersey
 
UNIT 2 BC.docx- cv - RESOLUTION -MINUTES-NOTICE - BUSINESS LETTER DRAFTING
MANJU N
 
Appreciations - July 25.pptxsdsdsddddddsssss
anushavnayak
 
Certificate of Incorporation, Prospectus, Certificate of Commencement of Busi...
Keerthana Chinnathambi
 
Integrative Negotiation: Expanding the Pie
badranomar1990
 
Chapter 3 Distributive Negotiation: Claiming Value
badranomar1990
 
Bihar Idea festival - Pitch deck-your story.pdf
roharamuk
 
GenAI for Risk Management: Refresher for the Boards and Executives
Alexei Sidorenko, CRMP
 
Struggling to Land a Social Media Marketing Job Here’s How to Navigate the In...
RahulSharma280537
 
12 Oil and Gas Companies in India Driving the Energy Sector.pdf
Essar Group
 

Interactive Music II ProcessingとSuperColliderの連携 -2

  • 2. 最終課題 ‣ 課題 : ‣ SuperCollider、またはSuperColliderとProcessingを連携して 表現する ‣ 音、または音と連動した映像 ‣ テーマは自由 ‣ 時間: 30分以内であれば、自由 ! ‣ 次週(1月23日)の授業で発表してください
  • 4. SuperCollider client for Processing ‣ ProcessingとSuperColliderの連携には、SuperCollider client for Processingが便利 ‣ OSCp5よりも簡単に、SuperColliderとProcessingの連携が可 能となる
  • 5. SuperCollider client for Processing ‣ SuperCollider側: 「test_inst」を定義 SynthDef("test_inst",{ arg freq=440, length=1.0, amp=0.5; var env, out; env = Env.perc(0.01, length); out = SinOsc.ar([freq,freq*1.001]) * EnvGen.kr(env, doneAction:2) * amp; Out.ar(0, out); }).store;
  • 6. SuperCollider client for Processing ‣ Processing側: クリックで音が鳴るように import supercollider.*; import oscP5.*; ! Synth synth; ! void setup () { size(600, 400); } ! void draw() { background(0); } ! //マウスクリックに反応 void mouseReleased() { //新規に楽器を定義(まだ生成はされず) synth = new Synth("test_inst"); //引数を設定 synth.set("amp", 0.5); synth.set("freq", map(mouseY, height, 0, 20, 8000)); //楽器を生成 synth.create(); }
  • 7. SuperCollider client for Processing ‣ たとえば、ここに円が拡がるアニメーションをつけてみる
  • 8. SuperCollider client for Processing ‣ Processing側: import supercollider.*; import oscP5.*; ! Synth synth; int NUM = 100; float[] radius = new float[NUM]; PVector[] pos = new PVector[NUM]; int counter = 0; ! void setup () { size(800, 600); frameRate(60); noFill(); stroke(31, 127, 255); strokeWeight(3); for (int i = 0; i < NUM; i++) { radius[i] = 0; pos[i] = new PVector(width*2, width*2); } }
  • 9. SuperCollider client for Processing ‣ Processing側: void draw() { background(0); for (int i = 0; i < NUM; i++) { ellipse(pos[i].x, pos[i].y, radius[i], radius[i]); radius[i] += 1; if(radius[i] > width*1.5){ radius[i] = 0; pos[i].x = width*2; pos[i].y = width*2; } } } ! void mouseReleased() { synth = new Synth("test_inst"); synth.set("amp", 0.5); synth.set("freq", map(mouseY, height, 0, 20, 8000)); synth.create(); int n = counter % NUM; radius[n] = 0; pos[n].x = mouseX; pos[n].y = mouseY; counter++; }
  • 10. SuperCollider client for Processing ‣ 完成!!
  • 11. SuperCollider client for Processing ‣ SuperColliderの楽器はそのままで、さらに別の例
  • 12. SuperCollider client for Processing ‣ Processing側: import supercollider.*; import oscP5.*; ! int NUM = 400; //配列の数 //位置のベクトルの配列 PVector[] location = new PVector[NUM]; //速度のベクトルの配列 PVector[] velocity = new PVector[NUM]; //塗りの色の配列 color[] col = new color[NUM]; //円の大きさ(直径)の配列 float[] diameter = new float[NUM]; ! void setup() { size(640, 480); //640x480pixelの画面を生成 frameRate(60); //フレームレート noStroke(); for (int i = 0; i < NUM; i++) { //配列の数だけ繰り返し //位置のベクトルの初期設定 location[i] = new PVector(random(width), random(height)); //速度のベクトルの初期設定 velocity[i] = new PVector(random(-4, 4), random(-4, 4)); //色の初期設定 col[i] = color(random(255), random(255), random(255), 127); //大きさの初期設定 } } diameter[i] = random(3, 40);
  • 13. SuperCollider client for Processing ‣ Processing側: void draw() { background(15); //背景を描画 //配列の数だけ繰り返し for (int i = 0; i < NUM; i++) { fill(col[i]); //色を指定 //指定した位置に円を描画 ellipse(location[i].x, location[i].y, diameter[i], diameter[i]); //位置のベクトルに速度のベクトルを加算、次の位置になる location[i].add(velocity[i]); //もし画面の左端、または右端に到達したら if ((location[i].x > width) || (location[i].x < 0)) { velocity[i].x *= -1; //X方向のスピドを反転 playSynth(location[i].x, location[i].y); } //もし画面の下端、または上端に到達したら if ((location[i].y > height) || (location[i].y < 0)) { velocity[i].y *= -1; //Y方向のスピードを反転 } } } playSynth(location[i].x, location[i].y); ! void playSynth(float x, float y) { //新規に楽器を定義(まだ生成はされず) Synth synth = new Synth("test_inst"); //引数を設定 synth.set("amp", 0.1); synth.set("freq", map(x, height, 0, 20, 8000)); //楽器を生成
  • 14. SuperCollider client for Processing ‣ Processing側: ! void playSynth(float x, float y) { //新規に楽器を定義(まだ生成はされず) Synth synth = new Synth("test_inst"); //引数を設定 synth.set("amp", 0.1); synth.set("freq", map(x, height, 0, 20, 8000)); //楽器を生成 } synth.create();
  • 15. SuperCollider client for Processing ‣ ボールのバウンドに反応
  • 16. SuperCollider client for Processing ‣ Processing側: import supercollider.*; import oscP5.*; ! Synth synth; int NUM = 100; float[] radius = new float[NUM]; PVector[] pos = new PVector[NUM]; int counter = 0; ! void setup () { size(800, 600); frameRate(60); noFill(); stroke(31, 127, 255); strokeWeight(3); for (int i = 0; i < NUM; i++) { radius[i] = 0; pos[i] = new PVector(width*2, width*2); } }
  • 18. SuperCollider client for Processing ‣ 拡がる四角形と、FM
  • 19. SuperCollider client for Processing ‣ 拡がる四角形と、FM - Processing側: import supercollider.*; import oscP5.*; ! int NUM = 100; int count = 0; ! PVector pos[] = new PVector[NUM]; float size[] = new float[NUM]; Synth fm[] = new Synth[NUM]; ! void setup() { size(640, 480); frameRate(60); for (int i = 0; i < NUM; i++) { pos[i] = new PVector(width*2, height*2); size[i] = 0; } rectMode(CENTER); }
  • 20. SuperCollider client for Processing ‣ 拡がる四角形と、FM - Processing側: void draw() { background(0); stroke(255, 127); noFill(); strokeWeight(3); for (int i = 0; i < NUM; i++) { rect(pos[i].x, pos[i].y, size[i], size[i]); if (size[i] > 0) { size[i] += 1; fm[i].set("index", size[i]); } if (size[i] > width/4) { size[i] = 1; } } }
  • 21. SuperCollider client for Processing ‣ 拡がる四角形と、FM - Processing側: void mouseReleased() { int n = count % NUM; pos[n].x = mouseX; pos[n].y = mouseY; size[n] = 1; count++; fm[n] = new Synth("fm1"); fm[n].set("amp", 0.2); fm[n].set("freq", map(mouseY, height, 0, 40, 800)); fm[n].set("pan", map(mouseX, 0, width, -1.0, 1.0)); fm[n].set("modPartial", map(mouseY, 0, height, 1.0, 20.0)); fm[n].set("index", 0.0); fm[n].create(); }
  • 22. SuperCollider client for Processing ‣ 拡がる四角形と、FM - SuperCollider側: //FM SynthDef("fm1", { arg freq = 440, detune = 2, carPartial = 1, modPartial = 1, index = 3, mul = 0.2, pan=0.0, amp=0.5; var mod, car; mod = SinOsc.ar( [freq, freq+detune] * modPartial, 0, freq * index * LFNoise1.kr(10.reciprocal).abs ); car = Pan2.ar(SinOsc.ar((freq * carPartial) + mod, 0, mul), pan, amp); Out.ar(0, car); }).add;
  • 23. SuperCollider client for Processing ‣ 左右に動く帯と、持続音
  • 24. SuperCollider client for Processing ‣ 左右に動く帯と、持続音 - Processing側: import supercollider.*; import oscP5.*; ! int BAR_NUM = 100; int count = 0; ! float[] float[] float[] color[] ! x = new float[BAR_NUM]; xSpeed = new float[BAR_NUM]; bWidth = new float[BAR_NUM]; bColor = new color[BAR_NUM]; void setup() { size(640, 480); frameRate(30); colorMode(HSB, 360, 100, 100, 100); noStroke(); for (int i=0; i<BAR_NUM; i++) { x[i] = width * 2; xSpeed[i] = random(-4, 4); bWidth[i] = 0; bColor[i] = color(random(360), random(90, 100), random(50, 100), 20); } //FX Synth synth = new Synth("fx"); synth.create(); }
  • 25. SuperCollider client for Processing ‣ 左右に動く帯と、持続音 - Processing側: void draw() { background(0); for (int i=0; i<BAR_NUM; i++) { fill(bColor[i]); rect(x[i], 0, bWidth[i], height); x[i] += xSpeed[i]; if (x[i] > width || x[i] < -bWidth[i]) { xSpeed[i] *= -1; } } } ! void mouseReleased() { int n = int(random(1, 12)); x[count] = mouseX; bWidth[count] = n * 40; count++; Synth synth = new Synth("mySaw"); synth.set("n", n); synth.set("gate", 1); synth.create(); }
  • 26. SuperCollider client for Processing ‣ 左右に動く帯と、持続音 - SuperCollider側: ! SynthDef("mySaw", { arg fadeTime = 10, n = 0, rq = 0.3, detune = 0.001, base = 20, ratio = 1.5, harm = 1.5, amp = 0.2, gate=0; var lfo, env, out; env = EnvGen.kr(Env.new([0,1], [fadeTime], 'sine')); lfo = SinOsc.ar(rrand(0.03, 0.05), 0, 100, 600); out = Saw.ar([base+detune.rand, base+detune.rand] * (ratio ** n)) * amp + Saw.ar([base*harm+detune.rand, base*harm+detune.rand] * (ratio ** n)) * amp; out = out * env; out = RLPF.ar(out, lfo * (1.5 ** n), rq).clip2 * 0.5; out = out * EnvGen.kr(Env.adsr(releaseTime:20), gate, doneAction: 2); Out.ar(0, out); }).store; ! //エフェクト SynthDef("fx", { arg lpf=440, rq=0.5, amp=0.8; var in, out; in = In.ar(0, 2); 12.do({ in = AllpassL.ar(in, 0.1, LFNoise2.kr([rrand(0.0, 0.1),rrand(0.0, 0.1)], 0.01,0.06), 4.0) }); out = CompanderD.ar(in) * amp; ReplaceOut.ar(0, out); }).store;
  • 27. SuperCollider client for Processing ‣ 課題の方向性 ‣ シンプルなアニメーションと、簡単な楽器 ‣ 組合せて、足しあわせることで、面白い結果を ! ‣ 残り時間は、質問受付にします!