[Csnd] OT: uncertainty question
Date | 2012-09-27 23:57 |
From | peiman khosravi |
Subject | [Csnd] OT: uncertainty question |
Hello, I have a physics question. I have always been told that a pure sine-wave can only be pure if it has no beginning and end. Is this true? Thanks Peiman
|
Date | 2012-09-28 00:08 |
From | Richard Dobson |
Subject | Re: [Csnd] OT: uncertainty question |
Strictly speaking, yes. Somewhat like the circumference of a circle. The basic maths of sinusoids (and Fourier theory) presumes they are infinite (witness e.g. all those integrals we see all the time between ± infinity). As soon as we add starts and stops (aka transients) we throw a mathematical spanner into the works (the sinusoid is multiplied by a step function or rectangular window). Of course ~with care~ we can minimise the consequences, or conveniently ignore it; but it remains the case that just as the circle has no beginning nor end, a sinusoid doesn't either. Richard Dobson On 27/09/2012 23:57, peiman khosravi wrote: > Hello, > > I have a physics question. I have always been told that a pure sine-wave > can only be pure if it has no beginning and end. Is this true? > > Thanks > Peiman |
Date | 2012-09-28 00:09 |
From | Justin Smith |
Subject | Re: [Csnd] OT: uncertainty question |
Yes. In strict fourier decomposition all frequencies are of infinite duration. Any finite signal is a sum of infinite signals that selectively cancel. In computer land we analyze small chunks, then we start with a frequency with a wavelength identical to the chunk size, and we only use frequencies that are even multiples of that frequency. So if your window length is sr/1 samples, you can detect 1hz, 2hz, 3hz, 4hz, etc. up to nyquist. If your window length is sr/10 samples, you can detect 10hz, 20hz ... If your window is sr/12 samples long you get 12hz 24hz 36hz etc. in your analysis. On Thu, Sep 27, 2012 at 3:57 PM, peiman khosravi |
Date | 2012-09-28 00:20 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
Thanks Richard, That makes sense. So the care you mention is adding a window function to smooth the edges? Also, does this in anyway relate to the uncertainty principle? Thanks Peiman
On 28 September 2012 00:08, Richard Dobson <richarddobson@blueyonder.co.uk> wrote: Strictly speaking, yes. Somewhat like the circumference of a circle. The basic maths of sinusoids (and Fourier theory) presumes they are infinite (witness e.g. all those integrals we see all the time between ą infinity). As soon as we add starts and stops (aka transients) we throw a mathematical spanner into the works (the sinusoid is multiplied by a step function or rectangular window). Of course ~with care~ we can minimise the consequences, or conveniently ignore it; but it remains the case that just as the circle has no beginning nor end, a sinusoid doesn't either. |
Date | 2012-09-28 00:22 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
On 28 September 2012 00:09, Justin Smith <noisesmith@gmail.com> wrote: Yes. In strict fourier decomposition all frequencies are of infinite Thanks. So if the window is sr/sr (one sample long) then you get a broadband noise that spans between 0 hz up to nyquist?
P
|
Date | 2012-09-28 00:27 |
From | Justin Smith |
Subject | Re: [Csnd] OT: uncertainty question |
Yes. You detect exactly one frequency bin, nominally that frequency is sr/2 (you have looped thanks to nyquist effect from sr/2 to 0 back up to sr/2). It tells you the sum total energy of the signal . You can get this data without conducting an fft: since your window is one sample long, the value of the analysis is simply the value of the sample. On Thu, Sep 27, 2012 at 4:22 PM, peiman khosravi |
Date | 2012-09-28 00:38 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
OK, I see. It all becomes clear! Thanks a lot. You see I'm a little confused by something Wishart says in "On Sonic Art": "[...] if we produce a single cycle of a sine wave [...] what we will in fact hear is a click, a sonic impulse whose frequency is maximally indeterminate. This is not [...] just a limitation of the ear. It is intrinsic to Fourier analysis itself".
Is this a limitation of computation (digital) or a limitation Fourier? If the latter then why isn't a complete cycle enough? Thanks Peiman On 28 September 2012 00:27, Justin Smith <noisesmith@gmail.com> wrote: Yes. You detect exactly one frequency bin, nominally that frequency is |
Date | 2012-09-28 01:03 |
From | luis jure |
Subject | Re: [Csnd] OT: uncertainty question |
on 2012-09-27 at 16:09 Justin Smith wrote: >Yes. In strict fourier decomposition all frequencies are of infinite >duration. Any finite signal is a sum of infinite signals that >selectively cancel. which brings an interesting paradox: sampling is impossible, because finite signals aren't band-limited, and band-limited signals are infinite... |
Date | 2012-09-28 01:35 |
From | Richard Dobson |
Subject | Re: [Csnd] OT: uncertainty question |
Its not the right time of the day /night to continue this but: Fourier analysis is predicated on the assumption of periodicity - when it "sees" a (windowed) single cycle it does not see discontinuities but a pattern matching an infinite sinusoid of that frequency. So in fact it is incorrect even to describe it as seeing a single cycle. It assumes that whatever it sees is periodic over the length. When we create a single cycle we are in effect convolving the single-line spectrum of that infinite sinusoid with that of a rectangular window; and that spectrum of course is anything but a single line. As soon as the sinusoid itself fails to fit that window length ~exactly~, as is almost invariably the case, the result is massive spectral leakage (comparable to the worst possible choice of loop points in a sampler). Which is why we use Hamming windows etc ion spectral analysis. The spectrum of a single impulse is flat from DC to Nyquist (or in analogue terms flat over all frequencies - infinite bandwidth); which is why it is valuable for system testing - literally the "impulse response". Conversely, the spectrum of the infinite-length sinusoid is a single line. Moving from one situation to the other defines the time/frequency tradeoff. The only reason we do not use impulses when ~listening~ to a system is that there is essentially no acoustic energy in a single impulse; the ear has nothing to work with. Ears need white or pink noise over several seconds, computers can manage with the single impulse. So - we do require a certain minimum amount of time to recognise a frequency, and one cycle is basically nothing like enough. We simply perceive the rms energy (and extended bandwidth) of what is a more or less extended pulse. So in that sense Wishart is not entirely correct - the analogy between Fourier Analysis and the ear is not exact. Fourier extends the waveform by assuming it is periodic, whereas our ears do not do that- we hear the single cycle much as he describes. Where the analogy does fit better (though still not perfectly) is with respect to accurate pitch detection. Given a single cycle we can't get enough information to converge on the pitch; we need several of them. I think the psycho-acoustic lower limit is around 30msecs, but at that duration we really are not going to be sure if it was 440Hz or 445Hz. And given the assumption of an anechoic environment, that threshold duration might in fact need to be even longer. Fourier analysis suffers from a very similar problem, which can be understood simply enough if we start with a single sample - there is no "instantaneous frequency" information at all. As we add samples, we very slowly start to get an idea of what the frequency might be. We are unlikely to be able to give a small fraction of a cycle to an FFT and get a believable result. The inevitable arithmetical approximations lead to a definable error range. This is thus the classic time/frequency tradeoff or uncertainty - to get a precise value for frequency we need ~at least~ a full cycle, preferably more to minimise the error; but then we cannot in principle nail down the time more accurately than the duration of that cycle. And so to bed...:-) Richard Dobson On 28/09/2012 00:38, peiman khosravi wrote: > OK, I see. It all becomes clear! Thanks a lot. > > You see I'm a little confused by something Wishart says in "On Sonic Art": > > "[...] if we produce a single cycle of a sine wave [...] what we will in > fact hear is a click, a sonic impulse whose frequency is maximally > indeterminate. This is not [...] just a limitation of the ear. It is > intrinsic to Fourier analysis itself". > > Is this a limitation of computation (digital) or a limitation Fourier? > If the latter then why isn't a complete cycle enough? > |
Date | 2012-09-28 02:26 |
From | Justin Smith |
Subject | Re: [Csnd] OT: uncertainty question |
> So - we do require a certain minimum amount of time to recognise a > frequency, and one cycle is basically nothing like enough. We simply > perceive the rms energy (and extended bandwidth) of what is a more or less > extended pulse. So in that sense Wishart is not entirely correct - the > analogy between Fourier Analysis and the ear is not exact. Fourier extends > the waveform by assuming it is periodic, whereas our ears do not do that- we > hear the single cycle much as he describes. A single cycle of a sine wave sounds like a click because it has the frequency spectrum of a click. A single cycle of a sine wave in isolation does not have the same spectrum as the same wave repeated indefinitely. In fact as you are probably aware bandwidth and duration are inversely tied. The shorter the signal the wider the bandwidth. We hear a click from one cycle of a sine wave because the frequency content of a single cycle of a sine wave is effectively a bandlimited impulse, containing energy throughout the frequency spectrum. |
Date | 2012-09-28 10:14 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
Wow, thanks to everyone for such amazingly detailed explanation. One question below. This is one of those threads that I must print out!
And if the cycle does fit a window exactly (and the edges of the rectangular window coincide with points of zero amplitude) then the Fourier analysis sees an infinite sinusoid? So if I understand correctly, in order to know the frequency of a sinewave the Fourier analysis requires at least one cycle, which it assumes continues infinitely. In Fourier terms a pure sinewave is infinite in duration but this does not mean that the analysis of a sinewave that lasts for 12 hours reveals a narrower band of spectral energy (more certainty about frequency) that that of a 10 second sinewave!? Rather, the threshold is the cycle, after which point the algorithm just assumes that the pattern repeats for ever. Is this understanding correct?
Another question is why the attached picture shows a wide spread of spectral energy at the start? This can't be related to uncertainty as there are a few cycles within that time frame. Or is it?
Thanks very much Peiman |
Date | 2012-09-28 10:19 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
On 28 September 2012 02:26, Justin Smith <noisesmith@gmail.com> wrote:
So do you mean in terms of Fourier transform a single cycle is not enough to detect a sinewave even if the cycle fits the window perfectly? Now I'm confused!
Thanks Peiman
|
Date | 2012-09-28 10:58 |
From | Richard Dobson |
Subject | Re: [Csnd] OT: uncertainty question |
No, the FT will indeed recognise a single cycle. For the sake of relative simplicity: the FFT (which is what were are usually dealing with; a "special case" of the more general Discrete FT) matches the supplied waveform against a set of "basis functions" (whicha re themselves implicitly periodic), which are sinusoids at integral harmonics of the fundamental, whose wavelength is that of the window. So a single cycle in the window will be successfully matched to the fundamental, and appear in bin 1 (bin 0 represents any DC or additive offset present) But when we try to listen to a single cycle (i.e. surrounded by silence), we have a completely different situation, which results in our hearing a click. The clue to the issue of periodicity can be seen in the conversion of domain, from amplitude/time to amplitude/frequency; i.e. in the latter case there is no temporal dimension at all. An FT is in effect timeless, and this translates to the principle that one cycle is simply representative of an infinite number of identical ones. The circle remains a circle of the same shape however long we look at it from a fixed position. Another example is the use of the FT to analyse an impulse response of a system such as a filter. This is "linear time-invariant" (LTI) - we get the same response whenever we inject the impulse, so the IR itself is strictly amp/freq, not anything/time. Put yet another way; the temporal context of a FT is something ~we~ know (we know which bit of a waveform we are analysing), but this is not information contained within the FT itself. Conversely, if we are simply given the FT of "some waveform", we have no idea of where or when it was taken. A circle drawn 200 years ago is still a circle, still with the same properties. There is no temporal context in a FT at all. Of course, in a system such as the phase vocoder, the engine keeps track of the temporal evolution frame by frame, and knows how to glue the frames together correctly. An individual analysis frame (deriving from a single FFT) has no sense of its place in time; it is in principle identical for example if the whole sequence is played backwards. But this description hides the nasty matter of phase accumulation which is where pvoc gets its name. Pvoc frames are not "pure" FFTs but conversions to amplitude/frequency where the (unwrapped) phase is tracked from frame to frame. In this sense a given frame contains within it the whole (averaged) history of the sound up to that point. Occasionally this can hit us in the form of smearing and reverb effects, which one way and another are artifacts of "time aliasing". It is in the end a simple summation, and while we can add up N numbers to create another, we cannot perform the reverse process short of knowing what all the original numbers were to being with. There are other sets of numbers which could equally give the same result. At best we can imagine that the history of the sound is so to speak "implicated" in each frame in the sense David Bohm uses that word (the "implicate state" of the universe); so "infolded" into the frame that unravelling it is not possible. We can therefore say that our single wave cycle is equally temporally undefined - it is simply a shape which can exist anywhere, any time. If we choose to place it by itself in time, we have only ourselves to blame for the consequences! Richard Dobson On 28/09/2012 10:19, peiman khosravi wrote: >.. > > So do you mean in terms of Fourier transform a single cycle is not > enough to detect a sinewave even if the cycle fits the window perfectly? > Now I'm confused! > |
Date | 2012-09-28 16:02 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
Thanks you very much Victor and Richard. This has clarified many things for me. I think I'm going to enrol on a physics course soon and study DSP properly. Thanks again. Peiman On 28 September 2012 10:58, Richard Dobson |
Date | 2012-09-28 17:09 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
Attachments | Screen Shot 2012-09-28 at 10.10.08.png |
I think I forgot to attach the picture before! P On 28 September 2012 16:02, peiman khosravi |
Date | 2012-09-30 13:45 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Csnd] OT: uncertainty question |
What a fantastic discussion. Thank you all so much! -dB ------------------------------------------ Dr. Richard Boulanger, Ph.D. Professor of Electronic Production and Design Professional Writing and Music Technology Division Berklee College of Music 617-747-2485 (office) 774-488-9166 (cell) ------------------------------------------------------------------------------------------------- On Sep 28, 2012, at 11:02 AM, peiman khosravi <peimankhosravi@gmail.com> wrote: Thanks you very much Victor and Richard. This has clarified many |
Date | 2012-09-30 13:54 |
From | J |
Subject | Re: [Csnd] OT: uncertainty question |
Agreed, this one's a gem, and leaves me with a lot to wrap my head around! Jeremy
On Sun, Sep 30, 2012 at 1:45 PM, Dr. Richard Boulanger <rboulanger@berklee.edu> wrote:
www.jeremykeenan.info |
Date | 2012-09-30 14:28 |
From | peiman khosravi |
Subject | Re: [Csnd] OT: uncertainty question |
I picked up my copy of 'The Audio Programming Book' and started reading Victor's chapter on Fourier transform, DFT and STFT. It's really great! Best, Peiman On 30 September 2012 13:54, J |
Date | 2012-09-30 15:03 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Csnd] OT: uncertainty question |
It sure is! Sent from my iPhone. On Sep 30, 2012, at 9:28 AM, peiman khosravi |
Date | 2012-09-30 15:12 |
From | J |
Subject | Re: [Csnd] OT: uncertainty question |
Cheers, I'll crack mine open, I've not had enough time to properly check it out, this is giving me some motivation to do so! Jeremy
On Sun, Sep 30, 2012 at 2:28 PM, peiman khosravi <peimankhosravi@gmail.com> wrote: I picked up my copy of 'The Audio Programming Book' and started www.jeremykeenan.info |
Date | 2012-09-30 20:41 |
From | Adam Puckett |
Subject | Re: [Csnd] OT: uncertainty question |
And I have my copy of the Csound sources... ;) On 9/30/12, J |