Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Some examples of waveforms with the same power spectrum, different phases

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by Joe Gwinn View Post
    No, I said that in practical systems there is always a significant imaginary (quadrature) component.
    You did not, and it is not true in any case. An infinity of different types of digital filters can be linear phase and have no imaginary part. And it is possible to build analog filters where it is small enough to be insignificant in the application.
    Originally posted by Joe Gwinn View Post
    Linear phase implies Bessel.
    Certainly not. Bessel filters give the best approximation to linear phase for a given number of components, but they are not the only choice. Gaussian might be better in some circumstances, and before computer processing, it was common to use approximate square pulse matched filters made from Ls, Cs, and Rs. These are all approximations to linear phase.

    Originally posted by Joe Gwinn View Post
    Well, we are certainly recapitulating the debate of decades.
    That is not what I am doing. That decades old debate is mostly a lot of hot air or worse. I have presented some actual evidence, and you have made a valiant effort to poke holes in it, but so far you have failed.
    Originally posted by Joe Gwinn View Post
    Phase is known to be important in angle-of-arrival determination, so it cannot be said that humans are totally insensitive to phase.
    Angle-of-arrival determination is understood as a time delay problem. (There may be some method to my madness in measuring the transient response of the ear in the second post.)
    Originally posted by Joe Gwinn View Post
    Saying that people "don't want to believe" is ad hominem, and begs the question of if the current models of human hearing are both correct and complete.
    Ad hominen? I am attacking your arguments, not you. All those "people" are not in this debate, and thus are not subject to ad hominen attack.

    Comment


    • #17
      Originally posted by Mike Sulzer View Post
      You did not, and it is not true in any case. An infinity of different types of digital filters can be linear phase and have no imaginary part. And it is possible to build analog filters where it is small enough to be insignificant in the application.
      In math, yes. In practice, not so much.

      Certainly not. Bessel filters give the best approximation to linear phase for a given number of components, but they are not the only choice. Gaussian might be better in some circumstances, and before computer processing, it was common to use approximate square pulse matched filters made from Ls, Cs, and Rs. These are all approximations to linear phase.
      In math, yes. But in radar practice these are all summarized as Bessel, understanding all the while that Bessel (actually Bessel-Thompson) is an implementable approximation to Gaussian.

      That is not what I am doing. That decades old debate is mostly a lot of hot air or worse. I have presented some actual evidence, and you have made a valiant effort to poke holes in it, but so far you have failed.
      Sure we are. By saying that the debate of yore "is mostly hot air or worse", you are asserting the correctness and completeness of the theory as the reason that there can be no exceptions. But it's precisely the completeness that is in question. And, mostly is less than all, so you are saying that not all of those old debates are nonsense.

      Angle-of-arrival determination is understood as a time delay problem. (There may be some method to my madness in measuring the transient response of the ear in the second post.)
      Time delay in seconds times frequency in Hertz yields phase in cycles and fractions of a cycle.

      Ad hominen? I am attacking your arguments, not you. All those "people" are not in this debate, and thus are not subject to ad hominen attack.
      The phrase "don't want to believe" discusses the person, not their argument. Arguments have no wants or beliefs. Only people have wants and beliefs.


      Let's jump away from acoustics to physics, for a perhaps clearer example, the Ultraviolet Catastrophe: Ultraviolet catastrophe - Wikipedia, the free encyclopedia

      The time is the early 1900s, when Newtonian Physics was King. When one used Newtonian Physics to predict the color of the light emitted by an incandescent body, the theory predicted Blue. Now, everybody who has heated a poker in the fire knows that this is incorrect, that it's shades of red-orange-yellow-white. The best minds of the day tried to come up with a Newtonian analysis that got the experimentally observed result. All failed - Newtonian Mechanics simply could not get there.

      Does this mean that Newton was wrong? No, it does not. It does mean that Newtonian Mechanics is incomplete - there are things it cannot predict. Anyway, Max Plank eventually solved the problem, and founded Quantum Mechanics in the process.

      Note how the physics community handled this disconnect between theory and experiment: They did not claim that people could not have seen red because theory says that it must be blue. They accepted the discordant result (it was gloriously replicable and therefore undeniable), and worked at it till they found the answer. In this extreme case, the result was to overthrow Newtonian Mechanics as the top theory, reducing Newtonian Physics to a special case of Quantum Mechanics (and of Relativity, but that's a parallel story where the disconnect was between Maxwell's Electromagnetics and Newtonian Mechanics regarding the speed of light - Maxwell's view prevailed).

      Comment


      • #18
        In math, yes. But in radar practice these are all summarized as Bessel, understanding all the while that Bessel (actually Bessel-Thompson) is an implementable approximation to Gaussian.
        Seriously? A discrete component approximation to a square pulse matched filter is "summarized as Bessel"? Nonsense.


        Time delay in seconds times frequency in Hertz yields phase in cycles and fractions of a cycle.
        The time between two events does not necessarily involve a phase. You can look up the name of the rhetorical fallacy you have used.


        Note how the physics community handled this disconnect between theory and experiment: They did not claim that people could not have seen red because theory says that it must be blue. They accepted the discordant result (it was gloriously replicable and therefore undeniable), and worked at it till they found the answer.
        You are arguing by analogy. For your analogy to work, all that observational evidence that you have presented showing that the ear/brain can distinguish the difference between two waveforms with different phase anong the harmonics must be equal in quality to that which demonstrated the UC. Oh, wait. You have not presented any evidence. None. Zero. Your analogy is a rhetorical war crime.

        Comment


        • #19
          Originally posted by Mike Sulzer View Post
          Seriously? A discrete component approximation to a square pulse matched filter is "summarized as Bessel"? Nonsense.
          Mike, you're trying to compress an entire signal chain into one block. It's Bessel up until the received LFM chirp is digitized and handed to the matched filter.

          The effect of nonlinear phase, specifically phase ripples, is the generation of false targets.

          The time between two events does not necessarily involve a phase. You can look up the name of the rhetorical fallacy you have used.
          Ahh, in a periodic system, either viewpoint may be used, depending on use. All phase shifters are in fact variable time delays of one kind or another. In wideband radars, we actually do both time steering (a time delay larger than a single cycle of the center frequency) and a phase shift (implemented as time delay less than one period or so). Think of it as a coarse-fine approach.


          You are arguing by analogy. For your analogy to work, all that observational evidence that you have presented showing that the ear/brain can distinguish the difference between two waveforms with different phase among the harmonics must be equal in quality to that which demonstrated the UC. Oh, wait. You have not presented any evidence. None. Zero.
          Yes, it is by analogy. While I have some data points, I made no claim to have presented the entire body of evidence. This debate has endured for decades, and I instead appealed for references, knowing that they had to exist.

          Nor does the fact that I don't personally possess the entire body of evidence prove that it does not exist, or refute any theses.

          Your analogy is a rhetorical war crime.
          Wow. That's floridly ad hominem. But I'm not convinced that The Hague is interested in such a war crime. If not having all the evidence is indeed a crime.

          It's a slippery slope. Be careful not to run afoul of Goodwin's Law.

          Comment


          • #20
            Originally posted by Mike Sulzer View Post
            This attached pdf file ([ATTACH]27364[/ATTACH]) shows a pair Gaussian pulses with a 2 KHz center frequency, a characteristic width of about a millisecond, and a separation of six milliseconds. We shall see that although they are essentially distinct, that is not how they sound. 6 msec is the shortest separation to be considered, 100 msec is the longest. These mp3 files ([ATTACH]27365[/ATTACH], [ATTACH]27366[/ATTACH], [ATTACH]27367[/ATTACH], [ATTACH]27368[/ATTACH], [ATTACH]27369[/ATTACH]) have the various separations. Your results might vary, but I hear a distinct pair of pulses at 100 and 50 msec of separation, a blurring at 25, and then a further loss of distinctness below that. My conclusion is that the response time is on the order of 25 msec. You might hear it a bit differently.
            Just out of interest, only the 6ms examples sounds as one to me.

            I took the original (tfuni220.mp3 and 'phased' tfunro100.mp3 samples and did an FFT on 2k samples, near the start of each. The spectra look very different:
            Click image for larger version

Name:	Original.JPG
Views:	1
Size:	236.3 KB
ID:	832391

            and

            Click image for larger version

Name:	Phased.JPG
Views:	1
Size:	225.0 KB
ID:	832392

            This is counter to my understanding of what you did i.e mangle the phase and not the amplitude. I see all kinds of intermodulation effects which is suggestive of something rather non-linear going on. Is the bug in the transformation or my understanding
            Experience is something you get, just after you really needed it.

            Comment


            • #21
              Originally posted by nickb View Post
              Just out of interest, only the 6ms examples sounds as one to me.

              I took the original (tfuni220.mp3 and 'phased' tfunro100.mp3 samples and did an FFT on 2k samples, near the start of each. The spectra look very different:
              [ATTACH=CONFIG]27417[/ATTACH]

              and

              [ATTACH=CONFIG]27418[/ATTACH]

              This is counter to my understanding of what you [Mike Sulzer] did i.e mangle the phase and not the amplitude. I see all kinds of intermodulation effects which is suggestive of something rather non-linear going on. Is the bug in the transformation or my understanding
              If only the phase changed, the power spectrum ought not change. But I would be suspicious, because one would expect these two spectra to sound different. It isn't clear what's going on.

              Later: I see. These are different waveforms. Read Mike's earlier postings in this thread. In any event, we need to baseline this.
              Last edited by Joe Gwinn; 02-09-2014, 11:59 PM. Reason: Figured it out.

              Comment


              • #22
                The two files you can compare directly on a short time scale are (tfuni220.mp3, tfunr220.mp3). (tfunrp1000.mp3) has the components spread out over the whole time period, and so if you look at only a 2 ms section you should see a different spectrum because the various Fourier components are located in different places, and even wrapped around in time. This is accomplished by an extremely dispersive phase filter with a phase response that is quadratic in frequency and very extreme. This process has nothing to do the relative phases of harmonics in a musical waveform, but it is a method of altering phase, and I included it to show that altering phase can have a huge effect, but it has to be so extreme that the different harmonics are spread out over a time period longer than the impulse response of the ear/brain. That is, you are hearing what might be called "dynamic spectra". I am working on an example that relates this better to the time scale, but it is a bit difficult.

                However, given that, I do not understand why your spectra look the say they do. I do not hear that level of high frequency content.

                On the other test (transient), I do not hear them completely distinct until 25. The 12 sounds modulated, but not distinct. I am 65; my hearing is down in various ways.

                Originally posted by nickb View Post
                Just out of interest, only the 6ms examples sounds as one to me.

                I took the original (tfuni220.mp3 and 'phased' tfunro100.mp3 samples and did an FFT on 2k samples, near the start of each. The spectra look very different:
                [ATTACH=CONFIG]27417[/ATTACH]

                and

                [ATTACH=CONFIG]27418[/ATTACH]

                This is counter to my understanding of what you did i.e mangle the phase and not the amplitude. I see all kinds of intermodulation effects which is suggestive of something rather non-linear going on. Is the bug in the transformation or my understanding

                Comment


                • #23
                  nickb:

                  I read the aiff files for the two cases in question back into Python and computed the power spectra using zero-padded ffts of the entire file. Results are shown here (spectra_i220_rp100.pdf). I have not plotted the full frequency range since there is not much at the higher frequencies. They are pretty similar, but not as close as I think they should be.

                  Comment


                  • #24
                    I turned the mps files back into aiff, read them back into python and computed the spectra (spectra_i220_rp100rc.pdf). Pretty much the same results.

                    Comment


                    • #25
                      A further look at when phase does have an effect.

                      In the first post, there were examples showing that the phases of the harmonics in a musical type of waveform have little if any effect on the sound, and one example where an extreme phase modulation does have an extreme effect. In the second post, there were some examples that made at least a crude measurement of the response time, that is, determining whether two pulses are spaced sufficiently far apart to be heard as two. Can we do something similar for changes in the waveform induced by phase modulation?

                      For this purpose it is necessary to find a good test waveform with some parameter that sets how much the phase is shifted. For this purpose it is fun to start with an example from radio astronomy. A pulsar is a rotating neutron star with a very strong magnetic field which guides intense beams of radio waves emitted by accelerated electrons in the plasma surrounding the star. The beams from some pulsars sweep by the earth periodically; that is, the spinning pulsar is seen as an endless sequence of pulses. The rf signal covers a very wide frequency range; it is a noise like signal, and reaches earth after passing a very great distance through the very tenuous plasma of intergalactic space. This plasma delays the low frequencies with respect to the high frequencies; how much depends on how far away the pulsar is. So the interstellar medium "chirps" the signal, spreading the signal out by frequency (1/f^2), so far that the time between frequencies that astronomers want to observe can exceed the time between pulses for a pulsar that is very far away. It is necessary to "dedisperse" this signal in order to observe the characteristics of the signal, but that is another matter. Here we are interested in dispersing a short pulse to study the audible effects.

                      Is the pulsar signal a good model? Partly. A pulse of random noise is a good start, but it turns out that chirping up in frequency is better than chirping down because we can arrange it so that the signal passes through the frequency range where the ear is most sensitive near its end. So here are two files (tr1.mp3,tr1p5em5.mp3). The first is a short random pulse, less than two milliseconds long. The second file is the same pulse passed through a dispersing filter that increases the phase quadratically (f^2). The shift is large enough to make the chirp very plainly audible. In a later post we will look at in between cases to see how much the phase has to be shifted in order to be audible.

                      Comment


                      • #26
                        There are six waveforms used in this listening test. The first is tr1, heard in the first file attached in the previous post. It is a shaped pulse of random noise, with a falling spectrum (with frequency) and little content above 3.5 KHz. This assures that the highest significant frequencies are well within the range of normal hearing, even for those of us who are not so young any more. The other waveforms are five chirps, c1 through c5, with increasing "stretching: of the waveform. The first three, starting with tr1, are shown in this plot (ranAndTwoCs.pdf); the last three in this (threeLongerCs.pdf). The length of the waveform is clearly visible on the plot. The time scale on the second plot is longer than on the first. The five chirped waveforms are here (tc1.mp3,tc2.mp3,tc3.mp3,tc4.mp3,tc5.mp3). The first waveform (tr1) is a "snap". The last is a mostly a "chirp", but some of them are mostly "snap" or perhaps nearly equal amounts of the two. One reasonable thing to listen for is this: how long is the waveform where the "snap" and "chirp" are heard roughly equally? This might be one reasonable definition of the response tine of the ear/brain, how long a waveform has to be for its length to be very important to the sound.

                        Comment


                        • #27
                          Originally posted by Mike Sulzer View Post
                          There are six waveforms used in this listening test. The first is tr1, heard in the first file attached in the previous post. It is a shaped pulse of random noise, with a falling spectrum (with frequency) and little content above 3.5 KHz. This assures that the highest significant frequencies are well within the range of normal hearing, even for those of us who are not so young any more. The other waveforms are five chirps, c1 through c5, with increasing "stretching: of the waveform. The first three, starting with tr1, are shown in this plot ([ATTACH]27507[/ATTACH]); the last three in this ([ATTACH]27508[/ATTACH]). The length of the waveform is clearly visible on the plot. The time scale on the second plot is longer than on the first. The five chirped waveforms are here ([ATTACH]27509[/ATTACH],[ATTACH]27510[/ATTACH],[ATTACH]27511[/ATTACH],[ATTACH]27512[/ATTACH],[ATTACH]27513[/ATTACH]). The first waveform (tr1) is a "snap". The last is a mostly a "chirp", but some of them are mostly "snap" or perhaps nearly equal amounts of the two. One reasonable thing to listen for is this: how long is the waveform where the "snap" and "chirp" are heard roughly equally? This might be one reasonable definition of the response tine of the ear/brain, how long a waveform has to be for its length to be very important to the sound.
                          I'd like to program these sounds (I use Mathematica). Can you give the generator math? This way I can evade the whole MP3 story at least. Thanks.

                          As for the pulsar, when will the new, ultimate heavy-metal guitar come out, the one made from neutronium?

                          Comment


                          • #28
                            Originally posted by Joe Gwinn View Post
                            I'd like to program these sounds (I use Mathematica). Can you give the generator math? This way I can evade the whole MP3 story at least. Thanks.

                            As for the pulsar, when will the new, ultimate heavy-metal guitar come out, the one made from neutronium?
                            Everything done in this discussion is with routines in the python file below, and itunes is used to convert aiff to mp3 and back. Not sure if this is very clear, but I can answer questions.

                            # aud.py: software for various experiments in audio
                            import pyaudio
                            import wave
                            import time
                            import sys
                            import numpy
                            import pickle
                            from matplotlib.pyplot import *
                            from numpy.random import random_integers as random_integers
                            from scipy.fftpack import fft as fft
                            from scipy.fftpack import ifft as ifft
                            from scipy.signal import convolve as convolve
                            from scipy.signal import fftconvolve as fftconvolve
                            import numpy as np
                            import scipy.optimize as optimize
                            import aifc

                            # Make a stereo int16 buffer from a mono floating point buffer
                            def cfi(buf):
                            ibuf = numpy.zeros(buf.size*2, dtype=numpy.int16)
                            ibuf[0:buf.size*2:2] = buf
                            ibuf[1:buf.size*2:2] = buf
                            return ibuf

                            pms = (2, 2, 44100, 16382, 'NONE', 'not compressed')

                            # Take an int16 buffer and write it out as an aiff file
                            # Typical params: (2, 2, 44100, 16382, 'NONE', 'not compressed')
                            # no. channels, samwidth in bytes, sam frequency, nframes, comp type, comp descr
                            def int16toaiff(buf, params, file):
                            fo = aifc.Aifc_write(file)
                            fo.setparams(params)
                            idatr = buf.byteswap()
                            fo.writeframes(idatr)
                            fo.close()

                            # Routine to make a test function, sinusoidal with multiple harmonics
                            # f0: center freq., (Hz), nharms: number of harmonics, phases: array of
                            # phase values (one for fund., each harmonic).
                            def mtfun(f0, nharms, phases):
                            st = 1./44100.
                            nframes = 32768.
                            amp = 32000./(nharms + 1)
                            tf = numpy.sin(numpy.linspace(0., 2.*numpy.pi*nframes*st*f0, nframes, endpoint = False) + phases[0])
                            for i in range(nharms):
                            tf += numpy.sin(numpy.linspace(0., 2.*numpy.pi*nframes*st*(i+2)*f0, nframes, endpoint = False) + phases[i+1])
                            tfun = numpy.zeros(nframes*2, dtype = numpy.int16)
                            tfun[0:nframes*2:2] = amp*tf
                            tfun[1:nframes*2:2] = amp*tf
                            return tfun

                            # Routine to make a new version of a test function modified by
                            # adding the result of a function of frequency (pfun) to the phase
                            def modph(tfun, pfun):
                            size = tfun.size
                            funzp = numpy.zeros(size, dtype = float)
                            funzp = tfun
                            ft = fft(funzp)
                            ftm = numpy.abs(ft)
                            angs = numpy.arctan2(ft.imag, ft.real)
                            f = numpy.roll(numpy.linspace(-44100./2, 44100./2., size, endpoint = False), size/2)
                            angs += pfun(f)
                            ft.real = ftm*numpy.cos(angs)
                            ft.imag = ftm*numpy.sin(angs)
                            funzpr = ifft(ft)
                            return funzpr.real

                            def quadincr(f):
                            return -f**2*numpy.sign(f)*scale

                            scale = 8.e-6

                            def quaddecr(f):
                            return (1./(f + 100.)**2)*numpy.sign(f)*scale

                            # Make a set of Gaussian transients with a full characteristic width w sec
                            # centered at times tlocs in a buffer of n samples. Sampling frequency of
                            # 44100. is assumed. Center frequency of 2000 Hz
                            def mgt(w, tlocs, n):
                            t = numpy.linspace(0, (n-1)/44100., n)
                            tb = numpy.zeros(n, dtype=float)
                            for ti in tlocs:
                            tb[:] += numpy.exp(-(t - ti)**2/w**2)*numpy.sin(2*numpy.pi*2000.*t)
                            return t, 32000.*tb

                            # Make a set of exponential power transients with a full characteristic width w sec
                            # centered at times tlocs in a buffer of n samples. Sampling frequency of
                            # 44100. is assumed. Center frequency chirps from zero to 5 KHz.
                            # m is the power of the exponential
                            def mgmt(w, tlocs, n, m):
                            t = numpy.linspace(0, (n-1)/44100., n)
                            tb = numpy.zeros(n, dtype=float)
                            for ti in tlocs:
                            framp = (t - ti + w*4.)/ti*5000.
                            tb[:] += numpy.exp(-(t - ti)**m/w**m)*numpy.sin(2*numpy.pi*framp*(t - ti))
                            return t, 32000.*tb

                            # Make a set of exponential power transients (modulating the amp. of ran. noise)
                            # with a full characteristic width w sec
                            # centered at times tlocs in a buffer of n samples. Sampling frequency of
                            # 44100. is assumed.
                            # m is the power of the exponential
                            def mer(w, tlocs, n, m):
                            t = numpy.linspace(0, (n-1)/44100., n)
                            tb = numpy.zeros(n, dtype=float)
                            for ti in tlocs:
                            ranseq = numpy.random.rand(n) - .5
                            gau = numpy.exp(-(numpy.arange(0., n)/10.)**2)
                            ranseqc = fftconvolve(ranseq, gau, mode = 'same')
                            tb[:] += numpy.exp(-(t - ti)**m/w**m)*ranseqc
                            return t, 32000.*tb/numpy.amax(numpy.fabs(tb))

                            pp100 = [.005, .005 + .1]
                            pp50 = [.005, .005 + .05]
                            pp25 = [.005, .005 + .025]
                            pp12 = [.005, .005 + .0125]
                            pp6 = [.005, .005 + .00625]

                            # Read in an aiff file
                            def readaiff(file):
                            fo = aifc.Aifc_read(file)
                            params = fo.getparams()
                            dstr = fo.readframes(params[3])
                            idat = numpy.fromstring(dstr, dtype = numpy.int16)
                            idatr = idat.byteswap()
                            fo.close()
                            return idatr, params

                            Comment


                            • #29
                              Also, I can email you the aiff files if you like.

                              Comment


                              • #30
                                Originally posted by Mike Sulzer View Post
                                Everything done in this discussion is with routines in the python file below, and itunes is used to convert aiff to mp3 and back. Not sure if this is very clear, but I can answer questions.

                                # aud.py: software for various experiments in audio
                                ...
                                Thanks. I did learn Python some years ago, but made little use of it, and have forgotten much of it. But, I should be able to decode this anyway. The math syntax seems to resemble MatLab.

                                As for the various AIFF files, maybe others can use them as well. If so, if they aren't huge, it might be best to post them. Later, I can use them to cross-check my programming.

                                Mathematica can accept AIFF, but not MP3 just yet, though they say they will add this. (Mathematica does just about every scientific file format known.)

                                Comment

                                Working...
                                X