# Template file for Homework 9, CS 151, Fall 2010, ISU
#
# Name: (put your name here)
#
# Collaborators: (put list of collaborators here, none if none).
#
# ** Note on collaboration: You should not turn in work that is not your own.
#    To make sure you are not violating this, if you work with someone, 
#    you should destroy the file once you are done working together, go 
#    your separate ways, and then you should be able to recreate the file
#    on your own, then turn that in.  If you cannot recreate the file on your
#    own, then it is not your work, and you should not turn it in.
# ** Note on sources: if you use some other source, the web or whatever, you
#    better cite it!  Not doing so is plagiarism.
#
#


# This first line has JES load all the functions from the
# cs151functions.py file so we can use them in this file too.
# So we will have this as the first line in our Python files from
# now on.
#
# Make sure to download the latest version of cs151functions.py from the 
# course webpage (make sure to right-click and "Save target as" or 
#  "Save link as" or whatever your browser calls it.)
#
# And then do the following in the command area, and select
# the folder that has cs151functions.py in it:
#
# >>> setLibPath(pickAFolder())
from cs151functions import *


# Problem 1 (15 Points)
#
# This problem is to make a "c chord" - that is a note
# that has c, e, and g notes all "in it".  This was an in-class
# exercise on October 18.  You need to fill in the blanks
# with the appropriate code to finish the funciton.
#
# If the function were correct, it would behave like this:
# >>> sound = cChord()
# >>> explore(sound)
def cChord():
  cNote = note(261, 1, 22500)
  # eNote = _____
  # gNote = _____
  newSound = makeEmptySoundBySeconds(1)
  for i in range(0, getLength(newSound)):
    cValue = getSampleValueAt(cNote, i)
    # eValue = _____
    # gValue = _____
    # setSampleValueAt(newSound, ___, (cValue+eValue+gValue)/3)
  play(newSound)
  return newSound

  

# Problem 2 (15 Points)
#
# This function should take two sound objects as input, should print
# how long they are in seconds, and say which is longer in seconds.  
# If it works right, it could be used like this:
#
# >>> sound1 = note(200, 1, 20500)
# >>> sound2 = note(300, 2, 5000)
# >>> whichSoundLonger(sound1, sound2)
#  First sound is 1.0 seconds long
#  Second sound is 2.0 seconds long
#  The longer sound is: the second one
def whichSoundLonger(sound1, sound2):
  # first put code to compute how long the first sound is in seconds, and
  # print that.

  # Once you get that working, put code to compute how long the second
  # sound is in seconds, and print that.

  # Finally, put code to check which is bigger, and print either 
  # "the first one" or "the second one" as appropriate.

  # take this line out once you have some code in this function.
  print "Not doing anything yet..."
   

# Problem 3, Extra Credit (5 Points)
#
# Since this is extra credit, I will grade it a bit more strictly than
# the regular problems.
#
# Write a function to take a sound object and "fade out" the volume - so 
# making it get gradually smaller until at the end of the sound it is 0.
def fadeOutSound(sound):
  print "Put your code here..."
