CS 111 - 4/27/17
Exam 3 - Monday 5/1/17 at 10:30am
Currently Scheduled for LC-F4 (hoping to change this)
Exam 3 Topics:
Python
lists (arrays)
variables
for loops
while loops
if statements
relational operators
boolean operators
arithmetic operators
assignment operator
functions
parameters
return values
Sound (Q 21, 22 and some multiple choice)
range of amplitude (-32,768 to +32,767)
samples per second (normally 22050)
getSamplingRate( )
getLength( )
makeEmptySound ( samples )
makeEmptySoundBySeconds ( seconds )
getSamples ( ) - returns a list of sample values
getSampleValue ( ) - returns the amplitude at a sample
setSampleValue ( ) - update the amplitude at a sample
Sound Algorithms
volume modify
combine - played in parallel (at the same time)
join - played in sequence (one right after the other)
makeSoundByte ( ) - similar to crop
validate that indexes are within length of sound
change frequency
reverse( )
createEcho ( )
clipping( )
check if the amplitude was outside of the desired range
fade-in/fade-out
Normalize sound ( make it as loud as possible)
=====================================
1. Prompt user for input string
2. Loop for each character in the string
3. calc frequency for each character
4. generate sine wave for frequnecy
5. join sine wave together into result
6. Explore/play sound
7. write out sound
===================
z = 0
for x in range ( 0, 4, 1): # x goes from 0 to 3
for y in range ( 0, 3, 1): # y goes from 0 to 2
z = z + x + y
x: 0 1 2 3
y: 0 1 2 0 1 2 0 1 2 0 1 2
z: 0 0 1 3 4 6 9 11 14 18 21 25 30
================================
list = [ 1, 3, 5, 7, 9, 11, 13 ]
length = len(list) # 7
for i in range ( 0, len(list) - 1 , 2 ):
x = list[i] + list[i+1]
list[i] = x
x: 4 12 20
i: 0 2 4 6
pos: 0 1 2 3 4 5 6
list: [ 4, 3, 12, 7, 20, 11, 13 ]
================================
x = 0
z = 0
while ( x < 5 ):
if ( x < 3 ):
z = z + 2
else
z = z + 3
x = x + 1
x: 0 1 2 3 4 5
z: 0 2 4 6 9 12
=====================
z = 0
for x in range ( 0, 5 , 1 ):
if ( x < 3 ):
z = z + 2
else
z = z + 3