Mini-Lab: Cropping Sounds

 


Introduction

The objective of this mini-lab is to practice working with sound in JES.


More work with copyInto + Cropping

  1. Earlier in the course, we looked at cropping images. We can do something similar with sounds. Write a function called cropSound which crops a section of a sound and returns just the cropped piece. Your function should take as parameters the sound, the index to start cropping, and the number of samples to include in the cropped sound.
    Design Questions: How big do we want the resulting sound to be? Does it depend on how long the original sound is? How do we know how long the original sound is?

  2. Write a new function, cropSoundByTime that takes three parameters: the sound, the number of seconds into the sound to start cropping, and the number of seconds to include in the resulting sound. You should be able to accomplish this by making a call to the cropSound function. The resulting function should only be 2-3 lines long.

Submit your results

  1. Submit the file you created in this mini-lab via .