Presentation is loading. Please wait.

Presentation is loading. Please wait.

Laptop Instrument Meeting 7 February 7, 2018.

Similar presentations


Presentation on theme: "Laptop Instrument Meeting 7 February 7, 2018."— Presentation transcript:

1 Laptop Instrument Meeting 7 February 7, 2018

2 The Note Chart Excel spreadsheet Columns for Helmholtz note name
ASA note name ChucK note name MIDI number Frequency Acoustical Society of America

3 From Before Program to play a note, specified by frequency
Program to play random notes Program to play octaves Program to play harmonic series Programs doing arithmetic

4 Control Structures Ways to control the order of execution of the statements. while ( condition ) { statements } if ( condition ) { statements } else { statements } for ( start ; condition ; increment ) { statements } statements means statement; statement; … statement;

5 Comparisons freq < i <= 10 J >= 5 Foo == 23.0

6 While statement Action, or effect is
Check condition If true, execute the statements enclosed in { } Etc. If the condition never becomes false, the loop never stops. Ctrl C stops the program

7 For loop for ( start ; condition ; increment ) { statements } start: Declare a “loop” variable and initialize it. 1 => int i; //Starts the loop at 1 increment: Calculate the new value of the loop variable 2 +=> i; //Increments by 2 condition: Test the loop variable to stop iterating i <= 25;

8 Exercise Write a ChucK program that counts by threes starting at 5 and stopping just before Have the program print each of the count values.

9 Exercise Write a ChucK program that prints the first 20 Fibonacci numbers. Let’s agree that f0 = 1 and f1 = 1. Then f2 = f0 + f1, f3 = f1 + f2, etc.

10 Exercise Enhance your Fibonacci program to present the output in well-labeled form: f0 = 1 f1 = 1 f2 = 2 f3 = 3 f4 = 5 etc

11 Exercise Modify your octave program so that it:
Uses the sine oscillator Starts with a frequency of 27.5 Hz, the lowest note on the piano, an A Plays in turn, each for one second, all the A’s on the piano from lowest to highest Echoes to the screen the octave number and the frequency of the A.

12 Properties of a Note Notes in ChucK


Download ppt "Laptop Instrument Meeting 7 February 7, 2018."

Similar presentations


Ads by Google