music interface design with supercollider and smartphones

27
Music Interface Design Introduction to SuperCollider & OSC Amir Rahimzadeh [email protected] Music Interface Design - Amir Rahimzadeh [email protected]

Upload: amir-rahim

Post on 14-Apr-2017

374 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design

Introduction to SuperCollider & OSC

Amir Rahimzadeh [email protected]

Page 2: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – What my brain looks like.

Page 3: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – What is SuperCollider?

• Free• Real-time• Cross-Platform• Programming Language• Audio Synthesis & Algorithmic Composition

http://supercollider.github.io/

Page 4: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – SuperCollider Basics

2 basic components

Server <-OSC-> Client“scsynth” <-OSC-> “sclang”

OSC … Open Sound Control

Page 5: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Download & Install

• Download: http://supercollider.github.io/

• Download all Tutorials: http://tinyurl.com/qhv49aw

• Install

• Open SuperCollider

Page 6: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Warning

To protect your ears and loudspeakers always set your system to the lowest level before starting a sound !!!

Page 7: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Making sound

1) Boot the server: s.boot;

2) Make a sound: ({SinOsc.ar(440)}).play;

3) Execute a command: mark all code, “shift+enter”

4) Stop Playback: “cmd + .”

Page 8: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Manipulating sound via Mouse

MouseX.kr(220,440)

Maps horizontal mouse cursor positionto the values between 220 and 440.

Page 9: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Review

What have you learned so far?

• Functions/Ugens take arguments• Function arguments can be constant or other functions/Ugens

(e.g. MouseX.kr())• The difference between audio rate and control rate• How to find the arguments of a function using the help

browser• How to use function MouseX as control value

Page 10: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Assignment 1

Assignment 1: Difficulty: Easy

• Add to the preceding example a control over the amplitude of the sinusoid using the vertical mouse position on your screen. The amplitude shoud vary between 0 and 1.

Hint: To change the amplitude the sinusoid has to be multiplied. There are 2 ways to achieve that. Make use of the help browser to determine which argument has to be changed. Argument “phase“ can be set to 0.

Page 11: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Assignment 2

Assignment 2: Difficulty: Medium

• Replace the manual control over the amplitude (MouseY.kr) from the previous example by a sine oscillator with a frequency of 1 Hz that continuously varies the amplitude.

• Would you use SinOsc.ar or SinOsc.kr for the amplitude control?

Why?

Hint: There are 2 ways to achieve that.

Page 12: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Assignment 3

Assignment 3: Difficulty: Advanced

• Replace the constant frequency of 1Hz of the SinOsc that controls the amplitude in the previous assignment by MouseY. The frequency of amplitude change should vary between 1 and 10Hz according to the position of the mouse cursor in vertical direction.

Hint: There are 2 ways to achieve that.

Page 13: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Setting up control from iPhone (1)

• iPhone/iPad: Download & Install GyrOSC

• Other smartphones: Download & Install qOSC

Page 14: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Setting up control from iPhone (2)

Get the IP address of your pc/mac

Mac: “Terminal” -> “ifconfig”

Search for: “inet 192.168.2.102” (actual numbers will vary)

Windows 2000 / XP / Vista: “Start Menu” -> “Run” -> “cmd /k ipconfig /all”

Search for: “IPv4 Address”

Page 15: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Setting up control from iPhone (3)

Configure GyrOSC qOSC

Ziel IP Adresse: set it to match the IP address of your Mac/PC.

Port: set it to 57120the standard portSuperCollider listens to incoming messages.

Page 16: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Setting up control from iPhone (4)

Receiving GyrOSC control values in SuperCollider

• Set up an OSC Responder in SuperCollider• Output the received control values (from pressing buttons in GyrOSC) to

SC’s “Post Window”

s.boot;OSCresponder(nil, "/gyrosc/button",{arg t, r, msg; msg.postln;}).add;

Page 17: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Setting up control from qOSC (5)

Receiving qOSC control values in SuperCollider

• Set up an OSC Responder in SuperCollider• Output the received control values (from pressing buttons in qOSC) to SC’s

“Post Window”

s.boot;OSCresponder(nil, "/btn14/0",{arg t, r, msg; msg.postln;}).add;

Page 18: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Synth Definitions

• Until now Ugens to create sound{ SinOsc.ar(440) }.play;

• For more flexibility and control -> SynthDefSynth Definitions tell the server how various Ugens are interconnected.

SynthDef(\SineSynth, // Define the synth{

arg freq=440; var sig; sig = SinOsc.ar(freq); Out.ar(0, sig);

}).send(s);

x = Synth.new(\SineSynth); // Create an instance of the synthx.set(\freq, 220); // Change the frequency of the running synth to 220 Hz

Page 19: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Change the frequency from iPhone

Change frequency on button press

OSCresponder(nil, "/gyrosc/button",{ arg t, r, msg; msg.postln; x.set(\freq, 110*msg[1]); // msg[1]…button number}).add;

Page 20: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Play MIDI scale from iPhone

Mapping button numbers to MIDI notes

• Changing: x.set(\freq, 110*msg[1]);

• to: x.set(\freq, midicps(69+msg[1]));

“midicps” … maps MIDI notes to frequency in Hz.

Page 21: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Envelopes ADSR & Perc

EnvGen.ar(Env.adsr(0,0.1,1,0.3)) *sig;

EnvGen.ar(Env.perc) * sig;

Page 22: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Playing Chords

Create Amin7 chord on button1 press

Corresponding MIDI notes are: 69, 72, 76, 79

Synth.new(\SinSynth, [\freq1, midicps(69)]); Synth.new(\SinSynth, [\freq1, midicps(72)]);

Synth.new(\SinSynth, [\freq1, midicps(76)]); Synth.new(\SinSynth, [\freq1, midicps(79)]);

Page 23: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Trigger Samples from iPhone (1)

• Samples have to be *.wav files.

• Set the path to the sample directory:~path = "~/Desktop/Super Collider Tutorials/Samples/".standardizePath;

• Load sample into a variablea = Buffer.read(s,~path ++ "BD.wav" );

Page 24: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Trigger Samples from iPhone (2)

• Define a synth for sample playback

SynthDef(\Samples,{arg buf = 0;var sig;sig = PlayBuf.ar(1, buf, BufRateScale.kr(buf));sig = sig*EnvGen.ar(Env.adsr(0,0.1,1,0.3), doneAction: 2);Out.ar([0,1], sig);}).add;

Page 25: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design – Trigger Samples from iPhone (3)

• Playback Sample

Synth.new(\Samples, [\buf, a]);

• Put that command into an OSCResponder

Page 26: Music Interface Design with SuperCollider and smartphones

Music Interface Design - Amir Rahimzadeh [email protected]

Music Interface Design Course

Music Interface Design Course8 week Course – Start: September 2015

Dates: 05.09. / 12.09. / 03.10. / 10.1017.10. / 24.10. / 31.10. / 07.11.

Page 27: Music Interface Design with SuperCollider and smartphones

Music Interface Design Course

Details• 1 interface per workshop including:

– automatic melody generation– automatic chord generation– touchless interaction using magnets– real-time voice processing– air drums– air guitar– Understand physics of the sensors used

• last 2 workshops:develop your instruments

What‘s possible?http://tinyurl.com/opwlsbkhttp://tinyurl.com/iTraktor

Register NOW [email protected]

Course Fee: 320 € / 8 weeks

Music Interface Design - Amir Rahimzadeh [email protected]