5 ms·
Is an audio stream really just a bunch of samples of volume? I had always assumed you needed to record different wavelengths of sound to capture different pitch
by jonplackett 7y ago
Is an audio stream really just a bunch of samples of volume? I had always assumed you needed to record different wavelengths of sound to capture different pitches. Is my mental model completely wrong? How do you get such variety in sound just from recording the volume?
- fireattack 7y agoYou don't record each "waves" (nor is it even possible), you record the final result of all the waves superposed together, just like how your ears work.
- jcims 7y ago>You don't record each "waves" (nor is it even possible) Depends on what you mean by 'record'. Generally the air pressure is sampled instantaneously, but it can be broken down into frequency components before recording/perceiving. That's kind of how our ears work and in DSP you do an FFT (which you can then pass through an iFFT to synthesize the original signal).
- fireattack 7y agoIt has been a while since I study DSP, so I'm not sure if FFT can mathematically recover all the original sine waves (FT can). But I don't think it is possible practically, at least.
- kortex 7y agoYes, if you use the FFT or any discrete FT, you can perfectly recreate the signal up to the Nyquist frequency. To perfectly recreate the whole signal, you'd need infinite Fourier coefficients.
- fireattack 7y agoThanks
- grattis 7y agoSound propogates by displacing the medium it's traveling in. So at every point in time we can only sample the displacement (amplitude/volume). Our cochlear hair cells do a Fourier transform to decompose the sound into component frequencies for the brain to analyze. Similarly, an audio stream is just samples of the amplitude over time and we need to do additional processing to extract the frequencies.
- Ace17 7y agoPCM doesn't make any special case for different wavelengths. It's simply the air pressure over time (pressure on your ears, on the speaker's membrane, etc.) It doesn't directly correspond to the volume ("f(t)=1" is as silent at "f(t)=0"). So yes, an (uncompressed) audio stream is just a sequence of samples of pressure (or displacement, depending on the medium). The variety you get comes from the high sampling frequency: a high sampling frequency allows representing vibrations of the air pressure at many frequencies.
- clarry 7y agoWhen samplerate is fixed, different pitches show up as waveforms having a different number of samples (per cycle). Each sample is a constant time step apart; you can count the number of samples (= length of time) of a period. Frequency is inversely proportional to period.
- sharpneli 7y agosuper simplified explanation Samples of pressure (or displacement, minor phase difference), so kinda yeah. How one gets so much variety? By sampling it really often. If you sample it 40000 times per second you actually get the full information for all pitches that are between 0 and 20000Hz. If you don’t sample it often enough you don’t get all the information needed to store the sound. So yes we kinda indirectly do capture all the different pitches.
- nabla9 7y agoYes, it's only a stream of samples. The magic is the linearity of the signals. They are additive. The different signals pass through the same stream of samples without interacting. If you add volumes from sine wave in 400 Hz to sine wave in 300 Hz, you can transfer them together in a stream of samples , then separate them later. Mathematically: f(at + bt) = af(t) + bf(t)
- atoav 7y agoYou were probably mixing the time domain (just samples representing the desired speaker membrane position) up with the frequency domain (the energies of a punch of sines at different frequencies, which you get by running a FFT on the samples). Both exist and are beeing used, but Samples are the default in uncompressed audio.
- thdrdt 7y agoWhen a speaker cone is moving in and out at 100hz you will hear a sine bass sound. But when the cone is also vibrating at 10000hz while moving in and out at 100hz there will be another pitch on top of the bass sound. So different wavelengths added together will tell your brain there are different pitches at the same time. When all those different wavelengths are using the same volume at the same time you can imagine that all those added waves will become a mess. That is what is called noise. But when a high pitch wave is 'traveling' on top of a low pitch wave your brain can distinguish the different pitches.
- layoutIfNeeded 7y ago>Is an audio stream really just a bunch of samples of volume? Yes. > I had always assumed you needed to record different wavelengths of sound to capture different pitches Why? Look at a mono vinyl record. It has a single groove, which is the soundwave carved into the vinyl. Digital audio is the same, except you store a digital image of the groove. >Is my mental model completely wrong? Yes. >How do you get such variety in sound just from recording the volume? By recording the volume 44100 times per second.
- jdietrich 7y agoHow do you get such variety in sound just from recording the volume? https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampli...
- mastax 7y agoIf you want to learn more, this article has a good intro to sampling theorem, among other things: http://people.xiph.org/~xiphmont/demo/neil-young.html http://people.xiph.org/~xiphmont/demo/neil-young.html
- 8bitsrule 7y agoSuppose you're at a rock concert. You hear several string instruments, drums, maybe a keyboard, and a voice or two all together at the same time. What reaches your ears is continuous differences in the air pressure. That's more-or-less a single changing 'amplitude'. From that, your brain can pull apart the fundamental and overtone pitches from each source ... and sort them out so you can identify each one. Amazing technology ... almost indistinguishable from magic! These days lots of people haven't seen audio on an oscilloscope ... which shows changes in amplitude with time. Look at this video. You'll see that at each point in time (left to right), there's ONE amplitude, whether he plays one string or more. https://www.youtube.com/watch?v=Dd5dgajeIOA https://www.youtube.com/watch?v=Dd5dgajeIOA
- jonplackett 7y agoThanks for all the explanations! Super helpful!