Today I was thinking about JavaScript, and then something just dawned upon me. You know what I figured out? I figured out why is it that when you fast-forward a sound, it gets a higher pitch, and a slowly-played sound gets a lower pitch. You know, like when conversations get fast-forwarded, the people sound like very fast chipmunks. This effect shall here be called the Fast Forward Effect, or FFE.
You have to know a lil bit about sound before you can understand the effect, so I'll explain it right here. There are two main things to know:
- Sound is vibrating air: No sound can be produced in outer space. Why? Cause there's no air. Sound needs air to exist, because, actually, all sound is is vibrating air. And scientists say they've studied sound, and concluded that these vibrations can be represented as senoidal waves like the ones above. And they've also found out that, the shorter the wavelength, the higher the sound's frequency (or pitch). And the taller the wave, the LOUDER the sound. Nice, right?
- The way sound is transmitted: Ever wonder how sound is transmitted through electricity in wires? Probably not, but anyway... sound is digitally transmitted in the PCM format. What? PCM format is a way of encoding sound with numbers. Here's how: you have to take samples of the height of the audio wave as it goes up and down through time. Like, in image 2, the little dots on the waveline are the samples taken... they could be: { 0,0.7,1.3,1.8,2.3,2.6,2.8,2.9,2.8,2.6,2.3,1.8,1.3,0.7,0,-0.7,-1.3, etc...}. And, with these numbers, it is very possible to reproduce the original soundwave. Which they actually do.
If you've come so far, you probably know the answer already. If you send these numbers at a certain "pace", like saying, each number comes every 0.05 seconds, then the sound will be just as it's supposed to be. But what happens if you send these numbers at double speed? Then each of those numbers would come every 0.025 seconds. And so, if we maintain the time-scale, the wave being sent will look like this:
And of course, you can imagine: the sound has a shorter wavelength, so it has a higher frequency (or pitch). Hence, FFE occurs.
You can imagine the same thing for a slower-played audio.
No comments:
Post a Comment