7 ms·
> if you were to plot it it wouldn't look square, rather it would be wavy Could you go into more detail on why you say this? A real life square wave is square,
by eternauta3k 6y ago
> if you were to plot it it wouldn't look square, rather it would be wavy
Could you go into more detail on why you say this? A real life square wave is square, possibly with some ringing or overshoot in the flanks (but not necessarily)
- mhh__ 6y agoGibbs effect. To sample a signal you need an antialiasing filter in front of the ADC.
- elijahparker 6y agoThe square wave signal will move the speaker in a square pattern, but the actual waves propagating through the air are always sine waves. What you get is a series of harmonics indicative of the square source.
- raverbashing 6y agoThe waves can be mathematically described as a sum of sine waves, but there's no reason why air shouldn't support something that "looks like" a square wave (no more as the speaker anyway) within some limitations. What you might have is that the air might disperse the wave so it gets distorted but still with the same components https://en.wikipedia.org/wiki/Acoustic_dispersion https://en.wikipedia.org/wiki/Acoustic_dispersion
- elijahparker 6y agoBut think about it this way: if you have a plate moving back and forth in a square wave pattern at the surface of a pool of water, would the waves on the water be square?
- raverbashing 6y agoNo, but because surface waves behave differently from sound waves (which are in "3D") https://en.wikipedia.org/wiki/Dispersion_(water_waves) https://en.wikipedia.org/wiki/Dispersion_(water_waves) Basically phase velocity changes with the amplitude and the shallowness of the water. Yes it's easy to think they behave the same, but they don't.
- the_other 6y agoThe sine-ness of the water waves comes more from the mass and "elasticity" of the water, and not from the impulse driving it. If you put the same plate in air (or a speaker cone projecting a square wave) the mass and elasticity of the air permits much more "equare"-like pressure waves.
- hwillis 6y agoWaves in water are surface gravity waves, which air does not have. Because water is pretty incompressible, high pressure causes a water column to rise against gravity. The rate at which the column falls back down is obviously dictated by gravity. The faster the frequency, the more a pressure wave acts like a real pressure wave and less like a surface gravity wave. Since real pressure waves don't rely on gravity for transmission, they travel far faster, resulting in dispersion[1]. You can still have square waves as long as they are 10-100x slower (longer) than normal waves. Since air pressure does not typically produce a height difference in the atmosphere, standard sounds in air are not subject to dispersion and act very differently from water. There is obviously still a limit to the rise/fall time of a square wave, when the transition is more like a shockwave front, but that's a very square wave. [1]: https://en.wikipedia.org/wiki/Dispersion_(water_waves) https://en.wikipedia.org/wiki/Dispersion_(water_waves)
- thdrdt 6y agoPeople focus too much on your water analogy. But it is true: if there was a plate that could move like a square it would not mean all air in the front and back of it would also move like it. The air compression would move like a sine instead of a square.
- jameshart 6y agoEven if the analogy worked, how do you propose to move a plate in a square wave? You would need to instantaneously move it by the wave amplitude.
- magicalhippo 6y agoElectrical square waves aren't really instantaneous either, they just got a very, very fast rise time.
- willis936 6y agoInstead of flawed thought experiments you could try a quick test for yourself: hold your speaker up to your microphone, play a square wave, record sound, and look at the waveform.
- pjc50 6y agoWhat does that tell you? Shouldn't you be looking at the Fourier transform of the waveform?
- willis936 6y agoVisualizing the spectrum of a square wave is so easy, it’s used to teach the concept of the frequency domain. Less square square wave? You likely peeled off some higher harmonics and added some phase noise. The point of the experiment is to demonstrate that sound waves in air are not at all like water waves and sonic square waves do, in fact, exist.
- moefh 6y agoI have no experience whatsoever with sound, but I got curious and did that, and got weird results: https://imgur.com/HSSdM5t https://imgur.com/HSSdM5t (below is the original 440Hz square wave; above is the recorded sound) The recorded waveform looks nothing like the original, and it sounds very different too: the original is much harsher, although the pitch sounds exactly the same, as expected. Might be my crappy microphone? Or maybe the sound is being filtered somewhere along the way?
- willis936 6y agoThat waveform looks pretty good imo. When I did it, I the signal was very weak so the signal to noise ratio was bad. There were low frequency impulses from me moving the headphones around and regular hums from other sources. My best guess for the large attack showing up there is not effects from the microphone, DAC, amp, or anything but the actual speaker. Good audio measurements are hard to come by thanks to all the snake oil, but square wave measurements are common when there is data. The physical models of transducers aren’t trivial, but in a single broad stroke the answer is “physics” and “spring-mass-damper”. https://www.innerfidelity.com/images/AKGK701.pdf https://www.innerfidelity.com/images/AKGK701.pdf The decay is expected, as the pressure around the microphone can only temporarily increase before the pressure wave disperses into the room. As an extreme example, if you turned an entire wall into a speaker and played a square wave, you would be able to make a much more square shaped waveform. There’s no replacement for displacement baby (see: subwoofers). If you want a more square waveform, try using a headphone pushed right up to the mic and going to a higher frequency (like 1 kHz). Edit: If you want to skip the trip down the rabbit hole: I think the end-all for audio quality are sealed in-ear monitors (IEMs). Low group delay from short distance from transducer to eardrum, and sealed enclosure for good bass response (see: square shaped low frequency square waves).
- pps43 6y agoTo produce a square wave, speaker cone should move with infinite speed.
- Gravityloss 6y agoYeah it's probably limited by the speed of sound at least. 10 mm movement and 20 000 Hz is probably supersonic diaphragm with some really back of the envelope calculation...
- kxrm 6y agoI think they are referring to something like this: http://1.bp.blogspot.com/-WhH0B8mnGhw/UZhL9ehVa8I/AAAAAAAAAHc/MjfU6uU7rgI/s1600/fourier_square_wave.jpg http://1.bp.blogspot.com/-WhH0B8mnGhw/UZhL9ehVa8I/AAAAAAAAAH...
- stagas 6y agoExactly, what I'm trying to explain (although it's not easy as it's not very intuitive), is that we get more interesting sounds by clipping a signal's peaks to square because it is identical to _adding_ lots of different frequencies to the same sound in a way that their cancelling each other out would be represented as a square in digital audio, because of lack of detailed sampling at that level. The actual signal does not just flat stop at the square peak, the peaks get more signals in different frequencies added to them at playback, so they sound richer. You send a square to the speaker, the speaker isn't doing square, it pulsates in a sinusoidal fashion, nothing is fast or solid enough to produce flat square. Maybe you can find these harmonics in a factory with steel equipment, but they will still be pulsating at very high frequencies, which is why these "real" sounds are so much richer than a speaker.
- pjc50 6y agoThere are no real life perfect square waves for the same reason there are no ideal diodes, capacitors etc; you cannot have a perfect vertical cliff because that would have infinite slew, and you cannot have perfectly sharp corners because that implies infinite second derivative, etc. The best you can get is a tight curve into an extremely steep "triangle". The amplifier driving the speaker has finite slew. The speaker itself is constrained to move at finite speed and cannot accelerate instantly. The air has a finite slew rate - the speed of sound. Stackexchange has a discussion on trying to determine a maximum frequency in air here: https://physics.stackexchange.com/questions/23418/is-there-an-upper-frequency-limit-to-ultrasound https://physics.stackexchange.com/questions/23418/is-there-a... which leads to all sorts of useful sub-discussions. Attenuation depends on frequency; the higher frequency harmonics are more subject to attenuation in air, as well as reflecting off surfaces and self-interfering.