aiusepsi

aiusepsi t1_je4u9v5 wrote

A computer doesn't, but software is (at least for now) written by human beings. You could have the size of the actual payload be implicit, and calculated from the information you've already seen, but there's more opportunity for the person writing the code which is reading the file to get the calculation wrong in some subtle way.

If the size is written explicitly just before the data, you can make the code which reads it much simpler and therefore more reliable. Simple and reliable is really good for this kind of code; mistakes can lead to software containing security vulnerabilities. Nobody wants to get a virus because they played a .wav file!

2

aiusepsi t1_je4ogqj wrote

ASCII actually only uses 7 bits per letter, but because the smallest block of bits that a typical computer can individually access is 8 bits, the 8th bit goes unused and is always 0.

Which turned out to be very useful; the extra bit can be used for backwards-compatible extensions to ASCII, like UTF-8, which can represent characters not available in ASCII.

4

aiusepsi t1_j8miaub wrote

EM fields in general aren't cyclical (I would usually say 'periodic' for what you mean by that), for example consider the magnetic field surrounding a magnet; that's completely static, so it doesn't change over time, and it just gets weaker with distance from the magnet.

Electromagnetic waves are, mathematically, a lot like lots of other kinds of waves, like sound waves, or waves on the surface of water. All your need is some kind of field, that is, a property which exists at each point, and for the physics of that field to obey a particular form of equation, and waves will exist in that field. For obvious reasons, that kind of equation is called a 'wave equation'.

For sound waves, the field is air pressure. On the surface of water, it's the height of the water's surface. Those are scalar fields, that is, those properties can be described by a single number. EM is a bit different because it's a vector field with two vectors at each point in space. But ultimately, they end up looking very similar.

If you graph out air pressure on one axis and space on the other axis for a sound wave, you get a sinusoid, i.e. it looks the same as graphing y = sin x. And that's exactly what you get if you graph out just the length (i.e. magnitude) of the electric field vector (rather than worrying about the direction of the vector) along the direction the wave is travelling. Just pretend it's a scalar field like air pressure!

Graphing out the magnitude of the magnetic field is basically the same, the electric and magnetic fields vary in the same way in an EM wave, just that the electric and magnetic field vectors are at right angles to each other, and they're both also at right-angles to the direction the wave is travelling.

Anyway, for all of the above, wavelength is just the distance between adjacent peaks on the graph.

5