Postdoctoral Fellow [email protected]/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2:...

16
Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow [email protected] Audio Programming with Chuck

Transcript of Postdoctoral Fellow [email protected]/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2:...

Page 1: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Session 2: MIDI, ChucK Libraries, and Arrays

Vitor Guerra RollaPostdoctoral Fellow

[email protected]

Audio Programming with Chuck

Page 2: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Mini-course Schedule

Session 1: Basics: Sound, Waves, and ChucK initiation

Session 2: MIDI, ChucK Libraries, and Arrays

Session 3: Sound File Manipulation

Session 4: Functions

Session 5: Unit Generators and Physical Models

Session 6: Multi-Threading and Concurrency

Session 7: Classes and Object-Oriented Programming

08/01/2019

Today

15/01/2019

17/01/2019

22/01/2019

24/01/2019

29/01/2019

Page 3: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Session 2: MIDI, ChucK Libraries, and Arrays

Live Coding

Introduction to MIDI

Standard Library

Math Library

Panning & Multi-channel Audio

Arrays

Example: make melody

Page 4: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Live Coding

Performing art

On the fly or real-time

Musician(s) + computer(s)

Animation / Video

Pedagogical / learning purpose

Page 5: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Robotic Pianos

Andrew Sorensen

Impromptu language

Two piano hands + guitar + hi-hat=>

Original: https://www.youtube.com/watch?v=yY1FSsUV-8c

Chuck translation: www.impa.br/~vitorgr/livecode

Page 6: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Live Coding Music Conference

visgraf.impa.br/livecode

February 4th - 6th 2019

Page 7: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

MIDI Introduction

Std.mtof() and Std.ftom()

Page 8: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

MIDI Introduction

Page 9: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Std Library - Unit Conversion

Page 10: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Math Library – Random Numbers

Math.random() int

Math.random2(int min, int max) in between int

Math.randomf() float in the range [0,1]

Math.random2f(float min, float max) in between float

Math.srandom(int)

Page 11: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Math Library

Page 12: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Math Library

Page 13: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Audio Panning

dac.left & dac.right & dac.chan(int)

Pan2 [-1.0, 1.0]

Math.sin(float x)

Page 14: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Arrays

Block of memory stringed together used to make a “list” or “group” of data.

Page 15: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Array Loop

<<< A.cap() >>>;

for(0 => int i; i < A.cap(); i++){ ...

Page 16: Postdoctoral Fellow vitorgr@impaw3.impa.br/~vitorgr/livecode/minicourse/Slides-D2.pdf · Session 2: MIDI, ChucK Libraries, and Arrays Vitor Guerra Rolla Postdoctoral Fellow vitorgr@impa.br

Make Melody

Homework: make your own melody

Arrays with the same length => figure out with different lengths