Strings and Sounds
Lists
XML
Syntax
Random!!
100

What would be the output of the following?

>>> name = 'Mark'
>>> print 'Hello, ' + name

Hello, Mark

100

What is the out of the following?

>>>a[100, 30, 20]
>>>a

100, 30, 20

100

What do we call an individual unit or splice of an audio file?  Hint: there are tens of thousands of them per second.  

Sample

100

What is wrong with the following function?

def addOne(number): print number + 1

Everything is one line / there is no block indentation.

100

What would be the output of the following?

>>> a = 5
>>> b = 8
>>> a == b

False

200

The difference between these three: 

"""

The first and second are interchangeable, the third includes paragraphs

200

What is the output of the following?

>>>a[100, 30, 20]
>>>a[2]

20

200

How many samples are in CD quality audio?

44,100

200

Which is correct?

if (x==2):
  print "yes"

if (x=2):
  print "yes"

The first, 

if (x==2):
  print "yes"

200

What is wrong with the following?

def(setValue):
  a = 5

__________________

>>> print a

The context of the variable 'a' is only valid inside the function.

300

Describe the difference between a MIDI sound and an audio file.

MIDI is not a natural instrument, it is generated sound coming from a computer.  An audio file is a wav (or other) recording of a natural acoustic sound.

300

Describe the code needed to set a variable a that would store the values 100 and 20

>>> a[100, 20]

300

Describe the process to increase or decrease the frequency of a sound.

Either double or half the length of the wave representing a given sound.  

300

What would need to change to produce the desired outcome of 2.5?

>>>5 / 2

>>>5.0 / 2.0

or

>>>5.0 / 2 

or 5 / 2.0

300

What are the highest and lowest values we can assign for amplitude within a 16 bit sample.  


32,768 and 32,767

400

What are the highest and lowest values we can assign for amplitude within a 16 bit sample.  

32,768 and 32,767

400

What is the output of the following?

>>>a['green', 'eggs', 'ham']
>>>a[0] * 3

greengreengreen

400

How many bits are used to store an audio sample that is CD quality, allowing for sample ranges from -32,768 to 32,767

16 bits or 2 bytes

400

What mathematic operator is needed to combine two sounds.  Explain your choice.  

'+' for adding samples

or '*' if you want to blend at a given ratio (ex: 0.5)

400

Define amplitude.

The distance from the zero point to the greatest pressure (or least pressure).

500

Explain the meaning of frequency, and give a common minimum and maximum frequency that humans can hear.

Frequency is determined by the number of repeating waves in a given second, and a common frequency that humans can hear is from 5 to 20,000Hz

500

>>> a = ['spam' , 'eggs' , 100 , 1234]
>>> ????????                                  
>>> a                                              
['spam', 'eggs', 123, 1234]     

a[2] = a[2] + 23

500

What is a sampling rate?  What sampling rate does CD quality audio use?

How many samples are used in a given second.  CD quality audio uses 44,100 samples per second.

500

Write on the board how to create a sound object from a wav file located at c:\sound.wav.

makeSound('c:\sound.wav')

or makeSound(pickAFile())

500

What would the following function do?

def mystery(sound):
    for sample in getSamples(sound):
          value = getSampleValue(sample)  
          setSampleValue(sample,value * 2)

This would increase the volume of an audio file passed to it.