|
Kyma Forum
![]() Kyma Sound Exchange
![]() Phase Shaper
|
| next newest topic | next oldest topic |
| Author | Topic: Phase Shaper | |
|
David McClain Member |
I constructed the attached Sound to determine just what the effects of various kinds of phase distortion would sound like. This Sound uses an FFT to decompose the signal into real and imaginary frequency components. Then each frequency component is multiplied by a complex exponential whose exponent is an arbitrary function of frequency -- the phase distortion. The amplitude of the signal is unchanged in this process. Then the result is sent through an inverse FFT and reconstructed as audio. Here I have used a 7th degree polynomial in a Waveshaper fed by a linear ramp. The linear ramp represents the instantaneous frequency coordinate inside the FFT. The Waveshaper polynomial produces a relative phase at each frequency. Waveshaper output is restricted to the range (-1,1), and so the effect of large phase shifts is produced by feeding this waveshaper output into a quadrature oscillator running at zero frequency, but frequency modulated (probably actually phase modulated...). The modulation index (MI) of this quadrature FM oscillator is adjusted to produce a maximum phase shift of phi_max = 2*Pi*(Fs/2)*tau_max Here, Fs is the Capy sampling rate, tau_max is the maximum desired delay to simulate. This parameter can be adjusted in the rightmost Script, which also sets the FFT size to use. By playing around with various polynomial coefficients you can construct some devilish and unreal phase distortion curves. An oscilloscope display shows you this phase as a function of frequency. When tau_max is set to 0.05, representing a maximum delay of 50 msec, some really nasty things happen to the sound. But at small delay settings, I have trouble detecting any noticeable sound degradation. Perhaps it is just my tin ear... [Then too... 50 msec is much longer than the actual FFT window period. At an FFT size of 1024 samples, and a Capy sampling rate of 48 KHz, that FFT period is only 10.7 msec. So the raunchy sounds are probably a result of this gross mismatch. One probably ought to keep the maximum delay below the FFT period (NFFT/2 samples).] The actual maximum delay at any frequency is given as delay = -1/(2*Pi) * d(phase)/d(freq) So when you use high order polynomial coefficients, and most of the phase change occurs over brief intervals of frequency, you can actually force the effective delay to be much larger than tau_max. For example, using !Coef7 = -1.0 produces a phase shift curve that is steepest at the lowest and highest frequencies. Since I can't hear anything above 16 KHz, the noticeable effects are those happening in the bass region. And these are quite bad with severe phase shift slopes. Now how badly does recording and reproduction equipment really affect the bass region? Nobody furnishes any hard figures for this. They only quote anecdotal information. At least with this Sound you can hear for yourself how a bad amount of phase distortion would sound. - DM [NOTE: A constant phase shift set by !Coef0 should be completely indiscernable, as should a linear phase ramp produced with !Coef1. If you hear grunge with either of these (most likely !Coef1) then you have a gross mismatch in your tau_max with respect to the FFT window size. A constant phase offset is completely arbitrary, since the reference of phase can be any value. Since a constant has a zero derivative with respect to frequency, it cannot affect the sound in any way. A linear phase ramp is completely equivalent to a constant time delay in the signal and hence cannot affect the sound quality. Higher order polynomial coefficients are the ones that should begin to show effects, if you can hear them at all. These cause non-constant phase shift with respect to frequency, and hence are dispersive. Apparently, the effects should begin to sound mushy as the frequency components lose their coherence among the partials of musical timbres. ] [BTW!! This sound forms the basis for a creative tool as well... If you have a dispersive sound processing system and you can measure its phase distortion as a function of frequency, then you can simply scale that phase distortion and store it in a Wavetable sound file, and adjust tau_max to correspond to the maximum phase shift. Put an inverter at the output of the Wavetable Sound block and this system will correct the phase distortion and compensate the frequency dependent group delays. So you could use this sound to help clean up the recordings produced by an imperfect system. Since all analog, and digital IIR, filters (and hence, most EQ's) produce nonlinear phase distortion, this system approximates the inverse all-pass filter needed to flatten out that phase response. This is an all-pass filter in the sense that it does nothing to signal amplitude. It merely warps the phase of the signal and can restore (some) lost signal coherence. [This message has been edited by David McClain (edited 11 November 2002).] IP: Logged | |
|
pete Member |
Hi David You’re close to a subject that I have been giving lots of thought to over the years. That is Can our ears and brains detect phase or not ? But first the question itself has to be qualified, because phase is a relative thing. Can our ears detect phase differences between the harmonics of a sound ? And Can our ears detect phase differences between the left and right ear. My basic experiments (with continues sounds only ) suggests that above 1Khz approx , we are unable to detect and phase differences between ears but we can detect phase differences below 1Khz. My experiments (with continuous sounds only ) also suggest that we cannot detect any phase differences between harmonics at all (assuming we are only using one ear). This is where my gut feeling takes over. I believe that we cannot detect phase differences between none continuous sounds either , even though experiments like the one you are showing here suggest otherwise. Your experiment shows that if we pull all the frequencies apart and put them back together again without changing the phase, the signal sounds very different to one in which the relative phases had been changed before putting them back together. Many people say that this is proof that phase is important to the way we hear things. I believe otherwise and that this is caused by another anomaly .i.e. we are hearing something other than simple phase errors. If we think of our ears and brain as doing a form of FFT or rather DFT on the sounds we hear, we can start looking at it in a different way. If we had a signal that was silent for 2 seconds followed by a 1Khz sine wave switching hard on, then our ears and brain would decode that as a click mixed in with a 1khz sinewave smoothly turning on. The click would be represented as higher frequencies turning on and off. Different window widths at different frequencies of this imaginary ear/brain emulating DFT will give different interpretations of this switching on sinewave, even if the phase info were disposed of. If we now took this switching on signal and put it through an FFT followed by a phase shaper and then a reverse FFT, and then played that signal to our ears ,we will see that the ear/brain interpretation of the click would have all different frequency contents for different types of phase shaping. The ear/brain interpreter wouldn’t need to know anything about the phase of the incoming signal to tell that it sounded different. I believe that if we could find a DFT that perfectly match the dynamics of our ear/brain combination then playing about with the phase components would have no audible significance. Of cause I could be totally wrong with my thinking but if I’m right then the audible effect that the phase is have in your phase shaper may be more a function of the Type of FFT (and how different that is to human FFT/DFT) than of the phase itself. IP: Logged | |
|
pete Member |
The attached module cluster mucks up the phase of the various frequencies in a semi random way but without using the FFTs and I can’t hear the difference between the corrupted and the noncorrupted when I click on the "corrupted" check box. If you click on the test signal check box, the wave display show the input mixed with the out put so that you can get an idea of the phase error by moving the freq control up slowly and watching for the cancelling out. This convinces me even more that we cannot hear phase errors but just the effects that phase errors on have FFTs and non linear devices. [This message has been edited by pete (edited 11 November 2002).] IP: Logged | |
|
David McClain Member |
Hi Pete, I want to take some time to digest what you are saying here... but offhand, I would agree with you in part -- for small phase shifts and high frequencies. However, extreme differential phase shifts are equivalent to time delays at the affected frequencies, and it should be clear that if you delay all the higher frequencies of, e.g., a drum strike, you would begin to hear the dispersion as a chirp sweeping upward. In other words, severe dispersion really is detectable and resembles little of the original sound. But more thoughts will follow after dinner and an hour spent thinking about your comments. Thanks for the follow up and mental challenge! - DM IP: Logged | |
|
pete Member |
Hi David Seeing what you have said so far, hsa made me think that maybe I should qualify what I mean by a phase shift and what I mean by a delay. If we consider each frequency in a complex signal as a continues sine wave with a time varying amplitude envelope laid on top of it , then replacing the sine wave with a cos wave or an inverted sine wave but keeping the envelope in the same place in time, would be a phase shift. But if we moved the envelope in time with or without changing the underling sine wave, this would be a delay. With this definition the largest phase shift possible would be 360 degs as any thing larger would be the same as that phase shift minus 360 degs. But in the real world its hard to do one without the other. Even my example of the phase corrupter does delay the signal as well and we would eventually hear the delaying effects if we added more and more stages. Your example using FFTs is closer to moving the phase without moving the envelope at all . But the problem is that splitting a complex signal up into sine waves with envelopes on top of them is an ambiguous thing as FFTs and DFTs come in different shapes and sizes and there is no such thing as the definitive true one. But if we could find one that matched the human ear/brain system then I believe that even the drum strikes phases could be shifted and we wouldn’t hear anything different. One thing we can say though is that the ear/brain decoder will not be FFT as the spacing between bands at high frequencies are fractions of a semitone and the spacing at low frequencies can be as large as an octave. Experimenters Love FFT because its fast, but I believe that DFT will be needed to prove or disprove my thoughts about phase and hearing. IP: Logged | |
|
David McClain Member |
Hi Pete,
quote: That's because a phase shift gradient is a delay! That is to say, you can add or subtract arbitrary amounts of constant phase to a sinewave and you still have effectively the same sinewave, and our ears cannot tell the difference. If you add or subtract the same amount at all frequencies in a more complex audio signal, you still have essentially that same audio signal, and again our ears cannot hear the difference. You can prove this to yourself by simply moving your head a short distance while listening to audio from loudspeakers. The sound is the same, as long as you don't move outside the main sound lobe. But any time you apply different amounts of phase shift at each frequency in an audio signal you are creating a time delay between those frequency components. A delay is created whenever you have a nonzero derivative, or rate of change, of phase with respect to frequency. A constant time delay is equivalent to multiplying the audio by a linear phase ramp in the frequency domain. Something like Exp(I*2*Pi*F*tau) where I is the imaginary basis (square root of -1), F is frequency, and tau is the expected time delay. This is a linear phase ramp with frequency, since the graph of (F*tau) with respect to F is a straight line. The greater the delay tau, the higher the slope of that phase ramp -- i.e., the faster that phase changes as you go up in frequency. We can apply Delay Sounds with Kyma in the time domain to achieve any integral number of sample periods delay. But if you need to delay by a fractional sample time period, then you pretty much have to resort to doing it in the frequency domain with a complex exponential multiplier -- i.e., a linear phase ramp. ------------ Both your experiments and my own on the precedence effect show that at frequencies above 1 KHz we can very well detect time of arrival differences as short as a few tens of microseconds. But below some crossover frequency we lose this ability. This effect is related to phase differences in the left and right ears, but I would contend that these phase differences are the type created by a linear phase ramp in the frequency domain -- a constant time delay at all frequencies. The kinds of phase delays I was attempting (crudely) to correct are of higher order than these linear phase ramps. As you know an analog EQ will produce phase delays that are frequency dependent and nonlinear -- i.e., not a straight line function of frequency. Those are the kinds of phase shifts I was talking about in the recording and reproduction stages of studio equipment. There may well also be a gradual time delay in recorded lower frequencies, since the amplitude of the signals change so much more slowly than at higher frequencies, possibly causing a change in the ability to magnetize a tape recording. And might that account for the anecdotal delaying of the bass? But now that we are in the era of digital recordings this effect ought to vanish with modern recordings. Hence there will be no need for this kind of corrective action. The bits in a digital recording have a very high rate and the recording occurs at some very high frequency in order to accommodate the broad bandwidth of such modulation. Any phase shift with frequency cannot affect the pitch, nor the phase relationship of the partials, of the sound. It will only affect the ability of the demodulator to unscramble the sounds from the recorded bit stream. In this case I would expect severe phase distortion in the recording and playback process to produce short dropouts when the demodulator loses lock on the digital signal. So maybe this de-phaser is a relic implemented in the most modern digital processing hardware available; the Kyma and Capybara. It does sound good, but then maybe that's only because it sounds different? - DM IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.