About CS 312 Audio Programming Winter 2020

Table of Contents


Information, Expectations, and Rules

From the Carleton College Academic Catalog CS 312.00

Students will learn the basics of MIDI and Digital Audio programming using C++. In the MIDI portion of the course, you’ll learn to record, play, and transform MIDI data. During the Digital Audio portion of the course, you’ll learn the basics of audio synthesis: oscillators, envelopes, filters, amplifiers, and FFT analysis. Weekly homework assignments, two quizzes, and two independent projects.
Prerequisite: Computer Science 201 or instructor permission
6 credits; FSR; Offered Winter 2020; J. Ellinger

Instructor Introduction

JE Personal Home Page

  • Senior Lecturer in Music, retired in 2014 after 37 years teaching in the Carleton Music Department.
  • Introduced the music technology courses into the Carleton curriculum.
  • First computer, 1986 MacPlus when it was one week old.
  • First program written, 1986 six months later in Pascal.
    All early Mac developer documentation and programming API's were in Pascal.
    It composed, played, displayed music notation, and printed simple guitar finger picking songs.
  • Founded and ran MiBAC Music Software, Inc. from 1987-2012.
  • Wrote six MiBAC commercial music education software programs.
    Three for Mac and the same three over again for Windows (2 Pascal, 4 C++).
  • Carleton men's golf coach 1990-2001.
  • Built a modular synthesizer from scratch. More info about that on my personal page.

Contact

I do not text.
I do read and respond to email.

  • email: jellinge@carleton.edu
  • Office: Laird 15A
  • Office hours:
    MW 3:30-4:30 (after class)
    F 1:00-2:00 (before class)
    By email.
  • Phone: x4591

Course Text

Bjarne Stroustrup: A Tour of C++ Second Edition
TCPP2 as it will now be called is a modern overview of the C++ language written for an experienced programmer. It would not be the ideal choice for a beginning programming class but the information in it will be used in almost every homework assignment. The course will introduce concepts gradually. Between the course web pages, TCCP2, and the C++ reference pages and examples found on the internet you'll have a good foundation in C++ programming by week 10.

Course Framework

I've been writing music related software for over thirty years. In my experience I believe the most important tools to master in writing software, irrespective of the language you're using are:

  • Familiarity with the command line and knowledge of the many Terminal commands available.
  • Choosing a good programming editor and knowing the tips and tricks to get the most out of it.
    I've chosen Visual Studio Code (vsCode) for the class. It's the best C++ editor I've ever used.
  • Finding a good diff program to compare code files with similar contents and see/edit the differences.
    My personal choice has been BBEdit since version 1. Version 12 is installed in the lab.
  • Using a version control system (Git) to save your work to a remote location (Bitbucket/Github).
    It gives you the ability to experiment and revert code changes if things don't work out.
  • Developing skills with a debugger that lets you step through the code line by line while the program is running and observe changes to variables. I could never have developed "bug free" commercial software without one. In larger applications it's not unusual to spend as much or more time in the debugger as in the editor.

Secondary to these but still very important are

  • Understanding and using regular expressions for text manipulation
  • Knowing how to install and use third party libraries from the web
  • Knowledge of your language libraries (C++ for this class)
  • Knowledge of underlying Operating System API's (MacOS for this class)
  • Knowing where to look for help on the web. It should be obvious that Google is your friend.

I've written the course as a series of 27 web pages, one web page for each class. Each web page contains reading material to help you understand the C++ and audio concepts that supports the homework. I've developed the course to cover all of these topics. Initially I was planning to use git with either Github or Bitbucket as your class code repository but that changed recently when I decided to rely on the courses folder.

Before class preparation

Ideally you would read/study the upcoming web page before coming to class. I intend the class to be a hands on lab where you work in programming pairs. If you've read the material ahead of time you'll have more time for coding in the class. I'll be available for questions and help. I intend to do very little lecturing. Anyway my lectures would just repeat what I've written on the web pages. There will always be homework work to finish after class. You're free to copy and reuse and use any code you find on the internet as long as you include the URL attribution in a code comment.

Students helping students answer questions about development tools, keyboard shortcuts, applications, compile commands, pointing them to useful websites, programming strategies, etc. are encouraged. Sharing your original code with with anyone other than your pair partner is a breach of Academic Integrity.

The Two Computer Labs: WCC and CMC

Even though the class will be taught in WCC 138 lab, I'd encourage you do your homework in the CMC labs, rooms 304 and 306. There are critical differences the way the WCC and CMC labs are setup. With help from Mike Tie and his two student workers, Justin Washington and Danny Maya, I've tried to come up with a system the will make the process seamless in either lab. It depends on you following the naming conventions exactly as described on the web pages. You'll be using your CS312 courses folder for all labs and homework.

WCC

  1. You don't have a home folder under your account name.
  2. There is a single user account named labuser.
  3. Be sure to mount your CS312 courses folder and do your work there.
  4. Work you do on the local hard drive in WCC will be erased when you logout.

CMC

  1. Setup as central server network with multiple users. Each user is given their own account and home folder.
  2. The CMC computers are similar to a real world company environment.
  3. I initially designed the course assuming each student would have their own home folder. Because of the class size the class ended up in WCC and that required workarounds.
  4. You'll have to setup your own account in CMC with the same environment script files that were done for you in WCC. That process is part of the homework in the first two classes.

Backups

Golden Rule for Backups
The strategy most often recommended for personal computer backups is to have all your important files in three places:

  • The hard drive on your local laptop or desktop.
  • An external hard drive, local network computer, or other storage device.
  • A remote offsite location.

The CS312 courses folder is backed up several times a day so you're pretty safe there. You can never be overzealous about backups. Backup often and save work to a thumb drive,external SSD, or another computer just in case.

If you have created an account on Github or Bitbucket that is an ideal site for remote backups.

Avoid using Google Drive
We'll be working with dotfiles, filenames that begin with a period. Dotfiles are normally invisible on the Mac but there are ways to see them (On a mac type Cmd-Shift-Period). Google drive converts the initial period to an underscore. I found this out when testing some startup files in CMC and wondered why my account would no longer boot. I needed Mike Tie, with his system administrator privileges, to help discover the error and get my account working again. You might be able to work around that if you compress your dotfiles in a zip file before copying to Google Drive.

Grading

Homework 50% Pair programming
Quiz 1 10% Individual
Midterm Project 15% Pair programming
Quiz 2 10% Individual
Final Project 15% Pair programming

Grading Scale

Grades will be computed to two decimal places and will not be rounded up. A 93.00 is an A, a 92.99 is an A-.

Grade 100 percent scale
A 100-93
A- 92.99-90
B+ 89.99-87
B 86.99-83
B- 82.99-80
C+ 79.99-77
C 76.99-73
C- 72.99-70
D+ 69.99-67
D 66.99-60
F 59.99-0

Homework

  • Homework is almost exclusively writing and compiling c++ code.
  • Programming will be done in pairs, no exceptions.
  • Homework is sequential and future homework often depends on completion of past homework.
  • It will be easy to get behind and will be difficult to catch up.
  • The homework for each assignment is due no later than one week after it is assigned. The homework for week3_2 (Third week Wednesday) is due at the beginning of class week4_2 (Fourth week Wednesday).
  • You are encouraged to turn in your homework as soon as possible and continue on with the next section. If you wait a week to complete an assignment, the next one will be due two days later. It will pile up.
  • You can ask me questions about any current homework during the class labs.
  • Homework programs that I am unable to compile will receive a grade of 65. I have the same setup that you have in the labs. Check to make sure your homework compiles before turning it in. A good plan is to copy the files for each homework assignment a new folder and compile from that folder as a check before submitting them. It's a good test that no files are missing. If it compiles for you it should compile for me.
  • Partially solved homework that compiles will be accepted and graded.

Late Penalty for Homework

  • Late homework will not be accepted except for medical or other extenuating circumstances.
  • All late or not turned in homework will receive a grade of 59.
  • I will drop the two worst homework grades when computing the homework portion of your final grade.

Homework Naming Conventions

I've developed a class, homework, and file naming system that must be followed exactly.

$HOME312
$HOME32 refers to your /StuWork folder in your CS312 courses folder.
The file path to your $HOME312 folder will be the same in both WCC and CMC labs.

In WCC
The environment variable $HOME312 has already been setup for labuser.

In CMC
You'll need to setup the environment variable $HOME312.
It's explained in the homework for class 1.1

Folders inside $HOME312

bin
where you'll keep executable commands and scripts written during the course.
common
where you'll keep code you've written that will be used in multiple assignments.
cs312
the main folder where every class lab and howework assignment will be kept.

File/Folder names All class labs and homework use Terminal commands to create and name your homework folders and source code files for you. The setup scripts use the $HOME312 variable. This should allow portability between the two labs. We'll find out soon.

Your homework must follow these naming conventions or you'll be inviting headaches.
Future homework often references and builds on past homework. If your folder or file names don't match, the web page scripts won't work and you'll spend unnecessary time tracking down problems.

The tree diagram below shows what your cs312 folder could look like by the end of the term.

# This is the path to your cs312 folder in your CS312 courses folder on a Mac
/Volumes/COURSES/cs312-00-w20/StuWork/<your_email_name>/cs312
├── bin
├── common
│   ├── RtMidi
│   ├── libsndfile
│   ├── RtAudio
│   └── qcustomplot
│   └── ...
├── hw11
│ │── class11
│ │   ├── ex1_hello.cpp
│ │   ├── ex2_putto.cpp
│ │   ├── ex3_numberbase.cpp
│ │   ├── ex4_print_overload.cpp
│ │   ├── ex5_arithmetic_types.cpp
│ │   └── ex6_struct_test.cpp
│ ├── hw111_boilerplate.cpp
│ ├── hw112_helloMidi.cpp
├── hw12
│ ├── hw121_charOutput.cpp
│ ├── hw122_charOutputTemplate.cpp
│ ├── hw123_charLoop.cpp
│ ├── hw124_asciiTool.cpp
│ ├── hw125_printMajorScale.cpp
├── hw13 ...
├── hw21 ...
├── hw22 ...
├── hw23 ...
├── hw31 ...
├── hw32 ...
├── hw32 ...
├── hw321_CMidiPacketFriends
  │   ├── CMakeLists.txt
  │   ├── hw321_CMP32friends.cpp
  │   ├── hw321_CMidiPacket.cpp
  │   └── hw321_CMidiPacket.h
  ├── hw322_CMP32gtest
  │   ├── CMakeLists.txt
  │   ├── CMakeLists_gtest.txt
  │   ├── CMakeLists_normal.txt
  │   ├── hw322_CMP32gtest.cpp
  │   ├── hw322_CMidiPacket.cpp
  │   ├── hw322_CMidiPacket.h
  │   ├── hw322_gtests.cpp
  │   └── hw322_gtests_zero.cpp
  └── hw323_inputOperatorDebug
    ├── hw322_CMidiPacket.cpp
    ├── hw322_CMidiPacket.h
    └── hw323_inputOperatorDebug.cpp
...

├── hw83 ...
├── hw91 ...
├── hw92 ...

LET ME REPEAT
You MUST follow this naming convention.

Notes:

bin
This folder holds executable scripts that you've created.
These scripts can be executed by name in Terminal.
common
This folder holds third party libraries and files you write that are used in multiple homework assignments.
They are kept in one folder rather than copying the same file multiple times to different homework folders.
c11
Class and lab examples are named c<week><session> or class<week><session>.
Class folders are used for work that is started in class and is preliminary to the homework.
You do not have to turn in this work but you should do it.
hw11
The homework folders are named hw<week><session>.
All homework assignments are meant to be turned in.
hw112_helloMidi.cpp
hw112_ week 1, session 1 (Monday), assignment 2.
Every homework code file will be prefixed hw<week><session><assignment>_
hw32/hw322_CMP32gtest
Week 3, session 2 (Wednesday), assignment 2.
This homework assignment contains multiple files that are kept in a folder inside the hw32/hw322_CMP32gtest folder.

Missed Classes

If you miss a class for whatever reason, the class web site contains the information you missed.

Quizzes

The two quizzes will each cover material from that portion of the course. Quizzes will be closed book with no computer access. You will be allowed to bring one 8.5 x 11 sheet of paper with HAND WRITTEN notes on both sides that you can refer to during the quiz.

Quiz 1 Class 5.3 Units 1.1 - 5.2
Quiz 2 Class 9.3 Units 6.2 - 9.2

Midterm Project

Midterm pair programming projects will be presented in Class 7.1. Class voting will determine the"Best CS312 MIDI Song" award. More information as we get closer to week 7.

Final Project

The final pair programming project deals with MIDI and/or Audio. It can be based on class topics or topics you're interested in that were not covered in class. You choose the project and show off what you've learned. Make it interesting. Final project presentations will take place during the final exam time. More information later.

Final Exam Time

FinalExamTime.png

Academic Integrity at Carleton

Students helping students answer questions about development tools, keyboard shortcuts, applications, compile commands, useful websites, C++ language/library concepts and programming strategies, etc. are fine. Sharing your original code with with anyone other than your pair partner is a breach of Academic Integrity.

Please read the Academic Integrity at Carleton web page carefully. I have referred cases to the Associate Dean in the past. It was unpleasant for everyone involved.

Course Mandates

CS 312 homework MUST be submitted to the course Hand-in folder
The deadline for each homework assignment is the the end of class one week later.
Homework 43 <Week4><Friday> is due by the end of class 5.3 <Week5><Friday>.
CS 312 homework MUST done on the Mac

All software needed for CS312 is installed in WCC and CMC Room 304 and 306 labs.
It is possible to install the software on a Mac 10.14 (Mojave) laptop.
If enough students are interested we can schedule a non class group meeting time and I'll help you do it.

CS 312 homework must be written using the VS code text editor unless otherwise stated in the assignment.

VS Code is the best C++ editor text editor I have used. I used Atom in the 2016 class but VS Code is better for C++. It has been configured to format your code automatically. I've chosen the format style to make my job of reading/grading your homework easier because all homework will conform to the same format. You're free to change the theme.

CS 312 header and source files MUST contain a boilerplate header following this template
/***************************************************************
hw111_boilerplate.cpp
Copyright (c) Carleton College CS312 free open source
Assignment: hw111_boilerplate
Man Super sman@carleton.edu
Woman Wonder wwoman@carleton.edu
DATE: 2019-12-15
TIME: 14:46:25
****************************************************************/
CS 312 homework MUST compile before turning in
Programs that do not compile will receive a grade of 59.
It's better to turn in a partial solution that compiles than try to explain "Here's what I wanted to do but I couldn't get it to work."
A good plan is to copy the files for each homework assignment to a new folder and compile from that folder as a check before submitting it. It's a good test that no files are missing, especially if your code uses files from the common folder. You may have to include your common folder and change pathnames in CMakeLists.txt to get it to compile from that folder. If it compiles for you in a single folder it should compile for me.
Do not include intermediate build files, compile output executables, or version control files/folders
I will compile your code from the folder you turn in for the assignment.
Including unused junk wastes space. Never include these folders if present in the folder you submit.
build
build-debug
.git
.vscode
C++ source code file extensions are .h and .cpp
.h for the interface or header file
.cpp for the implementation or source file

Course Goals

Work to established coding standards

VS Code use the C++ Intellisense plug-in and clang-format to format your code.

  • make code readable and self documenting
  • consistent naming practices
  • consistent code formatting practices
  • use self describing variable and function names

Familiarize yourself with established libraries

  • C++ Standard Library
  • C++ Standard Template Library (STL)
  • RtMidi
  • RtAudio
  • libsndfile
  • Googletest

Learn to use different build systems

  • command line
  • make
  • cmake
  • Xcode
  • Qt Creator

Practice defensive Programming

  • googletest
  • invariant checks
  • conditional statements in debug builds
  • exceptions
  • try / catch blocks

Use a debugger to

  • visually inspect your code as it's running
  • step over and step into instructions
  • watch variables change, inspect values as the code is running
  • set breakpoints
  • view raw memory

Find solutions using your textbooks and online searches.

I'll refer to the course textbook "The C++ Programming Language 4th Edition" by Bjarne Stroustrup as CPL4. I'll often reference pertinent sections in the homework but you should also study it at your own pace. Try to read some part of the text that pertains to classwork every day. Become familiar with Chapters 2-5 over the next three weeks. C++ is a huge language and we'll only be using a small part of it.

You may use and/or modify code you find on the internet in your homework. Put the URL where you found it in your source code as a comment.

Online C++ compilers

This website has a pretty good online C++ compiler.
https://www.onlinegdb.com/online_c++_compiler

This one is displays the assembler instructions generated by C++. It is often cited on the web as a tool for comparing hand written code against the C++ libraries. In almost all cases the C++ libraries win. It supports many different compilers and is used for diagnosing performance issues. https://godbolt.org/

Carleton Academic Support Center

The Academic Support Center is eager to work with faculty to help students succeed academically. We offer tutors, coaches, writing consultants, and prefects in math, science, writing, and public speaking.

Accommodations for Students with Disabilities

Carleton College is committed to providing equitable access to learning opportunities for all students. The Disability Services office (Henry House, 107 Union Street) is the campus office that collaborates with students who have disabilities to provide and/or arrange reasonable accommodations. If you have, or think you may have, a disability (e.g., mental health, attentional, learning, autism spectrum disorders, chronic health, traumatic brain injury and concussions, vision, hearing, mobility, or speech impairments), please contact disability@carleton.edu or call Sam Thayer (’10), Accessibility Specialist (x4464) or Chris Dallager, Director of Disability Services (x5250) to arrange a confidential discussion regarding equitable access and reasonable accommodations.

Assistive Technologies: Technological Resources for Students

The Assistive Technologies program brings together academic and technological resources to complement student classroom and computing needs, particularly in support of students with physical or learning disabilities. Accessibility features include text-to-speech (Kurzweil), speech-to-text (Dragon) software, and audio recording Smartpens. If you would like to know more, contact aztechs@carleton.edu or visit go.carleton.edu/aztech.

Class Presentations and Public Speaking

Speech coaching is a student-staffed resource designed to assist you with class presentations, comps talks, and other speech-related events. Your coach can assist you with speech & communication skills including clarity, organization, articulation, projection, body language, eye contact, and effective use of aids (e.g., notes, PowerPoint, Keynote, etc.). Depending on your goals, your coach can also work with you on the content of the presentation: organization, voice, clarity, and, ultimately, persuasive impact. Individuals and groups are welcome to request a speech coach by completing a brief, online form. The speech coach will meet you at a mutually convenient time and place. For more information, visit go.carleton.edu/speakeasy.

Course Materials Assistance (statement provided by TRIO)

I recognize the potential financial burden of additional course fees, supply requirements, and travel costs. If you are in need of assistance to cover course expenses, please speak with me by [preferred week/date].

Inclusion (provided by TRIO and the Office of Intercultural and International Life)

I strive to create an inclusive and respectful classroom that values diversity. Our individual differences enrich and enhance our understanding of one another and of the world around us. This class welcomes the perspectives of all ethnicities, genders, religions, ages, sexual orientations, disabilities, socioeconomic backgrounds, regions, and nationalities.

Learning Strategies and Time Management

Oscar Alvarez, Academic Skills Coach, is eager to help you develop learning strategies that work in the Carleton context. His goals are to heighten your awareness of your personal strengths and to offer different ways you can approach your academic work so you're more efficient and effective. For details and resources: Learning Strategies & Time Management.

If you prefer to learn these skills and strategies on your own, visit "Helpful DIY Resources."

Library

Librarians work as liaisons to academic departments, and yours can be found at https://apps.carleton.edu/campus/library/help/help/liaisons/). Ask a librarian for help with your research in this class in person at the library’s Research/IT desk at any point in your process, or chat with a librarian online 24/7. You can also email and call. Librarians help students find and evaluate articles, books, websites, statistics, data, government documents, and more. For more information on hours and librarians, visit the Gould Library website at go.carleton.edu/library.

Math Tutoring

The Math Skills Center is located in the CMC, room 231, on the second floor between the Math Department and the computer labs and classrooms. Tutors assist students who are taking math courses and experiencing difficulty with them, but the MSC also functions as a great place to study, do homework, and meet for one-on-one tutoring. It's open Monday-Friday: 8:30am-11pm; Saturday: 11am-5pm; and Sunday: 2-5pm and 7-11pm. All visits are drop-ins; no appointments are necessary. Russ Petricka, Supervisor of the Math Skills Center, also provides assistance during daytime and most evening hours.

Prefect Program

This course has a prefect, [ ], whose email address is [ ]. The Prefect Program offers optional collaborative learning sessions for participating classes. Prefect sessions review course concepts and often focus on critical thinking and problem-solving exercises centered on the course material. Scheduled outside of class time, they are led by trained student leaders who have received the department’s or professor’s stamp of approval. All the sessions are free and open to all students enrolled in the class. Our course prefect(s) will use email or Moodle to inform everyone in the class about upcoming sessions (where, when, topics, etc.).

Quantitative Reasoning

The Quantitative Resource (QR) Center is in East Wing Libe (4th floor). This is a new area for students to work on assignments for their Quantitative Reasoning Encounter (QRE) courses and others that involve quantitative reasoning. This space is open for you to study or work together any time the Libe is open, and staff or peer help is often available, no appointment necessary. For the most updated schedule for who’s in the QR Center, check the Twitter feed.

Here are some things you can work on or get help with in the QR Center:

  • reading graphs
  • making sense of numerical information in your reading
  • representing numerical data visually
  • understanding facts and figures critically so you can include them in your writing
  • other quantitative questions, assignments, or projects from your QRE course

For help with other data issues (finding, cleaning, analyzing), check the schedule to see when someone is available, or come by the QR Center and they’ll connect you to the right person!

Student Well-Being

Carleton College urges you to make yourself–your own health and well-being–your priority throughout this ​ten-week term and your career here. It is important to recognize stressors you may be facing, which can be personal, emotional, physical, financial, mental, or academic. Sleep, exercise, and connecting with others can be strategies to help you flourish at Carleton. If you are having difficulties maintaining your well-being, feel free to contact me and/or pursue other resources, such as Student Health and Counseling or the Office of Health Promotion.

Writing

The Writing Center

The Writing Center, located in 420 4th Libe, has peer writing consultants who can work with you during any stage of the writing process (brainstorming to final proofreading). Hours and more information can be found on the writing center website. You can reserve specific times for conferences in 420 4th Libe by using their online appointment system. Walk-ins are welcome, though writers with appointments have priority.

This course is supported by a Writing Assistant, whose job is to work with you on fulfilling the writing expectations for this course. Your WA is [name of consultant], and his/her email address is [ ]. S/he is aware of our assignments and deadlines, and will visit class, use our course Moodle site, or email you to communicate with you about available appointment times.

If you are a second language writer and believe you might benefit from working individually with a writing consultant on a regular basis this term, email Renata Fitzpatrick, Multilingual Writing Coordinator, call her at x5998, or stop by her office in 420D 4th Libe. She can arrange once- or twice-a-week meetings between you and a specific writing consultant throughout the term.

Revised John Ellinger, Winter 2020

Author: John Ellinger

Created: 2020-01-27 Mon 20:02

Validate