# A function to play a given section of a sound

def playSection(sound, begining, end):
  
  startsample = int(begining*(float(getSamplingRate(sound)))) #start position
  endsample = int(end*(float(getSamplingRate(sound)))) #end position
  sectionsound = makeEmptySound(int(end-begining)+1)#create empty sound for the given section
  
  # Print start and end samples
  print(startsample)
  print(endsample)

  #extract the sample in the given section and place into sectionsound
  i = 1
  for sample in range(startsample, endsample): 
    currentsample = getSampleValueAt(sound, sample)
    setSampleValueAt(sectionsound, i, currentsample)
    i = i + 1

  #play the taken section
  play(sectionsound)

  #return the taken section
  return sectionsound
 
