Reply by glen herrmannsfeldt July 30, 20062006-07-30
mailprassi@gmail.com wrote:


> i am designing a low pass filter and high pass filter to pass my > audio samples. in matlab i checked out both butterworth and > chebyshev(cheby2) 3rd order filter. > I have observed there is a lot of differance in the phase plot of > both the filters. > Now my query went to what actuall effect of phase in audio? please > anybody help me in solving this.
As I understand it, phase shifts are audible, but much less than many other effects that can happen to a signal. It was explained to me that at low frequencies the nerve impulses are generated once per cycle at a fairly fixed point on the cycle. At higher frequencies nerve impulses are not generated on each cycle, but once every few cycles, and again at an approximately fixed position in the cycle. If phase wasn't important to evolution, there wouldn't be any reason for us to be sensitive to it. Sensing the direction of a sound source is important, and in one dimension can be done by the time difference in arrival between the two ears. Phase shifts that are the same between left and right won't affect that much. Sensing direction on a different axis is a complicated function of the frequency spectra due to the shape of the outer ear. There might be some effects of phase on that, though in a stereo signal there won't be any such signal left. Some audiophiles like to make a big thing about phase, sometimes even absolute phase. (A 180 degree phase shift in both channels.) I mostly don't believe phase is important. -- glen
Reply by robert bristow-johnson July 28, 20062006-07-28
Andor wrote:

> > With max_harmonic = 10, the "flanging" effect is still audible, albeit > only over headphones.
make sure you changed it on the MATLAB command line:
>>max_harmonic = 10; >>square_phase
because, if you ran it with: if ~exist('max_harmonic') max_harmonic = floor((Fs/2)/f0) - 1 end then changed it to if ~exist('max_harmonic') max_harmonic = 10 end and ran it again without
>>clear
then the old number would still be used.
> I can't hear it when I compare the two sound > files over speakers. Then again, the construction work outside my > window isn't making audibility tests very reliable ...
another thing to do is to slow down the change rate. if there is a change rate that is slow enough that you can't hear the difference, that still means that you can't hear the absolute phase difference.
> Nice test, thanks.
just to reiterate, my side of this little dispute was that phase *was* or *is* or *can be* perceptually salient. i just thought that this was a useful example of where this perception is difficult (granting that to the other side). but, even in this case, since the waveforms are clearly different, you toss in sufficient non-linearity, and you'll hear a difference. that, plus the other cases (detuning) is where i based my claim that Andrew Horner did not sufficiently justify setting the phase angles of all of his harmonics to zero at the outset of all of his wavetable synthesis work. i believe he has not addressed this, even in his response to my letter to the AES editor 3 years ago. r b-j
Reply by Andor July 28, 20062006-07-28
robert bristow-johnson wrote:
> Andor wrote: > > robert bristow-johnson wrote: > > ... > > > i'm wondering - did anyone run my MATLAB program? you can use the > > > axis() command to zoom in and look at the waveform. > > > > Yes. A normal square wave I get with this code: > > > > % x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); > > x = x - (1/n)*cos(2*pi*(n*f0)*t); > > > > The wave that your original code > > > > x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); > > % x = x - (1/n)*cos(2*pi*(n*f0)*t); > > > > generates sounds like a flanged version of the first. Very audible > > difference. > > try it with a reduced number of harmonics. maybe with max_harmonic = > 10.
With max_harmonic = 10, the "flanging" effect is still audible, albeit only over headphones. I can't hear it when I compare the two sound files over speakers. Then again, the construction work outside my window isn't making audibility tests very reliable ... Nice test, thanks. Regards, Andor
> > r b-j
Reply by robert bristow-johnson July 27, 20062006-07-27
Andor wrote:
> robert bristow-johnson wrote: > ... > > i'm wondering - did anyone run my MATLAB program? you can use the > > axis() command to zoom in and look at the waveform. > > Yes. A normal square wave I get with this code: > > % x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); > x = x - (1/n)*cos(2*pi*(n*f0)*t); > > The wave that your original code > > x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); > % x = x - (1/n)*cos(2*pi*(n*f0)*t); > > generates sounds like a flanged version of the first. Very audible > difference.
try it with a reduced number of harmonics. maybe with max_harmonic = 10. r b-j
Reply by Andor July 27, 20062006-07-27
robert bristow-johnson wrote:
...
> i'm wondering - did anyone run my MATLAB program? you can use the > axis() command to zoom in and look at the waveform.
Yes. A normal square wave I get with this code: % x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); x = x - (1/n)*cos(2*pi*(n*f0)*t); The wave that your original code x = x - (1/n)*cos(2*pi*(n*f0+detune)*t); % x = x - (1/n)*cos(2*pi*(n*f0)*t); generates sounds like a flanged version of the first. Very audible difference. Regards, Andor
Reply by robert bristow-johnson July 27, 20062006-07-27
Andor wrote:
> robert bristow-johnson wrote: > > Andor wrote: > > > > > > > > I got some interesting articles by googling for "is phase audible". > > > > "article_s_" (plural)? i got one hit. some guy's powerpoint in pdf > > about watermarking and hiding bits: > > Don't know which Google you used,
i used quotes (which i mistakenly thought you did).
> mine revealed this: > > http://www.google.ch/search?hl=de&q=is+phase+audible&meta= > > The second hit seemed quite relevant.
ya.
> There's more further down.
i'm wondering - did anyone run my MATLAB program? you can use the axis() command to zoom in and look at the waveform. r b-j
Reply by Andor July 27, 20062006-07-27
robert bristow-johnson wrote:
> Andor wrote: > > > > > I got some interesting articles by googling for "is phase audible". > > "article_s_" (plural)? i got one hit. some guy's powerpoint in pdf > about watermarking and hiding bits:
Don't know which Google you used, mine revealed this: http://www.google.ch/search?hl=de&q=is+phase+audible&meta= The second hit seemed quite relevant. There's more further down. Regards, Andor
Reply by robert bristow-johnson July 26, 20062006-07-26
ooops.

robert bristow-johnson wrote:

...
> if you run this under ideal linear playback conditions, it's unlikely > you'll be able to hear the change in waveshape. if there is a slight > non-linearity in between, you may very well. i have an ongoing > disagreement with Andrew Horner who has just published, in the JAES, > his umpteenth paper about Wavetable Synthesis
this was copied from an earlier post of mine and i didn't read it enough to see it contained dated information. Andrew published that paper a couple of years ago. he may have published continuations to it since, but i can't remember.
> where he just assumes, at > the very beginning, that phase is inaudible and he can set phase to whatever he wants. > > r b-j
Reply by robert bristow-johnson July 26, 20062006-07-26
Andor wrote:

> > I got some interesting articles by googling for "is phase audible".
"article_s_" (plural)? i got one hit. some guy's powerpoint in pdf about watermarking and hiding bits: When is phase audible? =B7 Sometimes ... in certain compound tones with frequency components lying within a critical band s(t) =3D A*[ (1/2)*cos((w1-w2 )*t) + cos(w1*t + phi) + (1/2)*cos((w1+w2 )*t) ] that's not the only case. but it's another good special "pathological" case. i invite anyone with MATLAB to run this program (or translate it to Mathcad or Octave or Python or Mathematica or whatever). the waveform transistions in such a way that it looks pathologically different, but sounds the same. especially if max_harmonic is about 10 or 15. ___________________ % % square_phase.m % % a test to see if we can really hear phase changes % in the harmonics of a Nyquist limited square wave. % % (c) 2004 rbj@audioimagination.com % if ~exist('Fs') Fs =3D 44100 % sample rate, Hz end if ~exist('f0') f0 =3D 110.25 % fundamental freq, Hz end if ~exist('tone_duration') tone_duration =3D 2.0 % seconds end if ~exist('change_rate') change_rate =3D 1.0 % Hz end if ~exist('max_harmonic') max_harmonic =3D floor((Fs/2)/f0) - 1 end if ~exist('amplitude_factor') amplitude_factor =3D 0.25 % this just keeps things from clipping end if ~exist('outFile') outFile =3D 'square_phase.wav' end % make sure we don't uber-Nyquist anything max_harmonic =3D min(max_harmonic, floor((Fs/2)/f0)-1); t =3D linspace((-1/4)/f0, tone_duration-(1/4)/f0, Fs*tone_duration+1); detune =3D change_rate; x =3D cos(2*pi*f0*t); % start with 1st harmonic n =3D 3; % continue with 3rd harmonic while (n <=3D max_harmonic) % lessee if it's an "even" or "odd" term if ((n-1) =3D=3D 4*floor((n-1)/4)) x =3D x + (1/n)*cos(2*pi*n*f0*t); else x =3D x - (1/n)*cos(2*pi*(n*f0+detune)*t); detune =3D -detune; % comment this line in an see some end % funky intermediate waveforms n =3D n + 2; % continue with next odd harmonic end x =3D amplitude_factor*x; % x =3D sin(pi/2*x); % toss in a little soft clipping plot(t, x); % see sound(x, Fs); % hear wavwrite(x, Fs, outFile); % remember ___________________ if you run this under ideal linear playback conditions, it's unlikely you'll be able to hear the change in waveshape. if there is a slight non-linearity in between, you may very well. i have an ongoing disagreement with Andrew Horner who has just published, in the JAES, his umpteenth paper about Wavetable Synthesis where he just assumes, at the very beginning, that phase is inaudible and he can set phase to whatever he wants.=20 r b-j
Reply by Andor July 26, 20062006-07-26
Prasad wrote:

> Hello all, > > i am designing a low pass filter and high pass filter to pass my > audio samples. in matlab i checked out both butterworth and > chebyshev(cheby2) 3rd order filter. > I have observed there is a lot of differance in the phase plot of > both the filters. > Now my query went to what actuall effect of phase in audio? please > anybody help me in solving this.
I got some interesting articles by googling for "is phase audible".