COMS 4115 Programming Languages and Translators Fall 2013 Professor Edwards. Lullabyte



Similar documents
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

AUTOMATIC FITNESS IN GENERATIVE JAZZ SOLO IMPROVISATION

How To Improvise a Solo A Workshop for Beginners

Lecture 2 Notes: Flow of Control

Moving from CS 61A Scheme to CS 61B Java

How to create bass lines

Curriculum Mapping Electronic Music (L) Semester class (18 weeks)

Exercise 1: Python Language Basics

Parameters for Session Skills Improvising Initial Grade 8 for all instruments

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

2017 NAfME All-Northwest Jazz Audition Materials Saxophones and Brass

Object Oriented Software Design

GRADE THREE THEORY REVISION

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

6. Control Structures

Programming Languages

Greenwich Public Schools Electronic Music Curriculum 9-12

Overview of MIDI. What is MIDI Sync?

Pseudo code Tutorial and Exercises Teacher s Version

HOWARD COUNTY PUBLIC SCHOOLS MUSIC TECHNOLOGY

E.L.A.P.S.: Studies in Improvised Electronics By Peter van Haaften. Project documentation is current as of November 18, 2014.

Tutorial 1J: Chords, Keys, and Progressions

PL / SQL Basics. Chapter 3

FOURIER TRANSFORM BASED SIMPLE CHORD ANALYSIS. UIUC Physics 193 POM

Introduction to Chords For Jazz Band

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:

Iteration CHAPTER 6. Topic Summary

Music Theory: Explanation and Basic Principles

Sources: On the Web: Slides will be available on:

Lesson DDD: Figured Bass. Introduction:

Congratulations on purchasing Molten MIDI B by Molten Voltage

Silver Burdett Making Music

J a v a Quiz (Unit 3, Test 0 Practice)

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

An Introduction to Chords

MUSIC GLOSSARY. Accompaniment: A vocal or instrumental part that supports or is background for a principal part or parts.

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Nashville Number System

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

2+2 Just type and press enter and the answer comes up ans = 4

How to Read Music Notation

How they invented chord patterns for the guitar. J. Chaurette. Dec., 2012

2012 Music Standards GRADES K-1-2

Music Theory Unplugged By Dr. David Salisbury Functional Harmony Introduction

Computational Mathematics with Python

Cubase Vs Logic Pro - Music Composition

Unit Overview Template. Learning Targets

midi2style - the program for converting MIDI files to YAMAHA keyboard style files

CS106A, Stanford Handout #38. Strings and Chars

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

The Tuning CD Using Drones to Improve Intonation By Tom Ball

Example of a Java program

Python Lists and Loops

Jim Hall Chords and Comping Techniques

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June Dr.-Ing.

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Programming LEGO NXT Robots using NXC

Chapter One Introduction to Programming

Introduction to Python

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Music - Commercial. Career Options Vocalist Instrumentalist Producer Artist agent Sound engineer Public and private teaching

Course Title: Software Development

Computational Mathematics with Python

Computational Mathematics with Python

MAKING YOUR LINES SOUND MORE LIKE JAZZ!

Working with microcontroller-generated audio frequencies (adapted from the Machine Science tutorial)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Michael Gundlach DOWNLOAD PDF FILE WALKING BASS for Piano An easy method for creating Walking Bass Lines on Piano

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Guitar Rubric. Technical Exercises Guitar. Debut. Group A: Scales. Group B: Chords. Group C: Riff

ABSTRACT INTRODUCTION

1 Abstract Data Types Information Hiding

C Major F Major G Major A Minor

Musical Literacy. Clarifying Objectives. Musical Response

A MUSICAL APPROACH TO LEARNING THE BANJO NECK

Object Oriented Software Design

Moving from C++ to VBA

Standard 1: Skills and Techniques 1

Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn Claus Führer Simulation Tools Automn / 65

An Incomplete C++ Primer. University of Wyoming MA 5310

Computer Programming C++ Classes and Objects 15 th Lecture

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

ML for the Working Programmer

Visual Basic Programming. An Introduction

DIGITAL MUSIC DAY 1 WHAT IS SOUND? ANALOG AND DIGITAL EARLY RECORDING WAX FOR YOUR EARS ROUND BUT FLAT WIRE AND TAPE PURE SOUND

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

Sample Entrance Test for CR (BA in Popular Music)

Exercise 4 Learning Python language fundamentals

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

MATLAB Programming. Problem 1: Sequential

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Informatica e Sistemi in Tempo Reale

microgranny 2.0 manual draft

Page 1 of 36. Companion Workbook leadworship.com

Footswitch Controller OPERATING INSTRUCTIONS

Unit 6. Loop statements

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print

GEORGE GOODMAN S HARMONICA CHEAT SHEET By George Goodman. Copyright 2014 George Goodman GeorgeGoodman.com 2 nd Edition, License Notes

Transcription:

COMS 4115 Programming Languages and Translators Fall 2013 Professor Edwards Lullabyte Stanley Chang (cc3527), Louis Croce (ljc2154), Nathan Hayes-Roth (nbh2113), Andrew Langdon (arl2178), Ben Nappier (ben2113), Peter Xu (px2117) Executive Summary - Lullabyte is a programmatic abstraction of notes in music space. Basic rules and operators, used in conjunction with functions and control flow operators, will allow the developer to create MIDI music files using syntax similar to that of C and C-derived languages.

Intended Uses -Composition- Lullabyte allows developers to create musical compositions, either directly or algorithmically. Developers can create music through programs that directly manipulate a song s common elements (pitch, melody, rhythm, etc.). Alternatively, users can develop more complicated compositions by writing programs that generate melodies algorithmically. Lullabyte achieves this by generating simple Java code that will create the MIDI file of the programmed song through an external library. -Inspiration- Musicians, like all artists, seek inspiration from their surroundings. Some artists use dice rolls to create melodies and rhythms. However, often times, doing so creates chaotic chord progressions and unpleasant sounds. Furthermore, the notes need to be written down and played in order for the artist to analyze the quality. Though Lullabyte can be used to create specific music, it is also a great tool to inspire new ideas. Since contemporary music is often based on simple chord progressions, it can be coded easily and put into a loop and set as an independent sequence. A randomly generated melody can be created as a separate sequence that chooses notes along a random walk which belong to the chord progression during a specific section. This is analogous to a saxophone improvisation over a bass line in a solo section of a jazz chart. The structure of the partially random melody can be set to reduce chaotic rhythms and general noise in the section. Musical motifs and themes can be reused to create pleasant patterns recognized by humans. With the set structure in place, one can quickly generate multiple MIDI files for inspiration. Data Types Type Description int An integer value. Example: 3 pitch Corresponds to a frequency and is represented as one of the 12 musical tones combined with an octave value. Example: A5 chord A chord is a collection of one or more pitches surrounded by square brackets Example: [C4 G4 C5...] duration A measure of how long pitches play with respect to the measure Example: 1/4 amplitude Loudness; Integer value between 0 and 100 Example: 42 2 Page

sound A combination of chord, duration, amplitude separated by colons. If the amplitude is not specified, the default is 50. Example: [C3 G4]:1/2:75, [A4 C5 E5]:1/3 sequence A list of sounds surrounded by parentheses and separated by commas. Example: ([C3]:1/2, [A4 E5]:1/4, [A4 E5]:1/4, ) track A track is an array of sequences, and dictates the order in which the sequences are rendered to MIDI. Tracks are surrounded by s with the sequences separated by commas. Example: ([C3]:1/2, [A4 E5]:1/4), ([A4 E5]:1/4), data_type[] An array of data_types ( data_type corresponds to one of the above data types) Symbols Symbol Use / Used with duration. : Used to separate chord from duration from amplitude in sound. ; Used to designate the end of a command. ( ) Used to define a sequence. Used to define a track. [ ] Used to define a chord or an array. { Used to define a block of code. Keywords Keyword constants Use C0 to B9 (ie C1, C#1, D1, D#1, A9, A#9, B9), true, false statements if, else, let, do, while, function types int, pitch, chord, duration, amplitude, sound, sequence, track, void 3 Page

Operators Operator Use Cases + integer + integer x pitch + integer x Descriptions Increment a pitch by x semitones; Error if above B9 chord + integer x chord + pitch y Increment all pitch inside chord by x semitones; Error if above B9 Chord will include y; if y already exists in chord, ignore amplitude + integer x - integer - integer x pitch - integer x chord - integer x chord - pitch y pitch x - pitch y amplitude - integer x = integer x = integer y Increase the amplitude by x; Error if above 100 Decrement a pitch by x semitones Decrement all pitch inside chord by x semitones; Error if below C0 Chord will remove y; Error if y is not in chord Returns an integer z semitones between x and y Decrease the amplitude by x; Error if below 0 Assignment operator etc. << duration x << duration y sound a << sound b sequence s << sequence t sequence s << sound a * integer * integer duration * integer x sound * integer x sequence s * integer x amplitude a * integer x Returns duration z of x + y Returns a sequence of a after b Returns a sequence of t after s Returns a sequence with a after s Returns a duration x times as long Returns a sound x times as long in duration Returns a sequence of s concatenated 4 times Returns an amplitude equal to a times x. 4 Page

< integer < integer duration x < duration y pitch x < pitch y > integer > integer duration x > duration y pitch x > pitch y == integer == integer duration x == duration y pitch x == pitch y Returns true if duration x shorter duration y. Returns true if pitch x is lower pitch than y. Returns true if duration x longer duration y. returns true if pitch x is higher pitch than y.. Returns true if duration x is same as duration y. Returns true if pitch x is same as pitch y.!!<boolean_expression> Logical NOT operator. && <boolean_expression> && <boolean_expression> Logical AND operator. <boolean_expression> <boolean_expression> Logical OR operator. Standard Library Function mixdown(track, track,...) Writes the tracks defined by the programmer to a MIDI file in such a way that they will be played simultaneously Control Flow Keyword Example Description if else while if(<boolean_expression>){ //Statements else { //Statements while(<boolean_expression>){ //Statements.. White Space and Comments Space characters, newline characters, and comments are ignored // - Comment to the end of the line /* text */ - text will be treated as a comment. 5 Page

Code Examples /* * Creates a new sequence with each sound prior being played 4 times * consecutively */ function sequence quadruple(sequence a){ sequence b; int i; let i = 0; while(i < a.length()){ let b = b << a[i] << a[i] << a[i] << a[i]; let i = i + 1; return b; /* * Creates a sequence which we will use to play a blues solo (a random walk * on the blues scale) */ function sequence randomwalk(int[] scale, pitch root, int n){ int i, rand, root_step, r; sequence out; let i = 0; let rand = new Random(); let root_step = 0; while(i < n){ let r = rand.int(5) - 2; //random int between -2 and 2 let root_step = root_step + r; //if root_step is out of scale s range, place back in range if(root_step < 0){ let root_step = scale.length() - 1 - root_step; if(root_step > scale.length() -1){ let root_step = root_step - scale.length() - 1; //increment the root pitch by the random-walk of the scale let out = out << (root + scale[root_step]); let i = i + 1; return out; 6 Page

// main takes three arguments, x and y together define the time signature and a bpm defines the beats per minute. function void main (x, y, bpm){ chord fmajor, cmajor, cmajor7; sequence f_c, baseseq; track jude_progression, bass, funky_blues; int n; int[] scale; // Hey Jude chord progression let fmajor = [F4 A4 C4]; let cmajor = [C5 E5 G5]; let cmajor7 = [C5 E5 G5 Bb5]; // an F chord and C chord with durations of a quarter note let f_c = (F:1/4, C:1/4); let jude_progression = quadruple(f_c), (fmajor:1/4,cmajor7:1/4,cmajor7:1/4,cmajor7:1/4), quadruple(f_c) ; let baseseq = ([F3]:1/1, [C3]:1/1, [F3]:1/4, [C3]:3/4, [F3]:1/1, [C3]:1/1); let bass = baseseq ; //Writes the song to a MIDI file. Both tracks will be combined //such that they will play simultaneously in the output MIDI //file. //plays hey jude chord progession along with a bass line do mixdown(jude_progression, bass); let scale = [0 3 5 6 7 10]; //blues scale to be improvised on pitch C5; //root note of the scale let n = 10; //number of notes in the output sequence let funky_blues = randomwalk(scale, C5, n) ; do mixdown(funky_blues); //appends funky blues to the MIDI file 7 Page