CS 312 - TOC
CS 312 Audio Programming Winter 2020
Table of Contents
- About CS 312
- Direct links to class pages
- Online Reference
- Table of Contents
- Week 1_1
- Week 1_2
- Week 1_3
- Week 2_1
- Week 2_2
- Week 2_3
- Week 3_1
- Week 3_2
- Week 3_3
- Week 4_1
- Week 4_2
- Week 4_3
- Week 5_1
- Week 5_2
- Week 5_3
- Week 6_1
- Week 6_2
- Week 6_3
- Week 7_1
- Week 7_2
- Week 7_3
- Week8_1
- Week8_2
- Week8_3
- Week 9_1
- Week 9_2
- Week 9_3
- Week 10_1
- Week 10_2
Announcements
- Final project proposals due before class 9.2
FinalProjectIdeas_Requirements.html - All class 7.2 libsndfile homework revised and working in CMC.
Should work in WCC but not able to test yet.
You'll need to redo the libsndfile install now greatly simplified.
You'll need to change the CMakeLists.txt files to follow that shown in hw721. - hw711, 712, 713 due date extended due to Qt compile issues
Work on getting it to compile in CMC but it will seg fault when you run it.
It currently will not compile in WCC.
More information later as I try to find a fix or workaround. - Project 1 requirements
Project 1 Guidelines - hw423_CSalesTrio favorites
CScalesTrio favorites.html - Homework 4.3 and 5.1 will be due start of class 6.2 (first class after midterm break)
About CS 312
Direct links to class pages
Online Reference
C++ references
C++ tutorials
https://www.tutorialspoint.com/cplusplus/index.htm
https://www.learncpp.com/
https://www.geeksforgeeks.org/c-plus-plus/
http://www.learncpp.com/cpp-tutorial/93-overloading-the-io-operators/
http://www.learncpp.com/cpp-tutorial/94-overloading-the-comparison-operators/
https://www.geeksforgeeks.org/internal-details-of-stdsort-in-c/
MIDI
http://midi.teragonaudio.com
http://midi.teragonaudio.com/tech/midispec.htm
https://www.nyu.edu/classes/bello/FMT_files/9_MIDI_code.pdf
https://learn.sparkfun.com/tutorials/midi-tutorial/all
https://www.sweetwater.com/insync/midi-essential-guide/
https://www.midi.org/specifications-old/item/the-midi-1-0-specification
https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message
File IO
Table of Contents
This is meant as a guide for looking up topics and homework that were covered in each class. When you click a link in the left panel you'll see that section's topics appear in the main panel. The actual link for that class is the first line of the topics. The weeks are named by the week and the session. For example week4_2 is the fourth week Wednesday class.
Week 1_1
1.1 Class Course Information, Expectations, and Rules WCC 138 Lab Setup Start the Mac and login. Mount your courses folder for CS312 Open Mac Terminal in //Applications/Utilities/ Execute /setup312 your_email_name/ Quit and restart Terminal. Keyboard shortcuts Copy/paste Pipes man pages c111_hello.cpp Visual Studio Code c111_hello.cpp notes Header and Source files The vsCode terminal c112_putto.cpp c113_numberbase.cpp Number base prefixes c114_print_overload.cpp c115_arithmetic_types.cpp c116_struct_test.cpp Struct More C++ C++ Libraries main() C++ Comments Operators CS 312 C++ style guidelines Naming Conventions - snake_case and camelCase Variables Constants Function names Function parameters Precedence Prefer /++x/ over /x++/ File names Use fully qualified namespaces Homework CMC Lab Setup Create /bash/ startup scripts for Terminal .bash_profile .bashrc CMC homework commands hw111_boilerplate.cpp hw112_helloMidi.cpp Submission Format
Week 1_2
1.2 Class Notes for CMC labs Shell prompt Class folder desktop icons WCC Startup scripts in detail Lab 1.2 MIDIDisplay_DLS MIDIDisplay_DLS tests Play your hw112_helloMidi.cpp Play my hw111_helloMidi.txt Troubleshooting MIDIDisplay_DLS Six properties of sound Reset all controllers message Pitch/Frequency Duration Dynamics Timbre Location/Stereo panorama Envelope Playing a chord Playing multiple channels Reading MIDI MIDI Message Format Status bytes MIDI Channels Common MIDI messages General MIDI sounds DLS sounds Samples and MIDI Mac Finder Quicklook Hide/Show Dot files Show hidden files Homework Reading vsCode settings Homework 1.2 Setup hw121_charOutput.cpp hw122_charOutputTemplate.cpp hw123_charLoop.cpp hw124_asciTool.cpp grep hw125_printMajorScale.cpp Submission Format
Week 1_3
1.3 Class Class lab projects c131_modular_code c132_conditional_compilation c133_scope_examples c134_char_issues c135_casts c136_logic_and_bitops c137_function_overloads c138_vector Reading MIDI Messages MIDI time MIDI messages MIDI bytes MIDIDisplay Message Format Hex byte to binary conversion MIDIDisplay conventions MIDI Demo Interface Files And Implementation Files Angle brackets and Quotes Macros Header guards ASCII clang-format on/off directive 1.3 Homework Reading Forbidden C types hw131_MidiPacket hw132_MidiPacket_cout.cpp hw133_chromaticScale_vector.cpp Submission Format
Week 2_1
Create a vsCode user snippet Class 2_1 lab examples General instructions for each file c211_io io01_global_struct.cpp io02_boolalpha.cpp io03_showpos.cpp io04_showbase.cpp io05_format1.cpp io06_format2.cpp io07_format3.cpp io08_format4.cpp io09_format5.cpp io10_format6.cpp io11_format7.cpp io12_format8.cpp io13_stdcintest.cpp Compile All Bash script c212_string str01_initialize.cpp str02_length_size.cpp str03_copy_constructor.cpp str04_assignment_operator.cpp str05_append.cpp str06_append_char.cpp str07_chars_index.cpp str08_chars_at.cpp str09_assign.cpp str10_insert.cpp str11_erase.cpp str12_replace.cpp str13_compare.cpp str14_substr.cpp str15_find.cpp str16_find_tab_chars.cpp c213_sstream Types of string streams ss01_dec_hex_convert.cpp ss02_string_to_number.cpp ss03_stringstreams.cpp ss04_str2float.cpp ss05_floating_point_precision.cpp ss06_binary_bitset.cpp c214_pointers ptr01_at_star.cpp ptr02_elementAccess.cpp ptr03_set2null.cpp ptr04_doubleDelete.cpp Reading TCCP2 C++ classes and the big six Constructor Destructor Copy Constructor Move Copy Constructor Assignment Operator Move Assignment Operator Homework 2.1 hw211_hexIntToString.cpp hw212_CMidiPacket Submission Format
Week 2_2
2.2 Class Boilerplate example hw22 Setup c221_argc_argv hw222_CMidiPacket Overview Build 1 - Command Line Build 2 - Make Makefile syntax rules Find and Replace compile Use sed for Find/Replace Build 3 - CMake CMakeLists.txt CMake build and run emptyBuildFolder.sh Reading TCPP Essential commands Command help man pages Deleting files and folders Visual Studio Code Tips vsCode cheat sheet Create files/folders in EXPLORER Rename a file Move files/folders in EXPLORER Delete a file Use drag and drop to insert text into Terminal Copy full path names in EXPLORER vsCode Breadcrumbs Intellisense Multiple Cursors Indent/Outdent Bracketed words Eye Candy Homework 2.2 hw221_boilerplate.cpp hw222_CMidiPacket Submission Format
Week 2_3
Class 2.3 Setup Example code General instructions for each folder/file <vector> initialize vector with 5 values size and capacity add one element with push_back add ten elements using push_back inside a for loop reserve empty clear Accessing individual elements of a vector accessing a single element using [ ] accessing an out of range element using [ ] accessing a single element using .at() accessing an out of range element using .at() accessing an out of range element using .at() in a try catch block accessing every element of the vector in sequence Subsets print a subset of elements using a "range-for" for loop print elements using an iterator for loop print elements using an iterator for loop (alternative syntax) print the even numbered elements using an initializer list and a standard for loop print the odd numbered elements using an initializer list and a range for loop print element cubed using a range for loop print element squared using for_each sum the elements in a vector using std::accumulate print elements backwards using a reverse iterator in the for loop erase a single element erase a range of elements resize insert duplicate elements of a vector Sort <random> default_random_engine std::mt19937 Mersenne Twister generator uniform_int_distribution uniform_int_distribution 1 uniform_int_distribution 2 uniform_int_distribution 3 Shuffle 1 Shuffle 2 Shuffle 3 <chrono> C++ timers on Mac OS X c23_chronoFeatures.cpp c23_simple_delay.cpp CMidiPacket considerations Choosing a timestamp Choosing MIDI Byte type Memory footprint Performance Compatibility Reading/Study/Reference MIDI TCCP2 Homework 2.3 Setup homework 2.3 hw231_CMidiPacket hw232_gmdrums hw233_playDrums hw234_scifiSounds Submission Format
Week 3_1
3.1 Class Regular Expressions (regex) c311_regex_example1 c312_regex_example2 c313_helloMidi_regex Reading TCPP2 and www materials What are friends for? CMidiPacket's Four Friends Operator overloads for <<, >>, ==, and < Homework 3.1 hw311_regex hw312_CMidiPacketFriends Submission Format
Week 3_2
3.2 Class Bulletproofing CMidiPacket Homework 3.2 c321_googletest_install Setup googletest googletest documentation hw322_CMP32gtest Preparing for googletest operator less Submission Format
Week 3_3
3.3 Class Directory notes CMakeLists.txt Grading notes scifiSounds example More Bulletproofing c331_checkTimestamps Homework 3.3 Reading Timestamps Tempo and beat hw331_checkTimestamps hw332_CMidiPacket33 Code Invariants Submission Format
Week 4_1
4.1 Lab CMidiTrack class CMidiTrack capabilities Virtual function Pure virtual function Abstract class Base class and subclasses Homework 4.1 hw411_CScalesTrack hw412_gmnames
Week 4_2
Class 4.2 c421_playSoftMIDI (Apple Developer Code) Problems right away Fixes Reading playSoftMIDI code notes vsCode Intellisense help Apple Audio Documentation MIDI and time Scheduling MIDI messages Changing Tempo 4.2 Homework hw421_CDelayMs hw422_CAppleMidiSynth hw423_CScalesTrio Submission Format
Week 4_3
Class 4.3 Drum Sequencer Overview Apple icons for rows 1-8 CS312 Drum Sequencer Homework 4.3 hw431_drumMachine hw431_drumMachine - Xcode Xcode Navigator Toolbar Viewing header and source files Build and Debug in Xcode \\ Breakpoints Stack trace Ending a debug session Submission
Week 5_1
5.1 Class Project 1 - due week 7.1 Guidelines Ideas 12 bar blues Markov chains Homework 5.1 Class7.1 project proposal hw511_blues51 CDrumTrack class CDrumMachine class CInstrument class CBluesSaxTrack class CBluesPianoTrack class CBluesBassTrack class main() hw512_blues_markov Submission Format
Week 5_2
5.2 Class Quiz 1 w2020 review Test rules Terminal commands C++ What is the difference between What is a.out? What is the size in bytes of the following C++ types on mac Write an example of each of these comment types operators Terms Interface and implementation files Printing char Header guards Bullet proofing CMidiPacket The Big Six What is : What is a Markov chain? Arithmetic operations Bit manipulation \\ Memory alignment The Big Six MIDI What MIDI messages are used to emulate these properties of sound in MIDI status bytes and data bytes What happens if you play these messages in MIDIDisply_DLS MIDI Note numbers MIDI Messages Timestamps Strings Vector RegEx Additional code that can be used in Class project 1 std::for_each Function object Lambda Expression Lambda expression with function. c521_splitTracks c522_setVelocity c523_setVelocity_lambda c524_accentEveryNnotes
Week 5_3
Quiz 1 in class.
Week 6_1
Midterm Break Catch up on homework
Week 6_2
6.2 Class Project 1 Guidelines CScalesTrio favorites Audio MIDI Setup AU Lab Setup RtMidi Install RtMidi c621_rt_midiprobe Time to look at the RtMidi docs cmake modifications c622_rt_cmidiin c623_rt_cmidiout Homework 6.2 hw621_cmidiin_cmp33 hw622_midiout_cmp33
Week 6_3
Class Help with class project Answer question 6.3 Homework No new homework Work on your class project
Week 7_1
7.1 Class Project 1 class presentations Homework 7.1 hw711_Qt_cmidiin_gui Open the QtCreator application. Project tool Build and Run Edit tool Design tool hw712 and hw713 requirements hw712_Qt_rtmidiin qmake Task 1 - Add RtMidi and hw331_CMidiPacket files Task 2 - Add code to open RtMidiIn and RtMidiOut Task 3 - Capture MIDI input data and display it hw713_rtmidiin_buttons Variables needed Functions needed Record button Stop button Play button Clear button Button highlighting Submission Format
Week 7_2
7.2 Class libsndfile Download and install libsndfile Audacity sound editor Sample rate and bit depth Period and Frequency Calculate the frequency Time domain and frequency domain Nyquist theorem Nyquist Rate Frequency spectrum Decibels and amplitude Homework 7.2 hw721_gensin hw722_gensin_phasor Phasors hw723_gensin_beatDemo Beats and tuning Modulation hw724_gensin_ringmod Amplitude Modulation hw725_gensin_ammod Frequency Modulation hw726_gensin_fmmod Assignment 726 Reading/Viewing Submission Format
Week 7_3
7.3 Class Install RtAudio Reading Equal Temperament MIDI Note Number To Frequency Half steps, whole steps, and scales Homework 7.3 hw731_playsaw hw732_playsine hw733_playsine_rta hw734_qtplaysin hw735_qtplaysine_midi2freq Program requirements Submission Format
Week8_1
8.1 Class Homework 8.1 hw811_qtwavio Download wav files used in hw81 Create a new Qt Widgets Application Create the build-debug folder. Widget action slots Test the three Slots Add wavio.h and wavio.cpp to the project Task 1: on_actionOpen_triggered() Task 2: on_actionSave_As_triggered() Task 3: Open a wav file, display info about the file, and return a vector of samples The SF_INFO struct Task 4: Save a vector of samples to a wav file Task 5: on_pushButton_Play_clicked() hw812_qtwavio_stats Display the SF_INFO data sox Stats calculations The displayStats() function Calculation hints hw813_qtwavio_plot Download QCustomPlot widget Add more widgets Promote QWidget to QCustomPlot Display a plot Submission
Week8_2
8.2 Class Harmonic Series Harmonics, Overtones, And Partials Harmonic Series In Musical Notation Historical tuning systems Reconciling the tuning problem The Comma Of Pythagoras Equal Temperament in practice Cents The Fourier Series Fourier Series Harmonics Aliasing Homework 8.2 hw821_gensquare_phasor hw822_qtplotBLwav Bandlimited waveforms The Five Classic Synthesizer Waveforms Assignment 8.2 My SawDown implementation Implement the remaining waveforms. Plot the wave forms Tasks remaining in mainwindow.cpp Submission
Week8_3
8.3 Class Final Project Ideas Requirements Wavetables Acceptable Latency Values Sample based libraries Wavetable synthesis Wavetable sample calculation Homework 8.3 hw831_wavetables hw832_final_project_proposal Submission
Week 9_1
9.1 Class Audio Effects hw911_stats_effects Overview of hw911_stats_effects Remove DC Normalize Amplify Reverse Echos ChangeSpeed RandomSnips Program usage Implementing the effects db2amp and amp2db formulas Remove DC Normalize Amplify Reverse Echos ChangeSpeed RandomSnips Assignment hw911 Submission
Week 9_2
9.2 Class Envelopes hw921_plot_adsr GUI controls State Machine Variables needed Implement the ADSR plot Task 1 Task 2 Task 3 Task 4 Task 5 Assignment 921 Submission
Week 9_3
Homework help Quiz2 review page
Week 10_1
Quiz 2 Review
Week 10_2
Quiz2 Work on final project presentation.