0
$\begingroup$

I'm able to make a standard band limited saw wave, but at some point in the past, I remember reading that if you phase offset the sinusoids, you get a different looking wave form that sounds the same.

Trying to implement this by offsetting the phase 270 degrees, I'm seeing a different looking wave form but it doesn't quite sound the same. It has less volume and sounds a little less bright.

Am I remembering correctly / implementing correctly? Here's the saw and "other" wave below:

saw wave

Thanks!

$\endgroup$
2
$\begingroup$

Have you normalized the waveforms differently? The lowest point of the phase-shifted saw should be at amplitude -2 ln(2) / pi = -0.44 if the amplitude of the saw is normalized to -1 .. 1. The positive peak of the phase-shifted saw approaches infinity as you increase the bandwidth. So you could also have a clipping problem. Nonlinearities of the physical world affect the phase-shifted saw more strongly. The two waveforms have the same power spectrum and "complex envelope", but human hearing is more complex and may be able to detect some difference.

$\endgroup$
  • $\begingroup$ You are right... I was normalizing each to have a max peak of -3db and thus the overall volume changed. If I leave the volume alone, the 2nd form does indeed clip and that changes the sound quite a bit. Thanks olli! $\endgroup$ – Alan Wolfe Apr 9 '15 at 14:36
2
$\begingroup$

if you have MATLAB, check this out and see if you can hear a difference:

%
%   sawtooth_phase.m
%
%   a test to see if we can really hear phase changes
%   in the harmonics of a Nyquist limited sawtooth wave.
%
%   (c) 2004 rbj@audioimagination.com
%

if ~exist('Fs')
    Fs = 44100                      % sample rate, Hz
end

if ~exist('f0')
    f0 = 110.25                     % fundamental freq, Hz
end

if ~exist('tone_duration')
    tone_duration = 2.0             % seconds
end

if ~exist('change_rate')
    change_rate = 1.0               % Hz
end

if ~exist('max_harmonic')
    max_harmonic = floor((Fs/2)/f0) - 1
end  

if ~exist('amplitude_factor')
    amplitude_factor = 0.25         % this just keeps things from clipping
end

if ~exist('outFile')
    outFile = 'sawtooth_phase.wav'
end


                              % make sure we don't uber-Nyquist anything
max_harmonic = min(max_harmonic, floor((Fs/2)/f0)-1);

t = linspace(0.0, tone_duration, Fs*tone_duration+1);

detune = change_rate;

x = sin(2*pi*f0*t);                  % start with 1st harmonic

n = 2;                               % continue with 2nd harmonic
while (n <= max_harmonic)
    if ((n-1) == 2*floor((n-1)/2))  % lessee if it's an "even" or "odd" term
        x = x + (1/n)*sin(2*pi*n*f0*t);
     else
        x = x - (1/n)*sin(2*pi*(n*f0+detune)*t);
        detune = -detune;       % comment this line in an see some
    end                         % funky intermediate waveforms
    n = n + 1;                      % continue with next harmonic
end

x = amplitude_factor*x;

% x = sin((pi/2)*x);               % toss in a little soft clipping

plot(t, x);                      % see
sound(x, Fs);                    % hear
wavwrite(x, Fs, outFile);        % remember

and try reducing the max_harmonic to something like 10 or 20.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.