9.5. Mirroring a Sound
Once we know how to play sounds forward and backward, mirroring the sound is the exact same process as mirroring pictures! Compare this to Program 19 (page 135). Do you see that this is the same algorithm, though we're dealing with a different medium?
Program 79. Mirror a Sound, Front to Back
To use this method try:
> Sound s = new Sound(FileChooser.getMediaPath("croak.wav")); > s.explore(); > s.mirrorFrontToBack(); > s.explore();
The length of the sound in the file "croak.wav" is 8,808, so the mirror point is at 4,404. Use the explorer to check the values on either side of the mirror point (Figure 9.5).
Figure 9.5. Comparing the mirror point in the original sound (left) to the mirrored sound (right).