On Monday, July 6, 2020 at 1:03:21 PM UTC-5,
[email protected] wrote:
On Monday, July 6, 2020 at 12:30:41 PM UTC-5, [email protected] wrote:
On Monday, July 6, 2020 at 8:04:23 AM UTC-7, [email protected] wrote:
I ran across a problem in a DSP book that got me to thinking
(the best kind of problem).
The author suggests that we can illustrate aliasing by sampling an
audio signal at a high frequency and then replacing samples with zeroes to get a lower effective sampling frequency. For example, if we
sample at fs1 = 32 kHz and then keep every M = 4th sample
(replacing the other samples with zeroes) then the resulting signal
is equivalent to sampling at fs2 = 8 kHz (fs1/M).
I agree that aliasing is present (if the original signal has content above 4 kHz), but if you play the new signal back at 32 kHz you will
also hear "replica" distortion. To get a better sense of just aliasing due to sampling at 8 kHz you should low pass filter the new signal
with a cutoff frequency of 4 kHz (fs2/2 or fs1/(2M)).
Without getting too much detail, it does seem like two different things.
I didn't know the name "replica distortion" before.
Another choice is to generate four copies of every fourth sample.
I think you should try them all and see what they sound like.
Oh, I have tried it. With a 400 Hz tone and original sampling at 32 kHz
and then reducing the sample rate to 2 kHz you can hear the 1600 Hz
replica. There are spectral lines at (n*2000 +- 400). If you reduce the sample rate to 500 Hz you can hear an alias at 100 Hz. The spectral lines
are at (n*500 +- 400). I am playing around with a replica elimination
filter now so that I only hear the distortion due to aliasing. The goal is
to produce a signal that would sound the same as an undersampled signal.
The Octave/MATLAB code for this is below:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This procedure is equivalent to down-sampling (without a LPF anti-aliasing
% filter) followed by up-sampling (without a LPF anti-replica) filter.
%
% To truly hear only aliasing a LPF anti-replica filter should be used. %%%%%%%%%%%%%%%%%%%%%%%%%%%%
f0 = 400;
fs = 32000; % sample rate
t = 2; % seconds
xf = @(f0, fs, n) 0.75*sin(2*pi*f0*n/fs);
n = (0:t*fs-1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x = xf(f0, fs, n);
X = fft(x);
clf;
subplot(3,2,1)
plot((0:length(X)-1)*fs/length(X), 20*log10(abs(X)))
xlim([0 5000])
drawnow();
player = audioplayer(x, fs);
playblocking(player)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsn = 2000;
r = fs/fsn; % 16
xn = zeros(size(x));
xn(1:r:end) = x(1:r:end);
X = fft(xn);
subplot(3,2,3)
plot((0:length(X)-1)*fs/length(X), 20*log10(abs(X)))
xlim([0 5000])
drawnow();
player = audioplayer(xn, fs);
playblocking(player)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fsn = 500;
r = fs/fsn; % 64
xn = zeros(size(x));
xn(1:r:end) = x(1:r:end);
X = fft(xn);
subplot(3,2,5)
plot((0:length(X)-1)*fs/length(X), 20*log10(abs(X)))
xlim([0 5000])
drawnow();
player = audioplayer(xn, fs);
playblocking(player)
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)