The objective of this mini-lab is to practice working with sound in JES.
copySoundInto
function, copySoundIntoAtSec, that takes as a parameter
the number of seconds into the tape to start copying, instead of the
number of samples. You can accomplish this by converting the desired
number of seconds to the corresponding number of samples, and then
making a call to copySoundInto. The
function getSamplingRate will be helpful for making the
conversion. Keep in mind that getSamplingRate returns a
real number, not an integer. That means that any value derived from
the sampling rate will need to be converted to an integer using
the int function before it can be used as an index value.
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?
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.